VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hlaObjectManager.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2025 MAK Technologies, Inc
3 ** All rights reserved.
4 *********************************************************************/
5 
6 
7 #ifndef DtHlaObjectManager_H_
8 #define DtHlaObjectManager_H_
9 
10 #if DtHLA
11 
12 #include "callbacks.h"
13 #include "vlutil/vlHashlist.h"
14 #include "hlaObjectFactory.h"
15 #include "region.h"
16 #include "objectId.h"
17 #include <map>
18 
19 typedef std::map<DtObjectId, DtHlaObject*> DtHlaObjectMap;
20 
24 
29 
31 {
32 public:
33 
36  DtExerciseConn* conn);
37 
39  virtual ~DtHlaObjectManager();
40 
42  virtual const DtHlaObjectMap& allHlaObjects() const;
43 
45  virtual const DtHlaObjectMap& registeredObjects() const;
46 
48  virtual const DtHlaObjectMap& discoveredObjects() const;
49 
51  virtual DtHlaObject* hlaObject(
52 #if DtHLA_1516
53  RTI::ObjectInstanceHandle id
54 #else
56 #endif
57  ) ;
58 
60  virtual DtHlaObject* hlaObject(const char* name) const;
61 
64  virtual void addDiscoverObjectCallback(
65  RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb, void* usr);
66  virtual void removeDiscoverObjectCallback(
67  RTI::ObjectClassHandle handle, DtDiscoverObjectCb cb, void* usr);
68 
72  virtual void addRemoveObjectCallback(
73 #if DtHLA_1516
74  RTI::ObjectInstanceHandle id,
75 #else
77 #endif
78  DtRemoveObjectCb cb, void* usr);
79  virtual void removeRemoveObjectCallback(
80 #if DtHLA_1516
81  RTI::ObjectInstanceHandle id,
82 #else
84 #endif
85  DtRemoveObjectCb cb, void* usr);
86 
90  virtual const DtHlaObject* processDiscoverObject(
91 #if DtHLA_1516
92  RTI::ObjectInstanceHandle id,
93  RTI::ObjectClassHandle handle,
94  const std::wstring &name);
95 #else
97  RTI::ObjectClassHandle handle,
98  const char* name);
99 #endif
100 
101 #if DtHLA_1516_EVOLVED
102  virtual const DtHlaObject* processDiscoverObject(
108  RTI::ObjectInstanceHandle id,
109  RTI::ObjectClassHandle handle,
110  const std::wstring &name,
111  RTI::FederateHandle registeringFederate );
112 #endif
113 
114 //#if DtHLA_4
115 // //! This form of processDiscoverObject takes the additional argument
116 // //! registeringFederate, indicating the Federate Handle of the federate
117 // //! that registered the object.
118 // //! This form of processDiscoverObject is called in HLA Evolved
119 // //! Returns the added instance.
120 // virtual const DtHlaObject* processDiscoverObject(
121 // RTI::ObjectInstanceHandle id,
122 // RTI::ObjectClassHandle handle,
123 // const std::wstring& name,
124 // RTI::FederateHandle registeringFederate);
125 //#endif
126 
131  virtual const DtHlaObject* processDiscoverObject(DtHlaObject* hlaObj);
132 
137  virtual const DtHlaObject* processDiscoverObjectAsClass(DtHlaObject* hlaObj,
138  RTI::ObjectClassHandle classHandle);
139 
142  virtual void processRemoveObject(
143 #if DtHLA_1516
144  RTI::ObjectInstanceHandle id
145 #else
147 #endif
148  );
149 
153  virtual void processRemoveObject(DtHlaObject* obj);
154 
156  virtual void processReflectAttributeValues(const DtStateMsg &msg);
157 
159  virtual void processProvideUpdate(
160 #if DtHLA_1516
161  RTI::ObjectInstanceHandle id,
162 #else
164 #endif
165  const RTI::AttributeHandleSet& theAttributes);
166 
171  virtual void processLocalUpdateRequest(
172  RTI::ObjectClassHandle hand,
173  const RTI::AttributeHandleSet& set);
174 
177  virtual void localSubscriptionChanged(RTI::ObjectClassHandle handle);
178 
181  virtual void publicationChanged(RTI::ObjectClassHandle handle);
182 
184  virtual void processAttributeAcquisition(
185 #if DtHLA_1516
186  RTI::ObjectInstanceHandle id,
187 #else
189 #endif
190  const RTI::AttributeHandleSet& attrs);
191 
193  virtual void processAttributeDivestiture(
194 #if DtHLA_1516
195  RTI::ObjectInstanceHandle id,
196 #else
198 #endif
199  const RTI::AttributeHandleSet& attrs);
200 
202  virtual void processRequestAssumption(
203 #if DtHLA_1516
204  RTI::ObjectInstanceHandle id,
205  const RTI::AttributeHandleSet& attrs,
206  const RTI::VariableLengthData &tag);
207 #else
209  const RTI::AttributeHandleSet& attrs,
210  const char* tag);
211 #endif
212 
214  virtual void processRequestRelease(
215 #if DtHLA_1516
216  RTI::ObjectInstanceHandle id,
217  const RTI::AttributeHandleSet& attrs,
218  const RTI::VariableLengthData &tag);
219 #else
221  const RTI::AttributeHandleSet& attrs,
222  const char* tag);
223 #endif
224 
226  virtual void processConfirmAcquisitionCancellation(
227 #if DtHLA_1516
228  RTI::ObjectInstanceHandle id,
229 #else
231 #endif
232  const RTI::AttributeHandleSet& attrs);
233 
236  virtual DtHlaObject* registerHlaObject( RTI::ObjectClassHandle classHand,
237  const char* name, const DtDDMRegionSet* regionSet = 0);
238 
239  virtual void registerHlaObjectWithRegion(
240  RTI::ObjectClassHandle classHand,
241  const char* name, const DtDDMRegionSet& regionSet,
242 #if DtHLA_1516
243  RTI::ObjectInstanceHandle& id);
244 #else
245  RTI::ObjectHandle& id);
246 #endif
247 
251  virtual void deleteHlaObject(
252 #if DtHLA_1516
253  RTI::ObjectInstanceHandle objHand);
254 #else
255  RTI::ObjectHandle objHand);
256 #endif
257 
270 #if !DtHLA_1516
271  virtual void setRegionsForRegister(int numAttrs,
273  RTI::AttributeHandle* attrs, RTI::Region** regions);
274  virtual void setNoRegionsForRegister();
275 #endif
276 
277 #if DtHLA_1516
278  virtual bool reserveName(const std::wstring &theName, bool pushRti);
285 
288  virtual bool isNameReserved(const std::wstring &theName)const;
289 
290  #if DtHLA_1516_EVOLVED
291  virtual void releaseObjectInstanceName( const std::wstring& name);
293 
299  virtual bool reserveNames(
300  std::set<std::wstring> const& objectNames, bool pushRti);
301 
302  #endif
303 #endif
304 
305 public:
306 #if DtHLA_1516
307  static double requestNameTickMinTime();
310  static void setRequestNameTickMinTime(double time);
311 
312  static double requestNameTickMaxTime();
313  static void setRequestNameTickMaxTime(double time);
314 
316  static int numberOfRequestNameTries();
317  static void setNumberOfRequestNameTries(int tries);
318 #endif
319 
321  virtual void removeAllObjects();
322 
323 protected:
324 
325 #if DtHLA_1516
326  static void nameReservationSuceededCb(const std::wstring &theName, void *theUserData);
329  static void nameReservationFailedCb(const std::wstring &theName, void *theUserData);
330 
331  #if DtHLA_1516_EVOLVED
332  static void nameSetReservationSucceededCb(const std::set<std::wstring>& nameSet,
333  void* userData );
334  static void nameSetReservationFailedCb(const std::set<std::wstring>& nameSet,
335  void* userData );
336  #endif
337 #endif
338 
339 protected:
340 
344 
347 
349  DtHlaObjectManager& operator=( const DtHlaObjectManager& orig);
350 
353  virtual void objectProcessRemoveObject(DtHlaObject* hlaObj);
354 
357  virtual void objectProcessReflect(DtHlaObject* hlaObj,
358  const DtStateMsg &msg);
359 
363  virtual DtHlaObject* addKnownObject(
364 #if DtHLA_1516
365  RTI::ObjectInstanceHandle id,
366  RTI::ObjectClassHandle hand,
367  const std::wstring &name,
368  bool reflecting);
369 #else
371  RTI::ObjectClassHandle hand,
372  const char* name,
373  bool reflecting);
374 #endif
375 
378  virtual void removeKnownObject(
379  DtHlaObject* hlaObj);
380 
383  virtual DtList* discoverCbList(RTI::ObjectClassHandle handle);
384 
385 
386 #if DtHLA_1516
387  virtual void reservedNameSuceeded(const std::wstring &theName);
390 
392  virtual void reservedNameFailed(const std::wstring &theName);
393 
394 #if DtHLA_1516_EVOLVED
395  virtual void reservedNameSuceeded(const std::set<std::wstring>& theNames);
398 
400  virtual void reservedNameFailed(const std::set<std::wstring>& theNames);
401 
405  virtual const std::map<DtObjectId, RTI::FederateHandle>& registeredFederateHandleMap() const;
406 #endif
407 
408 #endif
409 
410 protected:
411 #if DtHLA_1516
415 #endif
416 
417 protected:
418 
422 
424 
427 
430 
433 
437 
439 
440 #if DtHLA_1516
441  std::set<std::wstring> myReservedObjectInstanceNameSet;
443 
450  std::set<std::wstring> myPendingNameReservationNameSet;
451 
452 #if DtHLA_1516_EVOLVED
453  std::map<DtObjectId, RTI::FederateHandle> myRegisteringFederateMap;
454 #endif
455 #endif
456 
457 #if !DtHLA_1516
458  RTI::AttributeHandle* myAttrsForDDMRegister;
460  RTI::Region** myRegionsForDDMRegister;
461 #endif
463 };
464 
466 {
467  return myObjectList;
468 }
469 
471 {
472  return myRegObjectList;
473 }
474 
475 inline const std::map<DtObjectId, DtHlaObject*>& DtHlaObjectManager::discoveredObjects() const
476 {
477  return myDiscObjectList;
478 }
479 
480 #endif
481 #endif
482 
Contains the DtObjectId class declaration.
DtHlaObjectMap myObjectList
List of all known DtHlaObjects (by id).
Definition: hlaObjectManager.h:426
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnHLA.h:61
std::wstring myPendingNameReservationName
Definition: hlaObjectManager.h:449
virtual const DtHlaObjectMap & registeredObjects() const
Get the list of all HLA objects registered by the federate.
Definition: hlaObjectManager.h:470
DtHlaObjectMap myRegObjectList
List of all DtHlaObjects that we&#39;ve registered locally.
Definition: hlaObjectManager.h:432
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
std::set< std::wstring > myPendingNameReservationNameSet
Definition: hlaObjectManager.h:450
DtHashlist myDiscoverCbLists
DtHashlist that maps object class handles (DtIntHashKeys) to pointers to DtLists of callback function...
Definition: hlaObjectManager.h:421
void(* DtDiscoverObjectCb)(DtHlaObject *obj, void *usr)
Definition: discoverObjectCbInfo.h:20
int myReportedNameReservationCount
Definition: hlaObjectManager.h:448
static double theRequestNameTickMaxTime
Definition: hlaObjectManager.h:413
int myNumAttrsForDDMRegister
Definition: hlaObjectManager.h:462
DtHlaObjectMap myDiscObjectList
List of all DtHlaObjects that we&#39;ve discovered, possibly including local objects that we are also ref...
Definition: hlaObjectManager.h:436
static int theNumberOfRequestNameTries
Definition: hlaObjectManager.h:414
DtHashlist myObjectListByName
List of all known DtHlaObjects (by String).
Definition: hlaObjectManager.h:429
This file provides a declaration of the class DtHlaObjectFactory.
Defines DtHashlist and several helper functions.
Instances of DtHlaObject are used to represent HLA objects which are communicated across the network...
Definition: hlaObject.h:58
DtList is deprecated, please use std::list&lt;T&gt;.
Definition: vlList.h:71
ObjectInstanceHandle ObjectHandle
Definition: rtiCompatibility.h:275
bool myPendingNameReservationFailedFlag
Definition: hlaObjectManager.h:447
std::map< DtObjectId, DtHlaObject * > DtHlaObjectMap
Definition: hlaObjectManager.h:19
std::set< DtDDMRegionSP > DtDDMRegionSet
Definition: region1516.h:32
virtual const DtHlaObjectMap & allHlaObjects() const
Get the list of all HLA objects known to the federate.
Definition: hlaObjectManager.h:465
DtHashlist is deprecated and provided for backwards compatibility only.
Definition: vlHashlist.h:69
static double theRequestNameTickMinTime
Definition: hlaObjectManager.h:412
class DtHlaObjectManager:
Definition: hlaObjectManager.h:30
virtual const DtHlaObjectMap & discoveredObjects() const
Get the list of all HLA objects discovered by the federate.
Definition: hlaObjectManager.h:475
DtExerciseConn * myExConn
Definition: hlaObjectManager.h:438
class DtStateMsg:
Definition: stateMsgHLA.h:32
This file is used as a convenience to group RTI related callbacks together.
Instances of DtHlaObjectFactory are used to create HLA objects.
Definition: hlaObjectFactory.h:20
bool myPendingNameReservationPassedFlag
booleans set to true if the pending reserved name passes, or fails respectively.
Definition: hlaObjectManager.h:446
DtHlaObjectFactory * myFactory
Definition: hlaObjectManager.h:423
void(* DtRemoveObjectCb)(DtHlaObject *obj, void *usr)
Definition: removeObjectCbInfo.h:22

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)