![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2003 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: refExtEntList.h,v $ $Revision: 1.25 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef REFEXTENTLIST_H 00010 #define REFEXTENTLIST_H 00011 00012 #include <vl/reflEntList.h> 00013 00014 #include <vrfExtObjects/reflExtEnt.h> 00015 #include <vl/dataInter.h> 00016 #include <vlutil/vlHashlist.h> 00017 00018 // class DtReflectedExtEntityList: 00019 // 00020 // Instances of DtReflectedExtEntityList manage the list of 00021 // remote entities in the exercise. 00022 00023 #include <vrfExtObjects/vrfExtObjectsDefines.h> 00024 class DT_DLL_vrfExtObjects DtReflectedExtEntityList : public DtReflectedEntityList 00025 { 00026 00027 public: 00028 00029 // Constructor - obtains the set of object classes to subscribe 00030 // to from the exConn's fomMapper. 00031 DtReflectedExtEntityList(DtExerciseConn* exConn); 00032 00033 #if DtHLA 00034 00035 00036 DtReflectedExtEntityList(DtExerciseConn* exConn, 00037 const DtDDMRegionSet* regionSetToUse); 00038 00041 DtReflectedExtEntityList(DtExerciseConn* exConn, 00042 const DtList *handleList, const DtDDMRegionSet* regionSetToUse = 0); 00043 00044 #endif 00045 00046 // destructor 00047 virtual ~DtReflectedExtEntityList(); 00048 00049 #if DtHLA 00050 #if DtHLA_1516 00051 virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectInstanceHandle id); 00052 #else 00053 virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectHandle id); 00054 #endif 00055 00056 // Look up entity by name. 00057 virtual DtReflectedExtEntity* lookupEE ( 00058 const DtGlobalObjectDesignator& objName); 00059 #elif (DtDIS || DtTENA) 00060 // Look up entity by identifier. 00061 virtual DtReflectedExtEntity* lookup(const DtObjectId& id); 00062 #endif 00063 00064 // Get the first/last entity in the list. 00065 virtual DtReflectedExtEntity* firstEE() const; 00066 virtual DtReflectedExtEntity* lastEE() const; 00067 00068 // Entity added callback registration/deregistration. 00069 virtual void addEntityAdditionCallback ( 00070 DtExtEntityCallbackFunction cb, void* userData); 00071 00072 virtual void removeEntityAdditionCallback ( 00073 DtExtEntityCallbackFunction cb, void* userData); 00074 00075 // Entity removed callback registration/deregistration. 00076 virtual void addEntityRemovalCallback ( 00077 DtExtEntityCallbackFunction cb, void* userData); 00078 00079 virtual void removeEntityRemovalCallback ( 00080 DtExtEntityCallbackFunction cb, void* userData); 00081 00083 static void setTimeoutRequestTime(DtTime t); 00084 static DtTime timeoutRequestTime(); 00085 00086 protected: 00087 00088 void processVrfObjectStateUpdateMessage(DtDataInteraction* interaction); 00089 void processVrfObjectDataMessage(DtDataInteraction* interaction); 00090 00091 static void dataInteractionCallback(DtDataInteraction* i, void* usr); 00092 00093 virtual void processDataInteraction(DtDataInteraction* i); 00094 00095 #if DtHLA 00096 virtual DtReflectedObject* newReflectedObject(DtHlaObject* obj) const; 00097 virtual void addToObjectList(DtReflectedObject* refObj); 00098 #elif DtDIS 00099 // Create a new reflected entity 00100 virtual DtReflectedEntity* newReflectedEntity ( 00101 const DtEntityIdentifier& id, const DtEntityType& type) const; 00102 virtual void processRelativeLocationPdu( 00103 const DtRelativeLocationPdu& pdu); 00104 #elif DtTENA 00105 // Create a new reflected entity 00106 virtual DtReflectedEntity* newReflectedEntity ( 00107 const DtEntityIdentifier& id, const DtEntityType& type) const; 00108 #else 00109 # pragma message ( "No protocol defined." ) 00110 #endif 00111 00112 // Called from destructor, cleans up myObjectDataMessageHashlist and removed all memory 00113 virtual void cleanupObjectDataMessageHashList(); 00114 00115 // Overridden to check object data message hash list to see if there is a match 00116 virtual void objectAdded(DtReflectedObject* object); 00117 00118 #if !DtTENA 00119 // Overidden to see if: 00120 // a) This object is a VRF object 00121 // b) This object, if a VRF object, has a VRF object data message assigned (or waiting to be assigned) 00122 // If a) is true and b) is false, then, the object will not be added to the refleced list. Instead, a request 00123 // will be sent out for the vrf object data associated with the object. Once it is received, the object will 00124 // be added to the reflected list 00125 virtual bool readyToAdd(DtReflectedObject* obj); 00126 #endif 00127 00128 // Sets up extended state repository from cached vrf data (if exists). If this method returns true, the object 00129 // was either not an extended object or it had the data correctly set 00130 virtual bool setupVrfObjectData(DtReflectedObject* object); 00131 00132 #if !DtTENA 00133 // Will start the process of adding an object to the reflected list if this object is waiting for a VRF message. 00134 // Returns true if this object is and was added to the list 00135 virtual bool addObjectIfWaitingForVrfMessage(DtReflectedExtEntity*); 00136 #endif 00137 00138 // This routine will request the vrf object data message to be sent for a VRF entity. This request will be handled 00139 // by the entity publisher. 00140 virtual void requestVrfObjectData(DtReflectedObject* object); 00141 00144 virtual bool timeOutVrfObjectDataRequest(DtReflectedObject* obj); 00145 00146 #if !DtTENA 00147 00148 virtual void removeAndDelete(DtReflectedObject* obj, 00149 char* msg = NULL); 00150 #endif 00151 00152 protected: 00155 00156 #if DtDIS 00157 00158 virtual void processObjectAdditionCallbacks(DtReflectedObject* object); 00159 #endif 00160 00161 private: 00162 // not implemented 00163 DtReflectedExtEntityList ( const DtReflectedExtEntityList& orig); 00164 DtReflectedExtEntityList& operator= ( const DtReflectedExtEntityList& rhs); 00165 00166 protected: 00167 // List to keep the vrfobject data messages that have been found but not associated with new entities yet 00168 DtHashlist myObjectDataMessageHashlist; 00169 00170 // List to keep track of requests for vrf object message data and the time they were sent 00171 DtHashList myObjectDataMessageRequestList; 00172 00173 #if DtDIS 00174 // Reflected objects that are waiting for vrf object updates 00175 DtHashList myWaitingForVrfObjectData; 00176 #elif DtHLA 00177 DtObjectIdHashList myWaitingForVrfObjectData; 00178 #endif 00179 00180 static DtTime theTimeoutRequestTime; 00181 }; 00182 00183 #endif // REFEXTENTLIST_H 00184