VR-Forces 4.2 Class Documentation
DtVrfStateViewCollectionManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #pragma warning (disable:4715)
14 
15 #include <vlutil/vlExceptions.h>
16 
17 #include <vrfGuiCore/vrfGuiCore.h>
29 #include <vrvUtil/DtVirtualBaseClass.h>
30 
31 #include <vrvCore/DtSimData.h>
32 #include <vrvCore/DtElementEntry.h>
33 #include <vrvCore/DtStateViewCollection.h>
34 #include <vrvCore/DtEntityState.h>
35 #include <vrvCore/DtElementData.h>
36 
37 namespace makVrv
38 {
39  class DtDe;
40 }
41 
42 namespace makVrf
43 {
46  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedEntityState>
47  {
48  public:
51  de, makVrv::DtSimEntryUpdater::NoUpdates)
52  {
53  }
54  };
55 
60  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>
61  {
62  public:
64  makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
65  {
66  }
67 
68  bool isCompatible(makVrv::DtSimObjectEntry& entry)
69  {
70  return makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>::isCompatible(entry);
71  }
72  };
73 
76  class DT_DLL_VRFGUICORE DtVrfObjectDataStateViewCollection : public makVrv::DtStateViewCollection<DtVrfObjectDataState>
77  {
78  public:
80  makVrv::DtStateViewCollection<DtVrfObjectDataState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
81  {
82  }
83  };
84 
86  class DT_DLL_VRFGUICORE DtIffStateDataViewCollection : public makVrv::DtStateViewCollection<DtIffStateData>
87  {
88  public:
89  DtIffStateDataViewCollection(makVrv::DtDe& de) :
90  makVrv::DtStateViewCollection<DtIffStateData>(de, makVrv::DtSimEntryUpdater::NoUpdates)
91  {
92  }
93  };
94 
97  class DT_DLL_VRFGUICORE DtPropulsionNoiseStateDataViewCollection : public makVrv::DtStateViewCollection<DtPropulsionNoiseStateData>
98  {
99  public:
101  makVrv::DtStateViewCollection<DtPropulsionNoiseStateData>(de, makVrv::DtSimEntryUpdater::NoUpdates)
102  {
103  }
104  };
105 
107  class DT_DLL_VRFGUICORE DtEmitterSystemStateViewCollection : public makVrv::DtStateViewCollection<DtVrlinkEmitterSystems>
108  {
109  public:
111  makVrv::DtStateViewCollection<DtVrlinkEmitterSystems>(de, makVrv::DtSimEntryUpdater::NoUpdates)
112  {
113  }
114  };
115 
117  class DT_DLL_VRFGUICORE DtActiveSonarStateViewCollection : public makVrv::DtStateViewCollection<DtVrlinkActiveSonars>
118  {
119  public:
121  makVrv::DtStateViewCollection<DtVrlinkActiveSonars>(de, makVrv::DtSimEntryUpdater::NoUpdates)
122  {
123  }
124  };
125 
127  class DT_DLL_VRFGUICORE DtEnvironmentStateViewCollection : public makVrv::DtStateViewCollection<DtVrlinkSimulatedEnvironmentProcess>
128  {
129  public:
131  makVrv::DtStateViewCollection<DtVrlinkSimulatedEnvironmentProcess>(de, makVrv::DtSimEntryUpdater::NoUpdates)
132  {
133  }
134  };
135 
137  class DT_DLL_VRFGUICORE DtExtendedStateDataViewCollection : public makVrv::DtStateViewCollection<DtExtendedStateData>
138  {
139  public:
141  makVrv::DtStateViewCollection<DtExtendedStateData>(de, makVrv::DtSimEntryUpdater::NoUpdates)
142  {
143  }
144  };
145 
147  class DT_DLL_VRFGUICORE DtAggregateStateViewCollection : public makVrv::DtStateViewCollection<DtVrlinkSimulatedAggregateState>
148  {
149  public:
150  DtAggregateStateViewCollection(makVrv::DtDe& de) :
151  makVrv::DtStateViewCollection<DtVrlinkSimulatedAggregateState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
152  {
153  }
154  };
155 
157  class DT_DLL_VRFGUICORE DtSpotReportStateViewCollection : public makVrv::DtStateViewCollection<DtSpotReportState>
158  {
159  public:
161  makVrv::DtStateViewCollection<DtSpotReportState>(de, makVrv::DtSimEntryUpdater::AnyUpdates)
162  {
163  }
164  };
165 
166 
188  class DT_DLL_VRFGUICORE DtVrfStateViewCollectionManager : public makVrv::DtVirtualBaseClass
189  {
190  public:
191 
192  DtVrfStateViewCollectionManager(makVrv::DtDe&);
194 
195  static DtVrfStateViewCollectionManager& instance(makVrv::DtDe& de);
196 
208 
209 
212  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const makVrv::DtUniqueID& id);
213 
216  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const makVrv::DtUniqueID& id);
217 
220  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const std::string& name);
221 
224  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const std::string& name);
225 
229  template<typename T_ObjectDataInterfaceType>
230  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const makVrv::DtUniqueID& id)
231  {
232  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(id));
233  }
234 
238  template<typename T_ObjectDataInterfaceType>
239  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const makVrv::DtUniqueID& id)
240  {
241  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(id));
242  }
243 
247  template<typename T_ObjectDataInterfaceType>
248  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const std::string& name)
249  {
250  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(name));
251  }
252 
256  template<typename T_ObjectDataInterfaceType>
257  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const std::string& name)
258  {
259  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(name));
260  }
261 
264  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(makVrv::DtStateView<makVrv::DtSimState>* stateView);
266 
268  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStateView(const std::string& markingText);
269 
271  makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const std::string& markingText);
272 
275  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStateView(const makVrv::DtUniqueID& id)
276  {
277  if (!mySimulatedBaseStateViewCollection->hasStateView(id))
278  {
279  return 0;
280  }
281 
282  return const_cast<makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*>
283  (mySimulatedBaseStateViewCollection->findStateView(id));
284  }
285 
288  makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const makVrv::DtUniqueID& id)
289  {
290  if (!mySpotReportStateViewCollection->hasStateView(id))
291  {
292  return 0;
293  }
294 
295  return const_cast<makVrv::DtStateView<DtSpotReportState>*>
296  (mySpotReportStateViewCollection->findStateView(id));
297  }
298 
302  DtVrfSimulatedEntityStateViewCollection* simulatedEntityStateViewCollection()
303  {
304  return mySimulatedEntityStateView;
305  }
306 
307  DtVrlinkSimulatedBaseStateViewCollection* simulatedBaseStateViewCollection()
308  {
309  return mySimulatedBaseStateViewCollection;
310  }
311 
312  DtVrfObjectDataStateViewCollection* objectDataStateViewCollection()
313  {
314  return myObjectDataStateViewCollection;
315  }
316 
317  DtEnvironmentStateViewCollection* environmentStateViewCollection()
318  {
319  return myEnvironmentStateViewCollection;
320  }
321 
322  DtExtendedStateDataViewCollection* extendedStateDataViewCollection()
323  {
324  return myExtendedStateDataViewCollection;
325  }
326 
327  DtIffStateDataViewCollection* iffStateDataViewCollection()
328  {
329  return myIffStateDataViewCollection;
330  }
331 
332  DtPropulsionNoiseStateDataViewCollection* propulsionNoiseStateDataViewCollection()
333  {
334  return myPropulsionNoiseStateDataViewCollection;
335  }
336 
337  DtEmitterSystemStateViewCollection* emitterSystemStateViewCollection()
338  {
339  return myEmitterSystemStateViewCollection;
340  }
341 
342  DtActiveSonarStateViewCollection* activeSonarStateViewCollection()
343  {
344  return myActiveSonarStateViewCollection;
345  }
346 
347  DtSpotReportStateViewCollection* spotReportStateViewCollection()
348  {
349  return mySpotReportStateViewCollection;
350  }
351 
352  DtAggregateStateViewCollection* aggregateStateViewCollection()
353  {
354  return myAggregateStateViewCollection;
355  }
357 
360  makVrv::DtUniqueID parentId(const makVrv::DtUniqueID&) const;
361 
362  makVrv::DtUniqueID displayIdFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
363  makVrv::DtElementData::SceneObjectIdList displayIdsFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
364 
366  makVrv::DtUniqueID simIdFromDisplayId(const makVrv::DtUniqueID& id) const;
367 
369  virtual std::string entityName(const makVrv::DtUniqueID simId) const;
370 
372  virtual std::string overlayName(const makVrv::DtUniqueID simId) const;
373 
375  virtual makVrv::DtElementEntry::ElementType elementType(const makVrv::DtElementID&) const;
376 
378  virtual makVrv::DtSimEntryUpdater::UpdateRate updateRateFor(const makVrv::DtBaseStateView* state) const;
379 
380  typedef std::vector<makVrv::DtSimEntryUpdater::UpdateRate> UpdateRates;
381  virtual makVrv::DtSimEntryUpdater::UpdateRate minimumRate(const UpdateRates&) const;
382  virtual makVrv::DtSimEntryUpdater::UpdateRate maximumRate(const UpdateRates&) const;
383 
387  virtual void setUpdateRate(makVrv::DtSimEntry*, makVrv::DtSimEntryUpdater::UpdateRate,
388  makVrv::DtBaseStateView* state);
389 
391  virtual void forceUpdateForRelevantInformation(makVrv::DtUniqueID id);
392 
393  protected:
405  makVrv::DtDe& myDe;
406 
407  typedef boost::unordered_map<makVrv::DtBaseStateView*, UpdateRates> UpdateRateMap;
408 
410  };
411 
412  template<typename T> T findStateFor(makVrv::DtSimEntry* entry)
413  {
414  makVrv::DtSimEntry::SimStateVector::const_iterator pos = entry->simStates().begin();
415  makVrv::DtSimEntry::SimStateVector::const_iterator endPos = entry->simStates().end();
416  for(; pos != endPos; ++pos)
417  {
418  T tState = dynamic_cast<T>(*pos);
419  if(tState)
420  {
421  return tState;
422  }
423  }
424 
425  return 0;
426  }
427 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)