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  DtFederateHandle fedHandle);
214  virtual void sendSubscribeMsg(DtInteractionClassHandle theInter,
215  bool isPassive, DtBitMask* sendMask = 0);
216 
218  virtual void sendPublishMsg(DtInteractionClassHandle theInter);
219 
221  virtual void sendUnsubscribeMsg(DtInteractionClassHandle theInter,
222  bool forSmartForwarding=false);
223 
225  virtual void sendUnpublishMsg(DtInteractionClassHandle theInter);
226 
228  virtual void sendInteractionMsg(
229  DtInteractionClassHandle theClass,
230  const DtPhvps& theParams,
231  MAKRti::DtTransportType transportType,
232  MAKRti::DtOrderType orderType,
233 #ifdef DtIFSPEC1516
234  rti1516::LogicalTime const * theTime,
235  rti1516::VariableLengthData const & theTag,
236 #elif defined(DtIFSPEC1516E)
237  rti1516e::LogicalTime const * theTime,
238  rti1516e::VariableLengthData const & theTag,
239 #else
240  RTI::FedTime const * theTime,
241  const char* theTag,
242 #endif
243  unsigned long serialNumber, DtHandle channel, bool anonymous=false);
244 
247  virtual void addPendingStartInters(
248  DtInteractionClassHandle theClass);
249  virtual void addPendingStopInters(
250  DtInteractionClassHandle theClass);
251 
253  virtual void sendPendingStartInters();
254  virtual void sendPendingStopInters();
255 
258  virtual void sendPendingSubscription();
259  virtual void addPendingSubscription(DtObjectClassHandle theClass,
260  bool isPassive, DtFederateHandle fedHandle = 0);
261 
264  virtual void sendPendingUnsubscription();
265  virtual void addPendingUnsubscription(DtObjectClassHandle theClass,
266  bool forSmartForwarding);
267 
269  virtual void preTick();
270 
272  virtual void postTick();
273 
275  virtual void processResign(const DtResignMsg& msg);
276 
278  virtual DtInteractionClassInfo* firstSubscribedClass(
279  DtInteractionClassInfo* classDesc);
280 
283  void enableRelevanceAdvisorySwitch();
284  void disableRelevanceAdvisorySwitch();
285 
287  void setRelevanceAdvisorySwitch(bool enableSwitch);
288  bool relevanceAdvisorySwitch();
289 
291  virtual MAKRti::DtInetAddr localAddrMap(
292  DtInteractionClassHandle theClass, DtHandle theChannel);
293 
294 #ifdef DDM
295 
296 
297 
300  virtual void checkForRegionalSubscribe(DtInteractionClassInfo& info) {}
301 
304  virtual void checkForRegionalPublish(DtInteractionClassInfo& info) {}
305 
306 #endif
307 
309  virtual bool save(DtRtiSaveFile& file);
310 
312  virtual void prepareToRestore();
313 
315  virtual bool restore( DtRtiSaveFile& file );
316 
318  DtFederateMgr* federateMgr();
319  DtFederateMgr* federateMgr() const;
320 
322  DtConnectionMgr* connectMgr();
323  DtConnectionMgr* connectMgr() const;
324 
326  DtRIDParameters* params();
327  DtRIDParameters* params() const;
328 
330  DtFomClassMgr* fom();
331  DtFomClassMgr* fom() const;
332 
333 #ifdef DtMOM
334 
335  DtMomMgr* momMgr();
336  DtMomMgr* momMgr() const;
337 #endif
338 
339 #ifdef DtTIME
340 
341  virtual DtTimeMgr* timeMgr();
342  virtual DtTimeMgr* timeMgr() const;
343 #endif
344 
345 
346 public:
347 
351  static DtInteractionMgr* create(DtFederateMgr* fedMgrPtr);
352 
355  static void setCreatorFunction(DtInteractionMgrCreator fn);
356 
361  static void setInternalCreatorFunction(DtInteractionMgrCreator fn);
362 
363 
364 protected:
365 
366  //Increment MOM tally
367  void fastIncrementSentTally(DtInteractionClassHandle classHandle,
368  MAKRti::DtTransportType transport);
369  void fastIncrementReceivedTally(DtInteractionClassHandle classHandle,
370  MAKRti::DtTransportType transport);
371 
373  virtual void processInteraction(const DtInteractionMsg& msg);
374  virtual void processPub(const DtPubInterMsg& msg);
375  virtual void processUnpub(const DtUnpubInterMsg& msg);
376  virtual void processSub(const DtSubInterMsg& msg);
377  virtual void processUnsub(const DtUnsubInterMsg& msg);
378 
381  virtual void addClassMulticast(DtInteractionClassInfo* classDesc);
382  virtual void removeClassMulticast(DtInteractionClassInfo* classDesc);
383 
384 #ifdef DtMOM
385  //Increment MOM tally
386  virtual void incrementSentTally(DtInteractionClassHandle classHandle,
387  MAKRti::DtTransportType transport);
388  virtual void incrementReceivedTally(DtInteractionClassHandle classHandle,
389  MAKRti::DtTransportType transport);
390 #endif
391 
392 #ifdef DDM
393 #ifdef DtIFSPEC1516
394 
395  virtual void calculateRegionSet(
396  DtInteractionClassInfo const& sentClassInfo,
397  DtInteractionClassInfo const& receivedClassInfo,
398  unsigned long channel,
399  rti1516::RegionHandleSet & regionHandles) {}
400 #elif defined(DtIFSPEC1516E)
401 
402  virtual void calculateRegionSet(
403  DtInteractionClassInfo const& sentClassInfo,
404  DtInteractionClassInfo const& receivedClassInfo,
405  unsigned long channel,
406  rti1516e::RegionHandleSet & regionHandles) {}
407 #else
408  virtual void calculateRegionSet(
409  DtInteractionClassInfo const& sentClassInfo,
410  unsigned long channel, DtPhvps& paramSet) {};
411 #endif
412 #endif
413 
414 
415  virtual void destroyInteractionLists();
416 
417 protected:
418 
421  static void processInteraction(const DtInteractionMsg& msg, void* usr);
422  static void processPub(const DtPubInterMsg& msg, void* usr);
423  static void processUnpub(const DtUnpubInterMsg& msg, void* usr);
424  static void processSub(const DtSubInterMsg& msg, void* usr);
425  static void processUnsub(const DtUnsubInterMsg& msg, void* usr);
426 
427 protected:
428  typedef std::map< DtObjectClassHandle,DtBitMask*> DtObjectClassMaskMap;
429 
432 
435 
437  MAKRti::DtList myPendingStartIntersList;
438  MAKRti::DtList myPendingStopIntersList;
439 
442 
444  std::set<DtObjectClassHandle> myRetransmitSubClass;
446  std::set<DtObjectClassHandle> myRetransmitPassiveSubClass;
447 
449  std::set<DtObjectClassHandle> myRetransmitUnsubClass;
450  std::set<DtObjectClassHandle> myRetransmitUnsubClassForSmartForwarding;
451 
452 protected:
453 
455  static DtInteractionMgrCreator theCreator;
456 
458  static DtInteractionMgrCreator theInternalCreator;
459 };
460 
461 #endif
462 
463 
464 

Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (www.mak.com)