VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reflectedObjectHLA.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 
7 #if DtHLA
8 
9 #ifndef DtHlaReflectedObject_H_
10 #define DtHlaReflectedObject_H_
11 
12 
13 #include "globalObjectDesignator.h"
14 #include "hlaObjectWithStateRep.h"
16 #include "reflectedObjectListHLA.h"
17 #include "objectId.h"
18 
23 
27 class DT_DLL_VL DtStateMsg;
29 
35 
37 {
38  friend class DtReflectedObjectList;
39 
40 public:
41 
43  typedef DtStateRepository* (*DtBaseStateRepCreator)();
44 
45 public:
46 
49  DtStateRepository* stateRep);
50 
54  DtExerciseConn* conn, DtBaseStateRepCreator creator);
55 
58  DtReflectedObject(const DtObjectId& id,
59  const DtGlobalObjectDesignator& des,
60  DtExerciseConn* conn, DtBaseStateRepCreator creator);
61 
63  virtual ~DtReflectedObject();
64 
67  virtual DtStateRepository* stateRep() const;
68 
70  virtual DtStateRepository* sr() const;
71 
74  virtual DtHlaStateDecoder* decoder();
75 
78  virtual DtHlaObjectWithStateRep* hlaObject() const;
79 
81  virtual const DtObjectId& objectId() const;
82 
84  virtual const DtObjectId& id() const;
85 
87  virtual const DtObjectId& localId() const;
88 
90  virtual const DtString& name() const;
91 
94  virtual const DtGlobalObjectDesignator& globalId() const;
95 
96 #if DtHLA_1516_EVOLVED
97 
98 
99 
100  virtual const DtString& lastProducingFederate() const;
101 #endif
102 
105  virtual DtTime lastSimTimeUpdated() const;
106 
107 
110  virtual DtTime lastReceivedTimeStamp() const;
111 
113  virtual void baseAddPostUpdateCallback(
114  DtReflectedObjectCallbackFunction cb, void* userData);
115  virtual void baseRemovePostUpdateCallback(
116  DtReflectedObjectCallbackFunction cb, void* userData);
117 
119  virtual DtReflectedObject* nextObj() const;
120 
122  virtual DtReflectedObject* prevObj() const;
123 
126  virtual DtReflectedObject* wrapNextObj() const;
127 
130  virtual DtReflectedObject* wrapPrevObj() const;
131 
136  void setHlaObject(DtHlaObject* obj,
137  DtHlaStateDecoder* decoder = NULL);
138 
141  virtual void setNoHlaObject(const DtObjectId& id,
142  const DtGlobalObjectDesignator& des);
143 
146  void detachHlaObject();
147 
149  virtual void requestUpdate();
150 
151 protected:
152 
155 
158 
160  virtual void processPostUpdateCallbacks();
161 
162 protected:
163 
165  static void requestUpdatePostDrainCb(void* usr);
166 
168  static void processPostUpdateCallbacksCb(
169  const DtStateMsg& stateMsg,
170  DtHlaObject* obj,
171  void* usr);
172 
173 protected:
174 
183 
184  //This variable is maintained privately by the parent list so that nextObj functions work
185  DtRefHlaObjectMap::iterator myReflIterator;
187 };
188 
189 
191 {
192  return id();
193 }
194 
196 {
197  return myStateRep;
198 }
199 
201 {
202  return myStateRep;
203 }
204 
206 {
207  return myHlaObj;
208 }
209 
211 {
212  if(myReflMap)
213  {
214  DtRefHlaObjectMap::iterator nextIter = myReflIterator;
215  ++nextIter;
216  if(nextIter != myReflMap->end())
217  {
218  return nextIter->second;
219  }
220  }
221  return 0;
222 }
223 
225 {
226  if(myReflMap)
227  {
228  DtRefHlaObjectMap::iterator nextIter = myReflIterator;
229  if(nextIter != myReflMap->begin())
230  {
231  --nextIter;
232  return nextIter->second;
233  }
234  }
235  return 0;
236 }
237 
239 {
240  if(myReflMap)
241  {
242  DtReflectedObject* obj = nextObj();
243  if(obj)
244  {
245  return obj;
246  }
247  else
248  {
249  if(!myReflMap->empty())
250  {
251  return myReflMap->begin()->second;
252  }
253  return 0;
254  }
255  }
256  return 0;
257 }
258 
260 {
261  if(myReflMap)
262  {
263  DtReflectedObject* obj = prevObj();
264  if(obj)
265  {
266  return obj;
267  }
268  else
269  {
270  if(!myReflMap->empty())
271  {
272  return myReflMap->rend()->second;
273  }
274  return 0;
275  }
276  }
277  return 0;
278 }
279 
280 #endif
281 #endif
282 

Document ID: Generated on Mon Apr 8 04:49:21 EDT 2019 from SVN revision 197403
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)