7 #ifndef DtHlaObjectManager_H_
8 #define DtHlaObjectManager_H_
19 typedef std::map<DtObjectId, DtHlaObject*> DtHlaObjectMap;
35 DtHlaObjectManager(DtHlaObjectFactory* factory,
39 virtual ~DtHlaObjectManager();
42 virtual const DtHlaObjectMap& allHlaObjects()
const;
45 virtual const DtHlaObjectMap& registeredObjects()
const;
48 virtual const DtHlaObjectMap& discoveredObjects()
const;
51 virtual DtHlaObject* hlaObject(
53 RTI::ObjectInstanceHandle
id
60 virtual DtHlaObject* hlaObject(
const char* name)
const;
64 virtual void addDiscoverObjectCallback(
65 RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb,
void* usr);
66 virtual void removeDiscoverObjectCallback(
67 RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb,
void* usr);
72 virtual void addRemoveObjectCallback(
74 RTI::ObjectInstanceHandle
id,
78 DtRemoveObjectCb cb,
void* usr);
79 virtual void removeRemoveObjectCallback(
81 RTI::ObjectInstanceHandle
id,
85 DtRemoveObjectCb cb,
void* usr);
90 virtual const DtHlaObject* processDiscoverObject(
92 RTI::ObjectInstanceHandle
id,
93 RTI::ObjectClassHandle handle,
94 const std::wstring &name);
97 RTI::ObjectClassHandle handle,
101 #if DtHLA_1516_EVOLVED
107 virtual const DtHlaObject* processDiscoverObject(
108 RTI::ObjectInstanceHandle
id,
109 RTI::ObjectClassHandle handle,
110 const std::wstring &name,
111 RTI::FederateHandle registeringFederate );
118 virtual const DtHlaObject* processDiscoverObject(DtHlaObject* hlaObj);
124 virtual const DtHlaObject* processDiscoverObjectAsClass(DtHlaObject* hlaObj,
125 RTI::ObjectClassHandle classHandle);
129 virtual void processRemoveObject(
131 RTI::ObjectInstanceHandle
id
140 virtual void processRemoveObject(DtHlaObject* obj);
143 virtual void processReflectAttributeValues(
const DtStateMsg &msg);
146 virtual void processProvideUpdate(
148 RTI::ObjectInstanceHandle
id,
150 RTI::ObjectHandle
id,
152 const RTI::AttributeHandleSet& theAttributes);
158 virtual void processLocalUpdateRequest(
159 RTI::ObjectClassHandle hand,
160 const RTI::AttributeHandleSet&
set);
164 virtual void localSubscriptionChanged(RTI::ObjectClassHandle handle);
168 virtual void publicationChanged(RTI::ObjectClassHandle handle);
171 virtual void processAttributeAcquisition(
173 RTI::ObjectInstanceHandle
id,
175 RTI::ObjectHandle
id,
177 const RTI::AttributeHandleSet& attrs);
180 virtual void processAttributeDivestiture(
182 RTI::ObjectInstanceHandle
id,
184 RTI::ObjectHandle
id,
186 const RTI::AttributeHandleSet& attrs);
189 virtual void processRequestAssumption(
191 RTI::ObjectInstanceHandle
id,
192 const RTI::AttributeHandleSet& attrs,
193 const RTI::VariableLengthData &tag);
195 RTI::ObjectHandle id,
196 const RTI::AttributeHandleSet& attrs,
201 virtual void processRequestRelease(
203 RTI::ObjectInstanceHandle
id,
204 const RTI::AttributeHandleSet& attrs,
205 const RTI::VariableLengthData &tag);
207 RTI::ObjectHandle id,
208 const RTI::AttributeHandleSet& attrs,
213 virtual void processConfirmAcquisitionCancellation(
215 RTI::ObjectInstanceHandle
id,
217 RTI::ObjectHandle
id,
219 const RTI::AttributeHandleSet& attrs);
223 virtual DtHlaObject* registerHlaObject( RTI::ObjectClassHandle classHand,
224 const char* name,
const DtDDMRegionSet* regionSet = 0);
226 virtual void registerHlaObjectWithRegion(
227 RTI::ObjectClassHandle classHand,
228 const char* name,
const DtDDMRegionSet& regionSet,
230 RTI::ObjectInstanceHandle&
id);
232 RTI::ObjectHandle& id);
238 virtual void deleteHlaObject(
240 RTI::ObjectInstanceHandle objHand);
242 RTI::ObjectHandle objHand);
259 virtual void setRegionsForRegister(
int numAttrs,
260 RTI::AttributeHandle* attrs, RTI::Region** regions);
261 virtual void setNoRegionsForRegister();
271 virtual bool reserveName(
const std::wstring &theName,
bool pushRti);
275 virtual bool isNameReserved(
const std::wstring &theName)
const;
277 #if DtHLA_1516_EVOLVED
279 virtual void releaseObjectInstanceName(
const std::wstring& name);
286 virtual bool reserveNames (
287 std::set<std::wstring>
const& objectNames,
bool pushRti);
296 static double requestNameTickMinTime();
297 static void setRequestNameTickMinTime(
double time);
299 static double requestNameTickMaxTime();
300 static void setRequestNameTickMaxTime(
double time);
303 static int numberOfRequestNameTries();
304 static void setNumberOfRequestNameTries(
int tries);
308 virtual void removeAllObjects();
315 static void nameReservationSuceededCb(
const std::wstring &theName,
void *theUserData);
316 static void nameReservationFailedCb(
const std::wstring &theName,
void *theUserData);
318 #if DtHLA_1516_EVOLVED
319 static void nameSetReservationSucceededCb(
const std::set<std::wstring>& nameSet,
321 static void nameSetReservationFailedCb(
const std::set<std::wstring>& nameSet,
333 DtHlaObjectManager(
const DtHlaObjectManager& orig);
336 DtHlaObjectManager& operator=(
const DtHlaObjectManager& orig);
340 virtual void objectProcessRemoveObject(DtHlaObject* hlaObj);
344 virtual void objectProcessReflect(DtHlaObject* hlaObj,
350 virtual DtHlaObject* addKnownObject(
352 RTI::ObjectInstanceHandle
id,
353 RTI::ObjectClassHandle hand,
354 const std::wstring &name,
357 RTI::ObjectHandle id,
358 RTI::ObjectClassHandle hand,
365 virtual void removeKnownObject(
366 DtHlaObject* hlaObj);
370 virtual DtList* discoverCbList(RTI::ObjectClassHandle handle);
376 virtual void reservedNameSuceeded(
const std::wstring &theName);
379 virtual void reservedNameFailed(
const std::wstring &theName);
381 #if DtHLA_1516_EVOLVED
384 virtual void reservedNameSuceeded(
const std::set<std::wstring>& theNames);
387 virtual void reservedNameFailed(
const std::set<std::wstring>& theNames);
394 static double theRequestNameTickMinTime;
395 static double theRequestNameTickMaxTime;
396 static int theNumberOfRequestNameTries;
405 DtHlaObjectFactory* myFactory;
408 DtHlaObjectMap myObjectList;
414 DtHlaObjectMap myRegObjectList;
418 DtHlaObjectMap myDiscObjectList;
424 std::set<std::wstring> myReservedObjectInstanceNameSet;
428 bool myPendingNameReservationPassedFlag;
429 bool myPendingNameReservationFailedFlag;
430 int myReportedNameReservationCount;
431 std::wstring myPendingNameReservationName;
432 std::set<std::wstring> myPendingNameReservationNameSet;
434 #if DtHLA_1516_EVOLVED
435 std::map<DtObjectId, RTI::FederateHandle> myRegisteringFederateMap;
441 RTI::AttributeHandle* myAttrsForDDMRegister;
442 RTI::Region** myRegionsForDDMRegister;
444 int myNumAttrsForDDMRegister;
447 inline const DtHlaObjectMap& DtHlaObjectManager::allHlaObjects()
const
452 inline const DtHlaObjectMap& DtHlaObjectManager::registeredObjects()
const
454 return myRegObjectList;
457 inline const std::map<DtObjectId, DtHlaObject*>& DtHlaObjectManager::discoveredObjects()
const
459 return myDiscObjectList;