VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reflectedExtEntityList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2003 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: refExtEntList.h,v $ $Revision: 1.25 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef REFEXTENTLIST_H
10 #define REFEXTENTLIST_H
11 
12 #include <vl/reflectedEntityList.h>
13 
15 #include <vl/dataInteraction.h>
16 #include <vlutil/vlHashlist.h>
17 
18 // class DtReflectedExtEntityList:
19 //
20 // Instances of DtReflectedExtEntityList manage the list of
21 // remote entities in the exercise.
22 
25 {
26 
27 public:
28 
29  // Constructor - obtains the set of object classes to subscribe
30  // to from the exConn's fomMapper.
31  DtReflectedExtEntityList(DtExerciseConn* exConn);
32 
33 #if DtHLA
34 
35 
36  DtReflectedExtEntityList(DtExerciseConn* exConn,
37  const DtDDMRegionSet* regionSetToUse);
38 
41  DtReflectedExtEntityList(DtExerciseConn* exConn,
42  const DtList *handleList, const DtDDMRegionSet* regionSetToUse = 0);
43 
44 #endif
45 
46  // destructor
47  virtual ~DtReflectedExtEntityList();
48 
49 #if DtHLA
50  #if DtHLA_1516
51  virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectInstanceHandle id);
52  #else
53  virtual DtReflectedExtEntity* lookupEE ( RTI::ObjectHandle id);
54  #endif
55 
56  // Look up entity by name.
57  virtual DtReflectedExtEntity* lookupEE (
58  const DtGlobalObjectDesignator& objName);
59 #elif (DtDIS || DtTENA)
60  // Look up entity by identifier.
61  virtual DtReflectedExtEntity* lookup(const DtObjectId& id);
62 #endif
63 
64  // Get the first/last entity in the list.
65  virtual DtReflectedExtEntity* firstEE() const;
66  virtual DtReflectedExtEntity* lastEE() const;
67 
68  // Entity added callback registration/deregistration.
69  virtual void addEntityAdditionCallback (
70  DtExtEntityCallbackFunction cb, void* userData);
71 
72  virtual void removeEntityAdditionCallback (
73  DtExtEntityCallbackFunction cb, void* userData);
74 
75  // Entity removed callback registration/deregistration.
76  virtual void addEntityRemovalCallback (
77  DtExtEntityCallbackFunction cb, void* userData);
78 
79  virtual void removeEntityRemovalCallback (
80  DtExtEntityCallbackFunction cb, void* userData);
81 
83  static void setTimeoutRequestTime(DtTime t);
84  static DtTime timeoutRequestTime();
85 
86 protected:
87 
88  void processVrfObjectStateUpdateMessage(DtDataInteraction* interaction);
89  void processVrfObjectDataMessage(DtDataInteraction* interaction);
90 
91  static void dataInteractionCallback(DtDataInteraction* i, void* usr);
92 
93  virtual void processDataInteraction(DtDataInteraction* i);
94 
95 #if DtHLA
96  virtual DtReflectedObject* newReflectedObject(DtHlaObject* obj) const;
97  virtual void addToObjectList(DtReflectedObject* refObj);
98 #elif DtDIS
99  // Create a new reflected entity
100  virtual DtReflectedEntity* newReflectedEntity (
101  const DtEntityIdentifier& id, const DtEntityType& type) const;
102  virtual void processRelativeLocationPdu(
103  const DtRelativeLocationPdu& pdu);
104 #elif DtTENA
105  // Create a new reflected entity
106  virtual DtReflectedEntity* newReflectedEntity (
107  const DtEntityIdentifier& id, const DtEntityType& type) const;
108 #else
109 # pragma message ( "No protocol defined." )
110 #endif
111 
112  // Called from destructor, cleans up myObjectDataMessageHashlist and removed all memory
113  virtual void cleanupObjectDataMessageHashList();
114 
115  // Overridden to check object data message hash list to see if there is a match
116  virtual void objectAdded(DtReflectedObject* object);
117 
118 #if !DtTENA
119  // Overidden to see if:
120  // a) This object is a VRF object
121  // b) This object, if a VRF object, has a VRF object data message assigned (or waiting to be assigned)
122  // If a) is true and b) is false, then, the object will not be added to the refleced list. Instead, a request
123  // will be sent out for the vrf object data associated with the object. Once it is received, the object will
124  // be added to the reflected list
125  virtual bool readyToAdd(DtReflectedObject* obj);
126 #endif
127 
128  // Sets up extended state repository from cached vrf data (if exists). If this method returns true, the object
129  // was either not an extended object or it had the data correctly set
130  virtual bool setupVrfObjectData(DtReflectedObject* object);
131 
132 #if !DtTENA
133  // Will start the process of adding an object to the reflected list if this object is waiting for a VRF message.
134  // Returns true if this object is and was added to the list
135  virtual bool addObjectIfWaitingForVrfMessage(DtReflectedExtEntity*);
136 #endif
137 
138  // This routine will request the vrf object data message to be sent for a VRF entity. This request will be handled
139  // by the entity publisher.
140  virtual void requestVrfObjectData(DtReflectedObject* object);
141 
144  virtual bool timeOutVrfObjectDataRequest(DtReflectedObject* obj);
145 
146 #if !DtTENA
147 
148  virtual void removeAndDelete(DtReflectedObject* obj,
149  char* msg = NULL);
150 #endif
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 };
182 
183 #endif // REFEXTENTLIST_H
184 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)