![]() |
VR-Vantage 1.4.1 API Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2006 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: vrfEntityPub.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef VRFENTITYPUB_H 00010 #define VRFENTITYPUB_H 00011 00012 #include <vl/entityPub.h> 00013 #include <vrfExtObjects/vrfExtObjectsDefines.h> 00014 #include <vrfExtObjects/vrfObjIdGen.h> 00015 #include <vl/dataInter.h> 00016 00017 #ifdef DtDIS 00018 typedef DtEntityStateEncoder DtEntPublisherEncoder; 00019 typedef DtEntityStateDecoder DtEntPublisherDecoder; 00020 #elif DtHLA 00021 typedef DtHlaStateEncoder DtEntPublisherEncoder; 00022 typedef DtHlaStateDecoder DtEntPublisherDecoder; 00023 #endif 00024 00025 class DtExtEntityStateRepository; 00026 class DtEntityType; 00027 class DtBaseEntityStateRepository; 00028 class DtSimulationAddress; 00029 class DtSimInterfaceContent; 00030 00041 class DT_DLL_vrfExtObjects DtVrfEntityPublisher 00042 { 00043 00044 public: 00051 DtVrfEntityPublisher( 00052 const DtEntityType& type, 00053 DtExerciseConn* conn, 00054 const DtGlobalObjectDesignator& id = DtVrfObjectIdGenerator::nullId() 00055 ); 00056 00058 virtual ~DtVrfEntityPublisher(); 00059 00060 public: 00069 virtual void tick(); 00070 00073 virtual DtExtEntityStateRepository* entityProcessStateRep(); 00074 virtual DtExtEntityStateRepository* entityStateRep(); 00075 00077 virtual DtExtEntityStateRepository* ensr(); 00078 00079 #ifdef DtHLA 00080 00081 00082 00083 virtual DtEntPublisherDecoder* decoder(); 00084 00087 virtual DtEntPublisherEncoder* encoder(); 00088 #endif 00089 00090 #ifdef DtDIS 00091 00092 virtual void setSendDiGuyPdus(bool yesNo); 00093 00095 virtual bool sendDiGuyPdus() const; 00096 #endif 00097 00099 virtual const DtObjectId& id() const; 00100 00102 virtual const DtObjectId& localId() const; 00103 00105 virtual const DtGlobalObjectDesignator& globalId() const; 00106 00109 virtual void forceUpdate(); 00110 00112 virtual bool sendVrfObjectData(); 00113 00115 virtual DtEntityPublisher* entityPublisher(); 00116 00117 public: 00118 // Sets the time to update the vrf data message. The message will 00119 // be sent on this time (default is five seconds) or if the data 00120 // as seen by remote is different that the current time. If time 00121 // is set to be -1, it will only be sent if the data is different 00122 static void setVrfDataTimeThreshold(DtTime time); 00123 static DtTime vrfDataTimeThreshold(); 00124 00125 private: 00127 DtVrfEntityPublisher(const DtVrfEntityPublisher&); 00128 DtVrfEntityPublisher& operator=(const DtVrfEntityPublisher&); 00129 00130 protected: 00132 virtual bool sendVrfDataUpdate(); 00133 00137 virtual bool needsVrfObjectDataUpdate(); 00138 00143 virtual bool sendMessage(const DtSimulationAddress& receiver, 00144 DtSimInterfaceContent* message); 00146 virtual bool setContentForNet(DtDataInteraction* dataInter, 00147 DtSimInterfaceContent* content) const; 00149 virtual void sendMessageInteraction(const DtSimulationAddress& receiver, 00150 DtDataInteraction& data); 00151 00152 protected: 00155 static void dataInteractionCallback(DtDataInteraction* i, void* usr); 00156 00159 virtual void processSendVrfObjectDataMessage(DtDataInteraction* interaction); 00160 00161 public: 00163 virtual void processDataInteraction(DtDataInteraction* i); 00164 00165 protected: 00166 DtEntityPublisher* myPublisher; 00167 00168 // For heartbeating for DtIfVrfObjectData messages 00169 DtTime myTimeLastVrfDataSend; 00170 static DtTime theVrfDataTimeThreshold; 00171 }; 00172 00173 #endif