MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
213  virtual int subscribed(DtInteractionClassInfo* classDesc);
214 
218  virtual int evaluateSubscription(DtRtiMsg const& msg);
219 
221  virtual void sendSubscribeMsg(DtInteractionClassHandle theInter, bool isPassive,
222  DtFederateHandle fedHandle);
223  virtual void sendSubscribeMsg(DtInteractionClassHandle theInter,
224  bool isPassive, DtBitMask* sendMask = 0);
225 
227  virtual void sendPublishMsg(DtInteractionClassHandle theInter);
228 
230  virtual void sendUnsubscribeMsg(DtInteractionClassHandle theInter,
231  bool forSmartForwarding=false);
232 
234  virtual void sendUnpublishMsg(DtInteractionClassHandle theInter);
235 
237  virtual void sendInteractionMsg(
238  DtInteractionClassHandle theClass,
239  const DtPhvps& theParams,
240  MAKRti::DtTransportType transportType,
241  MAKRti::DtOrderType orderType,
242 #ifdef DtIFSPEC1516
243  rti1516::LogicalTime const * theTime,
244  rti1516::VariableLengthData const & theTag,
245 #elif defined(DtIFSPEC1516E)
246  rti1516e::LogicalTime const * theTime,
247  rti1516e::VariableLengthData const & theTag,
248 #else
249  RTI::FedTime const * theTime,
250  const char* theTag,
251 #endif
252  unsigned long serialNumber, DtHandle channel, bool anonymous=false);
253 
256  virtual void addPendingStartInters(
257  DtInteractionClassHandle theClass);
258  virtual void addPendingStopInters(
259  DtInteractionClassHandle theClass);
260 
262  virtual void sendPendingStartInters();
263  virtual void sendPendingStopInters();
264 
267  virtual void sendPendingSubscription();
268  virtual void addPendingSubscription(DtObjectClassHandle theClass,
269  bool isPassive, DtFederateHandle fedHandle = 0);
270 
273  virtual void sendPendingUnsubscription();
274  virtual void addPendingUnsubscription(DtObjectClassHandle theClass,
275  bool forSmartForwarding);
276 
278  virtual void preTick();
279 
281  virtual void postTick();
282 
284  virtual void processResign(const DtResignMsg& msg);
285 
287  virtual DtInteractionClassInfo* firstSubscribedClass(
288  DtInteractionClassInfo* classDesc);
289 
292  void enableRelevanceAdvisorySwitch();
293  void disableRelevanceAdvisorySwitch();
294 
296  void setRelevanceAdvisorySwitch(bool enableSwitch);
297  bool relevanceAdvisorySwitch();
298 
300  virtual MAKRti::DtInetAddr localAddrMap(
301  DtInteractionClassHandle theClass, DtHandle theChannel);
302 
303 #ifdef DDM
304 
305 
306 
309  virtual void checkForRegionalSubscribe(DtInteractionClassInfo& info) {}
310 
313  virtual void checkForRegionalPublish(DtInteractionClassInfo& info) {}
314 
315 #endif
316 
318  virtual bool save(DtRtiSaveFile& file);
319 
321  virtual void prepareToRestore();
322 
324  virtual bool restore( DtRtiSaveFile& file );
325 
327  DtFederateMgr* federateMgr();
328  DtFederateMgr* federateMgr() const;
329 
331  DtConnectionMgr* connectMgr();
332  DtConnectionMgr* connectMgr() const;
333 
335  DtRIDParameters* params();
336  DtRIDParameters* params() const;
337 
339  DtFomClassMgr* fom();
340  DtFomClassMgr* fom() const;
341 
342 #ifdef DtMOM
343 
344  DtMomMgr* momMgr();
345  DtMomMgr* momMgr() const;
346 #endif
347 
348 #ifdef DtTIME
349 
350  virtual DtTimeMgr* timeMgr();
351  virtual DtTimeMgr* timeMgr() const;
352 #endif
353 
354 
355 public:
356 
360  static DtInteractionMgr* create(DtFederateMgr* fedMgrPtr);
361 
364  static void setCreatorFunction(DtInteractionMgrCreator fn);
365 
370  static void setInternalCreatorFunction(DtInteractionMgrCreator fn);
371 
372 
373 protected:
374 
375  //Increment MOM tally
376  void fastIncrementSentTally(DtInteractionClassHandle classHandle,
377  MAKRti::DtTransportType transport);
378  void fastIncrementReceivedTally(DtInteractionClassHandle classHandle,
379  MAKRti::DtTransportType transport);
380 
382  virtual void processInteraction(const DtInteractionMsg& msg);
383  virtual void processPub(const DtPubInterMsg& msg);
384  virtual void processUnpub(const DtUnpubInterMsg& msg);
385  virtual void processSub(const DtSubInterMsg& msg);
386  virtual void processUnsub(const DtUnsubInterMsg& msg);
387 
390  virtual void addClassMulticast(DtInteractionClassInfo* classDesc);
391  virtual void removeClassMulticast(DtInteractionClassInfo* classDesc);
392 
393 #ifdef DtMOM
394  //Increment MOM tally
395  virtual void incrementSentTally(DtInteractionClassHandle classHandle,
396  MAKRti::DtTransportType transport);
397  virtual void incrementReceivedTally(DtInteractionClassHandle classHandle,
398  MAKRti::DtTransportType transport);
399 #endif
400 
401 #ifdef DDM
402 #ifdef DtIFSPEC1516
403 
404  virtual void calculateRegionSet(
405  DtInteractionClassInfo const& sentClassInfo,
406  DtInteractionClassInfo const& receivedClassInfo,
407  unsigned long channel,
408  rti1516::RegionHandleSet & regionHandles) {}
409 #elif defined(DtIFSPEC1516E)
410 
411  virtual void calculateRegionSet(
412  DtInteractionClassInfo const& sentClassInfo,
413  DtInteractionClassInfo const& receivedClassInfo,
414  unsigned long channel,
415  rti1516e::RegionHandleSet & regionHandles) {}
416 #else
417  virtual void calculateRegionSet(
418  DtInteractionClassInfo const& sentClassInfo,
419  unsigned long channel, DtPhvps& paramSet) {};
420 #endif
421 #endif
422 
423 
424  virtual void destroyInteractionLists();
425 
426 protected:
427 
430  static void processInteraction(const DtInteractionMsg& msg, void* usr);
431  static void processPub(const DtPubInterMsg& msg, void* usr);
432  static void processUnpub(const DtUnpubInterMsg& msg, void* usr);
433  static void processSub(const DtSubInterMsg& msg, void* usr);
434  static void processUnsub(const DtUnsubInterMsg& msg, void* usr);
435 
436 protected:
437  typedef std::map< DtObjectClassHandle,DtBitMask*> DtObjectClassMaskMap;
438 
441 
444 
446  MAKRti::DtList myPendingStartIntersList;
447  MAKRti::DtList myPendingStopIntersList;
448 
449  std::set<DtRtiMsgKind> myConstrainedInteractionKinds;
450 
453 
455  std::set<DtObjectClassHandle> myRetransmitSubClass;
457  std::set<DtObjectClassHandle> myRetransmitPassiveSubClass;
458 
460  std::set<DtObjectClassHandle> myRetransmitUnsubClass;
461  std::set<DtObjectClassHandle> myRetransmitUnsubClassForSmartForwarding;
462 
463 protected:
464 
466  static DtInteractionMgrCreator theCreator;
467 
469  static DtInteractionMgrCreator theInternalCreator;
470 };
471 
472 #endif
473 
474 
475 

Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)