VR-Link API Documentation for HLA 1.3
 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-2010 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
55  RTI::ObjectHandle id
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
76  RTI::ObjectHandle id,
77 #endif
78  DtRemoveObjectCb cb, void* usr);
79  virtual void removeRemoveObjectCallback(
80 #if DtHLA_1516
81  RTI::ObjectInstanceHandle id,
82 #else
83  RTI::ObjectHandle id,
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
96  RTI::ObjectHandle id,
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 
118  virtual const DtHlaObject* processDiscoverObject(DtHlaObject* hlaObj);
119 
124  virtual const DtHlaObject* processDiscoverObjectAsClass(DtHlaObject* hlaObj,
125  RTI::ObjectClassHandle classHandle);
126 
129  virtual void processRemoveObject(
130 #if DtHLA_1516
131  RTI::ObjectInstanceHandle id
132 #else
133  RTI::ObjectHandle id
134 #endif
135  );
136 
140  virtual void processRemoveObject(DtHlaObject* obj);
141 
143  virtual void processReflectAttributeValues(const DtStateMsg &msg);
144 
146  virtual void processProvideUpdate(
147 #if DtHLA_1516
148  RTI::ObjectInstanceHandle id,
149 #else
150  RTI::ObjectHandle id,
151 #endif
152  const RTI::AttributeHandleSet& theAttributes);
153 
158  virtual void processLocalUpdateRequest(
159  RTI::ObjectClassHandle hand,
160  const RTI::AttributeHandleSet& set);
161 
164  virtual void localSubscriptionChanged(RTI::ObjectClassHandle handle);
165 
168  virtual void publicationChanged(RTI::ObjectClassHandle handle);
169 
171  virtual void processAttributeAcquisition(
172 #if DtHLA_1516
173  RTI::ObjectInstanceHandle id,
174 #else
175  RTI::ObjectHandle id,
176 #endif
177  const RTI::AttributeHandleSet& attrs);
178 
180  virtual void processAttributeDivestiture(
181 #if DtHLA_1516
182  RTI::ObjectInstanceHandle id,
183 #else
184  RTI::ObjectHandle id,
185 #endif
186  const RTI::AttributeHandleSet& attrs);
187 
189  virtual void processRequestAssumption(
190 #if DtHLA_1516
191  RTI::ObjectInstanceHandle id,
192  const RTI::AttributeHandleSet& attrs,
193  const RTI::VariableLengthData &tag);
194 #else
195  RTI::ObjectHandle id,
196  const RTI::AttributeHandleSet& attrs,
197  const char* tag);
198 #endif
199 
201  virtual void processRequestRelease(
202 #if DtHLA_1516
203  RTI::ObjectInstanceHandle id,
204  const RTI::AttributeHandleSet& attrs,
205  const RTI::VariableLengthData &tag);
206 #else
207  RTI::ObjectHandle id,
208  const RTI::AttributeHandleSet& attrs,
209  const char* tag);
210 #endif
211 
213  virtual void processConfirmAcquisitionCancellation(
214 #if DtHLA_1516
215  RTI::ObjectInstanceHandle id,
216 #else
217  RTI::ObjectHandle id,
218 #endif
219  const RTI::AttributeHandleSet& attrs);
220 
223  virtual DtHlaObject* registerHlaObject( RTI::ObjectClassHandle classHand,
224  const char* name, const DtDDMRegionSet* regionSet = 0);
225 
226  virtual void registerHlaObjectWithRegion(
227  RTI::ObjectClassHandle classHand,
228  const char* name, const DtDDMRegionSet& regionSet,
229 #if DtHLA_1516
230  RTI::ObjectInstanceHandle& id);
231 #else
232  RTI::ObjectHandle& id);
233 #endif
234 
238  virtual void deleteHlaObject(
239 #if DtHLA_1516
240  RTI::ObjectInstanceHandle objHand);
241 #else
242  RTI::ObjectHandle objHand);
243 #endif
244 
257 #if !DtHLA_1516
258  virtual void setRegionsForRegister(int numAttrs,
260  RTI::AttributeHandle* attrs, RTI::Region** regions);
261  virtual void setNoRegionsForRegister();
262 #endif
263 
264 #if DtHLA_1516
265  virtual bool reserveName(const std::wstring &theName, bool pushRti);
272 
275  virtual bool isNameReserved(const std::wstring &theName)const;
276 
277  #if DtHLA_1516_EVOLVED
278  virtual void releaseObjectInstanceName( const std::wstring& name);
280 
286  virtual bool reserveNames(
287  std::set<std::wstring> const& objectNames, bool pushRti);
288 
289  #endif
290 #endif
291 
292 public:
293 #if DtHLA_1516
294  static double requestNameTickMinTime();
297  static void setRequestNameTickMinTime(double time);
298 
299  static double requestNameTickMaxTime();
300  static void setRequestNameTickMaxTime(double time);
301 
303  static int numberOfRequestNameTries();
304  static void setNumberOfRequestNameTries(int tries);
305 #endif
306 
308  virtual void removeAllObjects();
309 
310 protected:
311 
312 #if DtHLA_1516
313  static void nameReservationSuceededCb(const std::wstring &theName, void *theUserData);
316  static void nameReservationFailedCb(const std::wstring &theName, void *theUserData);
317 
318  #if DtHLA_1516_EVOLVED
319  static void nameSetReservationSucceededCb(const std::set<std::wstring>& nameSet,
320  void* userData );
321  static void nameSetReservationFailedCb(const std::set<std::wstring>& nameSet,
322  void* userData );
323  #endif
324 #endif
325 
326 protected:
327 
331 
334 
336  DtHlaObjectManager& operator=( const DtHlaObjectManager& orig);
337 
340  virtual void objectProcessRemoveObject(DtHlaObject* hlaObj);
341 
344  virtual void objectProcessReflect(DtHlaObject* hlaObj,
345  const DtStateMsg &msg);
346 
350  virtual DtHlaObject* addKnownObject(
351 #if DtHLA_1516
352  RTI::ObjectInstanceHandle id,
353  RTI::ObjectClassHandle hand,
354  const std::wstring &name,
355  bool reflecting);
356 #else
357  RTI::ObjectHandle id,
358  RTI::ObjectClassHandle hand,
359  const char* name,
360  bool reflecting);
361 #endif
362 
365  virtual void removeKnownObject(
366  DtHlaObject* hlaObj);
367 
370  virtual DtList* discoverCbList(RTI::ObjectClassHandle handle);
371 
372 
373 #if DtHLA_1516
374  virtual void reservedNameSuceeded(const std::wstring &theName);
377 
379  virtual void reservedNameFailed(const std::wstring &theName);
380 
381 #if DtHLA_1516_EVOLVED
382  virtual void reservedNameSuceeded(const std::set<std::wstring>& theNames);
385 
387  virtual void reservedNameFailed(const std::set<std::wstring>& theNames);
388 
392  virtual const std::map<DtObjectId, RTI::FederateHandle>& registeredFederateHandleMap() const;
393 #endif
394 
395 #endif
396 
397 protected:
398 #if DtHLA_1516
399  static double theRequestNameTickMinTime;
400  static double theRequestNameTickMaxTime;
401  static int theNumberOfRequestNameTries;
402 #endif
403 
404 protected:
405 
409 
411 
414 
417 
420 
424 
426 
427 #if DtHLA_1516
428  std::set<std::wstring> myReservedObjectInstanceNameSet;
430 
433  bool myPendingNameReservationPassedFlag;
434  bool myPendingNameReservationFailedFlag;
435  int myReportedNameReservationCount;
436  std::wstring myPendingNameReservationName;
437  std::set<std::wstring> myPendingNameReservationNameSet;
438 
439 #if DtHLA_1516_EVOLVED
440  std::map<DtObjectId, RTI::FederateHandle> myRegisteringFederateMap;
441 #endif
442 #endif
443 
444 #if !DtHLA_1516
445  RTI::AttributeHandle* myAttrsForDDMRegister;
447  RTI::Region** myRegionsForDDMRegister;
448 #endif
450 };
451 
453 {
454  return myObjectList;
455 }
456 
458 {
459  return myRegObjectList;
460 }
461 
462 inline const std::map<DtObjectId, DtHlaObject*>& DtHlaObjectManager::discoveredObjects() const
463 {
464  return myDiscObjectList;
465 }
466 
467 #endif
468 #endif
469 
Contains the DtObjectId class declaration.
DtHlaObjectMap myObjectList
List of all known DtHlaObjects (by id).
Definition: hlaObjectManager.h:413
Instances of DtExerciseConn are used to provide an application&#39;s interface or connection to the netwo...
Definition: exerciseConnHLA.h:61
virtual const DtHlaObjectMap & registeredObjects() const
Get the list of all HLA objects registered by the federate.
Definition: hlaObjectManager.h:457
DtHlaObjectMap myRegObjectList
List of all DtHlaObjects that we&#39;ve registered locally.
Definition: hlaObjectManager.h:419
#define DT_DLL_VL
Definition: vlMachineTypes.h:108
DtHashlist myDiscoverCbLists
DtHashlist that maps object class handles (DtIntHashKeys) to pointers to DtLists of callback function...
Definition: hlaObjectManager.h:408
void(* DtDiscoverObjectCb)(DtHlaObject *obj, void *usr)
Definition: discoverObjectCbInfo.h:20
int myNumAttrsForDDMRegister
Definition: hlaObjectManager.h:449
std::set< DtDDMRegionSP > DtDDMRegionSet
Definition: region13.h:34
DtHlaObjectMap myDiscObjectList
List of all DtHlaObjects that we&#39;ve discovered, possibly including local objects that we are also ref...
Definition: hlaObjectManager.h:423
DtHashlist myObjectListByName
List of all known DtHlaObjects (by String).
Definition: hlaObjectManager.h:416
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
std::map< DtObjectId, DtHlaObject * > DtHlaObjectMap
Definition: hlaObjectManager.h:19
virtual const DtHlaObjectMap & allHlaObjects() const
Get the list of all HLA objects known to the federate.
Definition: hlaObjectManager.h:452
DtHashlist is deprecated and provided for backwards compatibility only.
Definition: vlHashlist.h:69
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:462
DtExerciseConn * myExConn
Definition: hlaObjectManager.h:425
RTI::Region ** myRegionsForDDMRegister
Definition: hlaObjectManager.h:447
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
DtHlaObjectFactory * myFactory
Definition: hlaObjectManager.h:410
void(* DtRemoveObjectCb)(DtHlaObject *obj, void *usr)
Definition: removeObjectCbInfo.h:22

Document ID: Generated on Thu Sep 19 02:12:35 EDT 2024 from SVN revision 269601
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)