MAK RTIspy API Documentation for HLA 1.3
interMgr.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: interMgr.h,v $ $Revision: 1.64 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef interMgr_H_
10 #define interMgr_H_
11 
14 
15 #include <vlutil/vlList.h>
16 #include <vlutil/vlHashlist.h>
17 #include <vlutil/vlFedTarget.h>
18 #include "fomMgr.h"
19 #include "connectMgr.h"
20 #include "RIDparams.h"
21 #include "pHandValSet.h"
22 #ifdef DtMOM
23 #include "tallySet.h"
24 #endif
25 
26 class DtRtiSaveFile;
28 class DtInteractionMgr;
29 class DtFomClassMgr;
30 class DtMomMgr;
31 class DtTimeMgr;
32 class DtInteractionMsg;
33 class DtPubInterMsg;
34 class DtUnpubInterMsg;
35 class DtSubInterMsg;
36 class DtUnsubInterMsg;
37 class DtResignMsg;
38 class DtRegion;
39 class DtPhvps;
40 
46 {
47 public:
49  typedef DtInteractionMgr* (*DtInteractionMgrCreator)(DtFederateMgr* fedMgr);
50 
51 protected:
52 
55 
56 public:
57 
59  virtual ~DtInteractionMgr();
60 
61 private:
62 
64  DtInteractionMgr(DtInteractionMgr const& other);
65 
67  DtInteractionMgr& operator=(DtInteractionMgr const& other);
68 
69 public:
70 
72  virtual void postJoinInit();
73 
75  virtual bool isPostJoined() const;
76 
78  virtual void publish(
79  DtInteractionClassHandle theInteraction);
80 
82  virtual void unpublish(
83  DtInteractionClassHandle theInteraction);
84 
86  virtual void subscribe(
87  DtInteractionClassHandle theClass,
88  bool active);
89 
91  virtual void unsubscribe(
92  DtInteractionClassHandle theClass);
93 
95  virtual unsigned long send(
96  DtInteractionClassHandle theInteraction,
97  const DtPhvps& params,
98 #ifdef DtIFSPEC1516
99  rti1516::LogicalTime const * theTime,
100  rti1516::VariableLengthData const & theTag,
101 #elif defined(DtIFSPEC1516E)
102  rti1516e::LogicalTime const * theTime,
103  rti1516e::VariableLengthData const & theTag,
104 #else
105  RTI::FedTime const * theTime,
106  const char* theTag,
107 #endif
108  DtHandle channel,
109  bool anonymous=false);
110 
112  MAKRti::DtTransportType getTransport( DtInteractionClassHandle theClass );
113 
115  virtual void setTransport( DtInteractionClassHandle theClass,
116  MAKRti::DtTransportType theType);
117 
118 #ifdef DtIFSPEC1516E
119 
120 
121  virtual void requestInteractionTransportationTypeChange( DtInteractionClassHandle theClass,
122  MAKRti::DtTransportType theType );
123 #endif
124 
126  virtual void setOrder(DtInteractionClassHandle theClass,
127  MAKRti::DtOrderType theType);
128 
129 #ifdef DDM
130 #ifdef DtIFSPEC1516
131 
133  virtual void subscribeInteractionClassWithRegions (
134  DtInteractionClassHandle theClass,
135  rti1516::RegionHandleSet const & theRegionHandleSet,
136  bool active) {}
137 
139  virtual void unsubscribeInteractionClassWithRegions (
140  DtInteractionClassHandle theClass,
141  rti1516::RegionHandleSet const & theRegionHandleSet) {}
142 
145  virtual unsigned long send(
146  DtInteractionClassHandle theInteraction,
147  const DtPhvps& params,
148  rti1516::RegionHandleSet const & theRegionHandleSet,
149  rti1516::LogicalTime const * theTime,
150  rti1516::VariableLengthData const & theTag,
151  bool anonymous=false) {return 0;}
152 
153 #elif defined(DtIFSPEC1516E)
154 
155  virtual void subscribeInteractionClassWithRegions (
156  DtInteractionClassHandle theClass,
157  rti1516e::RegionHandleSet const & theRegionHandleSet,
158  bool active) {}
159 
161  virtual void unsubscribeInteractionClassWithRegions (
162  DtInteractionClassHandle theClass,
163  rti1516e::RegionHandleSet const & theRegionHandleSet) {}
164 
167  virtual unsigned long send(
168  DtInteractionClassHandle theInteraction,
169  const DtPhvps& params,
170  rti1516e::RegionHandleSet const & theRegionHandleSet,
171  rti1516e::LogicalTime const * theTime,
172  rti1516e::VariableLengthData const & theTag,
173  bool anonymous=false) {return 0;}
174 #else
175 
178  DtInteractionClassHandle theClass,
179  DtRegion &theRegion,
180  bool active) {}
181 
184  DtInteractionClassHandle theClass,
185  DtRegion &theRegion) {}
186 
189  virtual unsigned long send(
190  DtInteractionClassHandle theInteraction,
191  const DtPhvps& params,
192  RTI::FedTime const * theTime,
193  const char* theTag,
194  DtRegion& theRegion,
195  bool anonymous=false) {return 0;}
196 
197 #endif
198 #endif
199 
200 
201  virtual int acceptInteraction(const DtInteractionMsg& msg);
202 
205  virtual int subscribed(DtInteractionClassHandle handle);
206 
209  virtual int published(DtInteractionClassHandle handle);
210 
212  virtual void sendSubscribeMsg(DtInteractionClassHandle theInter, bool isPassive);
213 
215  virtual void sendPublishMsg(DtInteractionClassHandle theInter);
216 
218  virtual void sendUnsubscribeMsg(DtInteractionClassHandle theInter,
219  bool forSmartForwarding=false);
220 
222  virtual void sendUnpublishMsg(DtInteractionClassHandle theInter);
223 
225  virtual void sendInteractionMsg(
226  DtInteractionClassHandle theClass,
227  const DtPhvps& theParams,
228  MAKRti::DtTransportType transportType,
229  MAKRti::DtOrderType orderType,
230 #ifdef DtIFSPEC1516
231  rti1516::LogicalTime const * theTime,
232  rti1516::VariableLengthData const & theTag,
233 #elif defined(DtIFSPEC1516E)
234  rti1516e::LogicalTime const * theTime,
235  rti1516e::VariableLengthData const & theTag,
236 #else
237  RTI::FedTime const * theTime,
238  const char* theTag,
239 #endif
240  unsigned long serialNumber, DtHandle channel, bool anonymous=false);
241 
244  virtual void addPendingStartInters(
245  DtInteractionClassHandle theClass);
246  virtual void addPendingStopInters(
247  DtInteractionClassHandle theClass);
248 
250  virtual void sendPendingStartInters();
251  virtual void sendPendingStopInters();
252 
255  virtual void sendPendingSubscription();
256  virtual void addPendingSubscription(DtObjectClassHandle theClass,
257  bool isPassive);
258 
261  virtual void sendPendingUnsubscription();
262  virtual void addPendingUnsubscription(DtObjectClassHandle theClass,
263  bool forSmartForwarding);
264 
266  virtual void preTick();
267 
269  virtual void postTick();
270 
272  virtual void processResign(const DtResignMsg& msg);
273 
275  virtual DtInteractionClassInfo* firstSubscribedClass(
276  DtInteractionClassInfo* classDesc);
277 
280  void enableRelevanceAdvisorySwitch();
281  void disableRelevanceAdvisorySwitch();
282 
284  void setRelevanceAdvisorySwitch(bool enableSwitch);
285  bool relevanceAdvisorySwitch();
286 
288  virtual MAKRti::DtInetAddr localAddrMap(
289  DtInteractionClassHandle theClass, DtHandle theChannel);
290 
291 #ifdef DDM
292 
293 
294 
297  virtual void checkForRegionalSubscribe(DtInteractionClassInfo& info) {}
298 
301  virtual void checkForRegionalPublish(DtInteractionClassInfo& info) {}
302 
303 #endif
304 
306  virtual bool save(DtRtiSaveFile& file);
307 
309  virtual void prepareToRestore();
310 
312  virtual bool restore( DtRtiSaveFile& file );
313 
315  DtFederateMgr* federateMgr();
316  DtFederateMgr* federateMgr() const;
317 
319  DtConnectionMgr* connectMgr();
320  DtConnectionMgr* connectMgr() const;
321 
323  DtRIDParameters* params();
324  DtRIDParameters* params() const;
325 
327  DtFomClassMgr* fom();
328  DtFomClassMgr* fom() const;
329 
330 #ifdef DtMOM
331 
332  DtMomMgr* momMgr();
333  DtMomMgr* momMgr() const;
334 #endif
335 
336 #ifdef DtTIME
337 
338  virtual DtTimeMgr* timeMgr();
339  virtual DtTimeMgr* timeMgr() const;
340 #endif
341 
342 
343 public:
344 
348  static DtInteractionMgr* create(DtFederateMgr* fedMgrPtr);
349 
352  static void setCreatorFunction(DtInteractionMgrCreator fn);
353 
358  static void setInternalCreatorFunction(DtInteractionMgrCreator fn);
359 
360 
361 protected:
362 
363  //Increment MOM tally
364  void fastIncrementSentTally(DtInteractionClassHandle classHandle,
365  MAKRti::DtTransportType transport);
366  void fastIncrementReceivedTally(DtInteractionClassHandle classHandle,
367  MAKRti::DtTransportType transport);
368 
370  virtual void processInteraction(const DtInteractionMsg& msg);
371  virtual void processPub(const DtPubInterMsg& msg);
372  virtual void processUnpub(const DtUnpubInterMsg& msg);
373  virtual void processSub(const DtSubInterMsg& msg);
374  virtual void processUnsub(const DtUnsubInterMsg& msg);
375 
378  virtual void addClassMulticast(DtInteractionClassInfo* classDesc);
379  virtual void removeClassMulticast(DtInteractionClassInfo* classDesc);
380 
381 #ifdef DtMOM
382  //Increment MOM tally
383  virtual void incrementSentTally(DtInteractionClassHandle classHandle,
384  MAKRti::DtTransportType transport);
385  virtual void incrementReceivedTally(DtInteractionClassHandle classHandle,
386  MAKRti::DtTransportType transport);
387 #endif
388 
389 #ifdef DDM
390 #ifdef DtIFSPEC1516
391 
392  virtual void calculateRegionSet(
393  DtInteractionClassInfo const& sentClassInfo,
394  DtInteractionClassInfo const& receivedClassInfo,
395  unsigned long channel,
396  rti1516::RegionHandleSet & regionHandles) {}
397 #elif defined(DtIFSPEC1516E)
398 
399  virtual void calculateRegionSet(
400  DtInteractionClassInfo const& sentClassInfo,
401  DtInteractionClassInfo const& receivedClassInfo,
402  unsigned long channel,
403  rti1516e::RegionHandleSet & regionHandles) {}
404 #else
405  virtual void calculateRegionSet(
406  DtInteractionClassInfo const& sentClassInfo,
407  unsigned long channel, DtPhvps& paramSet) {};
408 #endif
409 #endif
410 
411 
412  virtual void destroyInteractionLists();
413 
414 protected:
415 
418  static void processInteraction(const DtInteractionMsg& msg, void* usr);
419  static void processPub(const DtPubInterMsg& msg, void* usr);
420  static void processUnpub(const DtUnpubInterMsg& msg, void* usr);
421  static void processSub(const DtSubInterMsg& msg, void* usr);
422  static void processUnsub(const DtUnsubInterMsg& msg, void* usr);
423 
424 protected:
425 
428 
431 
433  MAKRti::DtList myPendingStartIntersList;
434  MAKRti::DtList myPendingStopIntersList;
435 
438 
440  std::set<DtObjectClassHandle> myRetransmitSubClass;
441  std::set<DtObjectClassHandle> myRetransmitPassiveSubClass;
442 
444  std::set<DtObjectClassHandle> myRetransmitUnsubClass;
445  std::set<DtObjectClassHandle> myRetransmitUnsubClassForSmartForwarding;
446 
447 protected:
448 
450  static DtInteractionMgrCreator theCreator;
451 
453  static DtInteractionMgrCreator theInternalCreator;
454 };
455 
456 #endif
457 
458 
459 

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)