VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
reflectedExtEntityList.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2017 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <vl/reflectedEntityList.h>
15 #include <vl/dataInteraction.h>
16 #include <vlutil/vlHashlist.h>
17 
18 // class DtReflectedExtEntityList:
19 // Instances of DtReflectedExtEntityList manage the list of
20 // remote entities in the exercise.
22 {
23 public:
24 
25  // Constructor - obtains the set of object classes to subscribe
26  // to from the exConn's fomMapper.
27  DtReflectedExtEntityList(DtExerciseConn* exConn);
28 
29 #if DtHLA
30 
31 
32  DtReflectedExtEntityList(DtExerciseConn* exConn,
33  const DtDDMRegionSet* regionSetToUse);
34 
37  DtReflectedExtEntityList(DtExerciseConn* exConn,
38  const DtList *handleList, const DtDDMRegionSet* regionSetToUse = 0);
39 
40 #endif
41 
42  // destructor
43  virtual ~DtReflectedExtEntityList();
44 
47  virtual void setWaitForVrfExtendedData(bool);
48  virtual bool waitForVrfExtendedData() const;
49 
50 #if DtHLA
51  #if DtHLA_1516
52  virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectInstanceHandle id);
53  #else
54  virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectHandle id);
55  #endif
56 
57  // Look up entity by name.
58  virtual DtReflectedExtEntity* lookupEE (
59  const DtGlobalObjectDesignator& objName);
60 #elif (DtDIS || DtTENA)
61  // Look up entity by identifier.
62  virtual DtReflectedExtEntity* lookup(const DtObjectId& id);
63 #endif
64 
65  // Get the first/last entity in the list.
66  virtual DtReflectedExtEntity* firstEE() const;
67  virtual DtReflectedExtEntity* lastEE() const;
68 
69  // Entity added callback registration/deregistration.
70  virtual void addEntityAdditionCallback (
71  DtExtEntityCallbackFunction cb, void* userData);
72 
73  virtual void removeEntityAdditionCallback (
74  DtExtEntityCallbackFunction cb, void* userData);
75 
76  // Entity removed callback registration/deregistration.
77  virtual void addEntityRemovalCallback (
78  DtExtEntityCallbackFunction cb, void* userData);
79 
80  virtual void removeEntityRemovalCallback (
81  DtExtEntityCallbackFunction cb, void* userData);
82 
84  static void setTimeoutRequestTime(DtTime t);
85  static DtTime timeoutRequestTime();
86 
87 protected:
88 
89  void processVrfObjectStateUpdateMessage(DtDataInteraction* interaction);
90  void processVrfObjectDataMessage(DtDataInteraction* interaction);
91 
92  static void dataInteractionCallback(DtDataInteraction* i, void* usr);
93 
94  virtual void processDataInteraction(DtDataInteraction* i);
95 
96 #if DtHLA
97  virtual DtReflectedObject* newReflectedObject(DtHlaObject* obj) const;
98  virtual void addToObjectList(DtReflectedObject* refObj);
99 #elif DtDIS
100  // Create a new reflected entity
101  virtual DtReflectedEntity* newReflectedEntity (
102  const DtEntityIdentifier& id, const DtEntityType& type) const;
103 #elif DtTENA
104  // Create a new reflected entity
105  virtual DtReflectedEntity* newReflectedEntity (
106  const DtEntityIdentifier& id, const DtEntityType& type) const;
107 #else
108 # pragma message ( "No protocol defined." )
109 #endif
110 
111  // Called from destructor, cleans up myObjectDataMessageHashlist and removed all memory
112  virtual void cleanupObjectDataMessageHashList();
113 
114 #if !DtTENA
115  // Overidden to see if:
116  // a) This object is a VRF object
117  // b) This object, if a VRF object, has a VRF object data message assigned (or waiting to be assigned)
118  // If a) is true and b) is false, then, the object will not be added to the refleced list. Instead, a request
119  // will be sent out for the vrf object data associated with the object. Once it is received, the object will
120  // be added to the reflected list
121  virtual bool readyToAdd(DtReflectedObject* obj);
122 #endif
123 
124  // Sets up extended state repository from cached vrf data (if exists). If this method returns true, the object
125  // was either not an extended object or it had the data correctly set
126  virtual bool setupVrfObjectData(DtReflectedObject* object);
127 
128 #if !DtTENA
129  // Will start the process of adding an object to the reflected list if this object is waiting for a VRF message.
130  // Returns true if this object is and was added to the list
131  virtual bool addObjectIfWaitingForVrfMessage(DtReflectedExtEntity*);
132 #endif
133 
134  // This routine will request the vrf object data message to be sent for a VRF entity. This request will be handled
135  // by the entity publisher.
136  virtual void requestVrfObjectData(DtReflectedObject* object);
137 
140  virtual bool timeOutVrfObjectDataRequest(DtReflectedObject* obj);
141 
142 #if !DtTENA
143 
144  virtual void removeAndDelete(DtReflectedObject* obj,
145  char* msg = NULL);
146 #endif
147 
148  // This is a hack. It will lead to the HLA decoders being set up. If this is the wrong place to do this, someone
149  // else can figure out the right place.
150  virtual void diguyExtensionsSetup();
151 
152 protected:
155 
156 #if DtDIS
157 
158  virtual void processObjectAdditionCallbacks(DtReflectedObject* object);
159 #endif
160 
161 private:
162  // not implemented
164  DtReflectedExtEntityList& operator= ( const DtReflectedExtEntityList& rhs);
165 
166 protected:
167  // List to keep the vrfobject data messages that have been found but not associated with new entities yet
169 
170  // List to keep track of requests for vrf object message data and the time they were sent
172 
173 #if DtDIS
174  // Reflected objects that are waiting for vrf object updates
176 #elif DtHLA
177  DtObjectIdHashList myWaitingForVrfObjectData;
178 #endif
179 
181 
183 
184 };

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)