VR-Forces 4.1 Class Documentation
DtVrfStateViewCollectionManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 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>
28 
29 #include <vrvCore/DtSimData.h>
30 #include <vrvCore/DtElementEntry.h>
32 #include <vrvCore/DtEntityState.h>
33 #include <vrvCore/DtElementData.h>
34 
35 namespace makVrv
36 {
37  class DtDe;
38 }
39 
40 namespace makVrf
41 {
44  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedEntityState>
45  {
46  public:
48  : makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedEntityState>(
49  de, makVrv::DtSimEntryUpdater::NoUpdates)
50  {
51  }
52  };
53 
58  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>
59  {
60  public:
62  makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
63  {
64  }
65 
66  bool isCompatible(makVrv::DtSimObjectEntry& entry)
67  {
69  }
70  };
71 
75  {
76  public:
78  makVrv::DtStateViewCollection<DtVrfObjectDataState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
79  {
80  }
81  };
82 
85  {
86  public:
88  makVrv::DtStateViewCollection<DtIffStateData>(de, makVrv::DtSimEntryUpdater::NoUpdates)
89  {
90  }
91  };
92 
95  {
96  public:
98  makVrv::DtStateViewCollection<DtVrlinkEmitterSystems>(de, makVrv::DtSimEntryUpdater::NoUpdates)
99  {
100  }
101  };
102 
104  class DT_DLL_VRFGUICORE DtEnvironmentStateViewCollection : public makVrv::DtStateViewCollection<DtVrlinkSimulatedEnvironmentProcess>
105  {
106  public:
108  makVrv::DtStateViewCollection<DtVrlinkSimulatedEnvironmentProcess>(de, makVrv::DtSimEntryUpdater::NoUpdates)
109  {
110  }
111  };
112 
115  {
116  public:
118  makVrv::DtStateViewCollection<DtExtendedStateData>(de, makVrv::DtSimEntryUpdater::NoUpdates)
119  {
120  }
121  };
122 
125  {
126  public:
128  makVrv::DtStateViewCollection<DtVrlinkSimulatedAggregateState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
129  {
130  }
131  };
132 
135  {
136  public:
138  makVrv::DtStateViewCollection<DtSpotReportState>(de, makVrv::DtSimEntryUpdater::AnyUpdates)
139  {
140  }
141  };
142 
143 
159  {
160  public:
161 
164 
165  static DtVrfStateViewCollectionManager& instance(makVrv::DtDe& de);
166 
178 
179 
182  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const makVrv::DtUniqueID& id);
183 
186  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const makVrv::DtUniqueID& id);
187 
190  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const std::string& name);
191 
194  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const std::string& name);
195 
199  template<typename T_ObjectDataInterfaceType>
200  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const makVrv::DtUniqueID& id)
201  {
202  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(id));
203  }
204 
208  template<typename T_ObjectDataInterfaceType>
209  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const makVrv::DtUniqueID& id)
210  {
211  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(id));
212  }
213 
217  template<typename T_ObjectDataInterfaceType>
218  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const std::string& name)
219  {
220  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(name));
221  }
222 
226  template<typename T_ObjectDataInterfaceType>
227  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const std::string& name)
228  {
229  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(name));
230  }
231 
234  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(makVrv::DtStateView<makVrv::DtSimState>* stateView);
236 
238  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStateView(const std::string& markingText);
239 
241  makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const std::string& markingText);
242 
246  {
247  if (!mySimulatedBaseStateViewCollection->hasStateView(id))
248  {
249  return 0;
250  }
251 
253  (mySimulatedBaseStateViewCollection->findStateView(id));
254  }
255 
258  makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const makVrv::DtUniqueID& id)
259  {
260  if (!mySpotReportStateViewCollection->hasStateView(id))
261  {
262  return 0;
263  }
264 
265  return const_cast<makVrv::DtStateView<DtSpotReportState>*>
266  (mySpotReportStateViewCollection->findStateView(id));
267  }
268 
272  DtVrfSimulatedEntityStateViewCollection* simulatedEntityStateViewCollection()
273  {
274  return mySimulatedEntityStateView;
275  }
276 
277  DtVrlinkSimulatedBaseStateViewCollection* simulatedBaseStateViewCollection()
278  {
279  return mySimulatedBaseStateViewCollection;
280  }
281 
282  DtVrfObjectDataStateViewCollection* objectDataStateViewCollection()
283  {
284  return myObjectDataStateViewCollection;
285  }
286 
287  DtEnvironmentStateViewCollection* environmentStateViewCollection()
288  {
289  return myEnvironmentStateViewCollection;
290  }
291 
292  DtExtendedStateDataViewCollection* extendedStateDataViewCollection()
293  {
294  return myExtendedStateDataViewCollection;
295  }
296 
297  DtIffStateDataViewCollection* iffStateDataViewCollection()
298  {
299  return myIffStateDataViewCollection;
300  }
301 
302  DtEmitterSystemStateViewCollection* emitterSystemStateViewCollection()
303  {
304  return myEmitterSystemStateViewCollection;
305  }
306 
307  DtSpotReportStateViewCollection* spotReportStateViewCollection()
308  {
309  return mySpotReportStateViewCollection;
310  }
311 
312  DtAggregateStateViewCollection* aggregateStateViewCollection()
313  {
314  return myAggregateStateViewCollection;
315  }
317 
320  makVrv::DtUniqueID parentId(const makVrv::DtUniqueID&) const;
321 
322  makVrv::DtUniqueID displayIdFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
323  makVrv::DtElementData::SceneObjectIdList displayIdsFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
324 
326  makVrv::DtUniqueID simIdFromDisplayId(const makVrv::DtUniqueID& id) const;
327 
329  virtual std::string entityName(const makVrv::DtUniqueID simId) const;
330 
332  virtual std::string overlayName(const makVrv::DtUniqueID simId) const;
333 
335  virtual makVrv::DtElementEntry::ElementType elementType(const makVrv::DtElementID&) const;
336 
338  virtual makVrv::DtSimEntryUpdater::UpdateRate updateRateFor(const makVrv::DtBaseStateView* state) const;
339 
340  typedef std::vector<makVrv::DtSimEntryUpdater::UpdateRate> UpdateRates;
341  virtual makVrv::DtSimEntryUpdater::UpdateRate minimumRate(const UpdateRates&) const;
342  virtual makVrv::DtSimEntryUpdater::UpdateRate maximumRate(const UpdateRates&) const;
343 
347  virtual void setUpdateRate(makVrv::DtSimEntry*, makVrv::DtSimEntryUpdater::UpdateRate,
348  makVrv::DtBaseStateView* state);
349 
351  virtual void forceUpdateForRelevantInformation(makVrv::DtUniqueID id);
352 
353  protected:
364 
365  typedef boost::unordered_map<makVrv::DtBaseStateView*, UpdateRates> UpdateRateMap;
366 
368  };
369 
370  template<typename T> T findStateFor(makVrv::DtSimEntry* entry)
371  {
372  makVrv::DtSimEntry::SimStateVector::const_iterator pos = entry->simStates().begin();
373  makVrv::DtSimEntry::SimStateVector::const_iterator endPos = entry->simStates().end();
374  for(; pos != endPos; ++pos)
375  {
376  T tState = dynamic_cast<T>(*pos);
377  if(tState)
378  {
379  return tState;
380  }
381  }
382 
383  return 0;
384  }
385 }

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)