![]() |
MAK RTIspy API Documentation for HLA 1516
|
00001 /********************************************************************* 00002 ** Copyright (c) 1998 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: interMgr.h,v $ $Revision: 1.64 $ $State: Exp $ 00007 *********************************************************************/ 00008 00009 #ifndef interMgr_H_ 00010 #define interMgr_H_ 00011 00014 00015 #include <vlutil/vlList.h> 00016 #include <vlutil/vlHashlist.h> 00017 #include <vlutil/vlFedTarget.h> 00018 #include "fomMgr.h" 00019 #include "connectMgr.h" 00020 #include "RIDparams.h" 00021 #include "pHandValSet.h" 00022 #ifdef DtMOM 00023 #include "tallySet.h" 00024 #endif 00025 00026 class DtRtiSaveFile; 00027 class DtInteractionClassInfo; 00028 class DtInteractionMgr; 00029 class DtFomClassMgr; 00030 class DtMomMgr; 00031 class DtTimeMgr; 00032 class DtInteractionMsg; 00033 class DtPubInterMsg; 00034 class DtUnpubInterMsg; 00035 class DtSubInterMsg; 00036 class DtUnsubInterMsg; 00037 class DtResignMsg; 00038 class DtRegion; 00039 class DtPhvps; 00040 00045 class DT_DLL_LRC DtInteractionMgr 00046 { 00047 public: 00049 typedef DtInteractionMgr* (*DtInteractionMgrCreator)(DtFederateMgr* fedMgr); 00050 00051 protected: 00052 00054 DtInteractionMgr(DtFederateMgr* fedMgr); 00055 00056 public: 00057 00059 virtual ~DtInteractionMgr(); 00060 00061 private: 00062 00064 DtInteractionMgr(DtInteractionMgr const& other); 00065 00067 DtInteractionMgr& operator=(DtInteractionMgr const& other); 00068 00069 public: 00070 00072 virtual void postJoinInit(); 00073 00075 virtual bool isPostJoined() const; 00076 00078 virtual void publish( 00079 DtInteractionClassHandle theInteraction); 00080 00082 virtual void unpublish( 00083 DtInteractionClassHandle theInteraction); 00084 00086 virtual void subscribe( 00087 DtInteractionClassHandle theClass, 00088 bool active); 00089 00091 virtual void unsubscribe( 00092 DtInteractionClassHandle theClass); 00093 00095 virtual unsigned long send( 00096 DtInteractionClassHandle theInteraction, 00097 const DtPhvps& params, 00098 #ifdef DtIFSPEC1516 00099 rti1516::LogicalTime const * theTime, 00100 rti1516::VariableLengthData const & theTag, 00101 #elif defined(DtIFSPEC1516E) 00102 rti1516e::LogicalTime const * theTime, 00103 rti1516e::VariableLengthData const & theTag, 00104 #else 00105 RTI::FedTime const * theTime, 00106 const char* theTag, 00107 #endif 00108 DtHandle channel, 00109 bool anonymous=false); 00110 00112 MAKRti::DtTransportType getTransport( DtInteractionClassHandle theClass ); 00113 00115 virtual void setTransport( DtInteractionClassHandle theClass, 00116 MAKRti::DtTransportType theType); 00117 00118 #ifdef DtIFSPEC1516E 00119 00120 00121 virtual void requestInteractionTransportationTypeChange( DtInteractionClassHandle theClass, 00122 MAKRti::DtTransportType theType ); 00123 #endif 00124 00126 virtual void setOrder(DtInteractionClassHandle theClass, 00127 MAKRti::DtOrderType theType); 00128 00129 #ifdef DDM 00130 #ifdef DtIFSPEC1516 00131 00133 virtual void subscribeInteractionClassWithRegions ( 00134 DtInteractionClassHandle theClass, 00135 rti1516::RegionHandleSet const & theRegionHandleSet, 00136 bool active) {} 00137 00139 virtual void unsubscribeInteractionClassWithRegions ( 00140 DtInteractionClassHandle theClass, 00141 rti1516::RegionHandleSet const & theRegionHandleSet) {} 00142 00145 virtual unsigned long send( 00146 DtInteractionClassHandle theInteraction, 00147 const DtPhvps& params, 00148 rti1516::RegionHandleSet const & theRegionHandleSet, 00149 rti1516::LogicalTime const * theTime, 00150 rti1516::VariableLengthData const & theTag, 00151 bool anonymous=false) {return 0;} 00152 00153 #elif defined(DtIFSPEC1516E) 00154 00155 virtual void subscribeInteractionClassWithRegions ( 00156 DtInteractionClassHandle theClass, 00157 rti1516e::RegionHandleSet const & theRegionHandleSet, 00158 bool active) {} 00159 00161 virtual void unsubscribeInteractionClassWithRegions ( 00162 DtInteractionClassHandle theClass, 00163 rti1516e::RegionHandleSet const & theRegionHandleSet) {} 00164 00167 virtual unsigned long send( 00168 DtInteractionClassHandle theInteraction, 00169 const DtPhvps& params, 00170 rti1516e::RegionHandleSet const & theRegionHandleSet, 00171 rti1516e::LogicalTime const * theTime, 00172 rti1516e::VariableLengthData const & theTag, 00173 bool anonymous=false) {return 0;} 00174 #else 00175 00177 virtual void subscribeInteractionClassWithRegion( 00178 DtInteractionClassHandle theClass, 00179 DtRegion &theRegion, 00180 bool active) {} 00181 00183 virtual void unsubscribeInteractionClassWithRegion ( 00184 DtInteractionClassHandle theClass, 00185 DtRegion &theRegion) {} 00186 00189 virtual unsigned long send( 00190 DtInteractionClassHandle theInteraction, 00191 const DtPhvps& params, 00192 RTI::FedTime const * theTime, 00193 const char* theTag, 00194 DtRegion& theRegion, 00195 bool anonymous=false) {return 0;} 00196 00197 #endif //! DtIFSPEC1516 00198 #endif //! DDM 00199 00201 virtual int acceptInteraction(const DtInteractionMsg& msg); 00202 00205 virtual int subscribed(DtInteractionClassHandle handle); 00206 00209 virtual int published(DtInteractionClassHandle handle); 00210 00212 virtual void sendSubscribeMsg(DtInteractionClassHandle theInter, bool isPassive); 00213 00215 virtual void sendPublishMsg(DtInteractionClassHandle theInter); 00216 00218 virtual void sendUnsubscribeMsg(DtInteractionClassHandle theInter, 00219 bool forSmartForwarding=false); 00220 00222 virtual void sendUnpublishMsg(DtInteractionClassHandle theInter); 00223 00225 virtual void sendInteractionMsg( 00226 DtInteractionClassHandle theClass, 00227 const DtPhvps& theParams, 00228 MAKRti::DtTransportType transportType, 00229 MAKRti::DtOrderType orderType, 00230 #ifdef DtIFSPEC1516 00231 rti1516::LogicalTime const * theTime, 00232 rti1516::VariableLengthData const & theTag, 00233 #elif defined(DtIFSPEC1516E) 00234 rti1516e::LogicalTime const * theTime, 00235 rti1516e::VariableLengthData const & theTag, 00236 #else 00237 RTI::FedTime const * theTime, 00238 const char* theTag, 00239 #endif 00240 unsigned long serialNumber, DtHandle channel, bool anonymous=false); 00241 00244 virtual void addPendingStartInters( 00245 DtInteractionClassHandle theClass); 00246 virtual void addPendingStopInters( 00247 DtInteractionClassHandle theClass); 00248 00250 virtual void sendPendingStartInters(); 00251 virtual void sendPendingStopInters(); 00252 00255 virtual void sendPendingSubscription(); 00256 virtual void addPendingSubscription(DtObjectClassHandle theClass, 00257 bool isPassive); 00258 00261 virtual void sendPendingUnsubscription(); 00262 virtual void addPendingUnsubscription(DtObjectClassHandle theClass, 00263 bool forSmartForwarding); 00264 00266 virtual void preTick(); 00267 00269 virtual void postTick(); 00270 00272 virtual void processResign(const DtResignMsg& msg); 00273 00275 virtual DtInteractionClassInfo* firstSubscribedClass( 00276 DtInteractionClassInfo* classDesc); 00277 00280 void enableRelevanceAdvisorySwitch(); 00281 void disableRelevanceAdvisorySwitch(); 00282 00284 void setRelevanceAdvisorySwitch(bool enableSwitch); 00285 bool relevanceAdvisorySwitch(); 00286 00288 virtual MAKRti::DtInetAddr localAddrMap( 00289 DtInteractionClassHandle theClass, DtHandle theChannel); 00290 00291 #ifdef DDM 00292 00293 00294 00297 virtual void checkForRegionalSubscribe(DtInteractionClassInfo& info) {} 00298 00301 virtual void checkForRegionalPublish(DtInteractionClassInfo& info) {} 00302 00303 #endif 00304 00306 virtual bool save(DtRtiSaveFile& file); 00307 00309 virtual void prepareToRestore(); 00310 00312 virtual bool restore( DtRtiSaveFile& file ); 00313 00315 DtFederateMgr* federateMgr(); 00316 DtFederateMgr* federateMgr() const; 00317 00319 DtConnectionMgr* connectMgr(); 00320 DtConnectionMgr* connectMgr() const; 00321 00323 DtRIDParameters* params(); 00324 DtRIDParameters* params() const; 00325 00327 DtFomClassMgr* fom(); 00328 DtFomClassMgr* fom() const; 00329 00330 #ifdef DtMOM 00331 00332 DtMomMgr* momMgr(); 00333 DtMomMgr* momMgr() const; 00334 #endif 00335 00336 #ifdef DtTIME 00337 00338 virtual DtTimeMgr* timeMgr(); 00339 virtual DtTimeMgr* timeMgr() const; 00340 #endif 00341 00342 00343 public: 00344 00348 static DtInteractionMgr* create(DtFederateMgr* fedMgrPtr); 00349 00352 static void setCreatorFunction(DtInteractionMgrCreator fn); 00353 00358 static void setInternalCreatorFunction(DtInteractionMgrCreator fn); 00359 00360 00361 protected: 00362 00363 //Increment MOM tally 00364 void fastIncrementSentTally(DtInteractionClassHandle classHandle, 00365 MAKRti::DtTransportType transport); 00366 void fastIncrementReceivedTally(DtInteractionClassHandle classHandle, 00367 MAKRti::DtTransportType transport); 00368 00370 virtual void processInteraction(const DtInteractionMsg& msg); 00371 virtual void processPub(const DtPubInterMsg& msg); 00372 virtual void processUnpub(const DtUnpubInterMsg& msg); 00373 virtual void processSub(const DtSubInterMsg& msg); 00374 virtual void processUnsub(const DtUnsubInterMsg& msg); 00375 00378 virtual void addClassMulticast(DtInteractionClassInfo* classDesc); 00379 virtual void removeClassMulticast(DtInteractionClassInfo* classDesc); 00380 00381 #ifdef DtMOM 00382 //Increment MOM tally 00383 virtual void incrementSentTally(DtInteractionClassHandle classHandle, 00384 MAKRti::DtTransportType transport); 00385 virtual void incrementReceivedTally(DtInteractionClassHandle classHandle, 00386 MAKRti::DtTransportType transport); 00387 #endif 00388 00389 #ifdef DDM 00390 #ifdef DtIFSPEC1516 00391 00392 virtual void calculateRegionSet( 00393 DtInteractionClassInfo const& sentClassInfo, 00394 DtInteractionClassInfo const& receivedClassInfo, 00395 unsigned long channel, 00396 rti1516::RegionHandleSet & regionHandles) {} 00397 #elif defined(DtIFSPEC1516E) 00398 00399 virtual void calculateRegionSet( 00400 DtInteractionClassInfo const& sentClassInfo, 00401 DtInteractionClassInfo const& receivedClassInfo, 00402 unsigned long channel, 00403 rti1516e::RegionHandleSet & regionHandles) {} 00404 #else 00405 virtual void calculateRegionSet( 00406 DtInteractionClassInfo const& sentClassInfo, 00407 unsigned long channel, DtPhvps& paramSet) {}; 00408 #endif 00409 #endif //! DDM 00410 00412 virtual void destroyInteractionLists(); 00413 00414 protected: 00415 00418 static void processInteraction(const DtInteractionMsg& msg, void* usr); 00419 static void processPub(const DtPubInterMsg& msg, void* usr); 00420 static void processUnpub(const DtUnpubInterMsg& msg, void* usr); 00421 static void processSub(const DtSubInterMsg& msg, void* usr); 00422 static void processUnsub(const DtUnsubInterMsg& msg, void* usr); 00423 00424 protected: 00425 00427 DtFederateMgr* myFederateMgr; 00428 00430 bool myIsJoined; 00431 00433 MAKRti::DtList myPendingStartIntersList; 00434 MAKRti::DtList myPendingStopIntersList; 00435 00437 bool myRelevanceSwitch; 00438 00440 std::set<DtObjectClassHandle> myRetransmitSubClass; 00441 std::set<DtObjectClassHandle> myRetransmitPassiveSubClass; 00442 00444 std::set<DtObjectClassHandle> myRetransmitUnsubClass; 00445 std::set<DtObjectClassHandle> myRetransmitUnsubClassForSmartForwarding; 00446 00447 protected: 00448 00450 static DtInteractionMgrCreator theCreator; 00451 00453 static DtInteractionMgrCreator theInternalCreator; 00454 }; 00455 00456 #endif 00457 00458 00459