VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spawnSinkManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 #pragma once
7 
14 #include <boost/unordered_map.hpp>
15 #include <tbb/mutex.h>
16 
18 class DtScenario;
19 class DtRwSpawnTemplateList;
21 class DtLocalObject;
22 
25 {
26 public:
29 
31  virtual ~DtSpawnSinkManager();
32 
33  virtual bool init();
34 
36  virtual bool loadTemplates(const DtFilename& filename, bool sendUpdate = true);
37 
39  virtual const DtRwSpawnDataList* spawnTemplates() const;
40 
41  virtual DtRwSpawnData* findSpawnDataByUUID(const DtUUID& uuid);
42 
43  virtual void updateSpawnSinkTemplates(
44  const DtRwSpawnDataList& spawnDataList);
45 
46  //****************************************************************************
48  //****************************************************************************
53  static void preScenarioLoadCallback(DtScenario& scenario,
54  void* usrData);
55 
58  static void preScenarioRewindCallback(void* usrData);
59 
61  static void preScenarioImportCallback(DtScenario& scenario,
62  void* usrData);
63  virtual void preScenarioImport(DtScenario& scenario);
64 
66  static void postScenarioImportCallback(const DtScenario& scenario,
67  void* usrData);
68  virtual void postScenarioImport(const DtScenario& scenario);
69 
70  virtual DtUUID uuidForTemplateName(const DtString& templateName) const;
71 
73  virtual bool addSpawnPoint(const DtUUID& templateUuid, const DtUUID& spawnPointUuid);
74 
75  virtual void removeSpawnPoint(const DtUUID& templateUuid, const DtUUID& spawnPointUuid);
76 
82  virtual void resetManagerTemplates(const DtRwSpawnDataList& templates, const DtFilename& templateFilename, bool sendUpdates = true);
83 
84  virtual void clearTemplates();
85 
86 //****************************************************************************
88 //****************************************************************************
92  static void requestSpawnListCallback(DtSimMessage* msg, void* usr);
93  virtual void processRequestSpawnList(DtSimMessage* msg);
95 
100  static void spawnTemplateListCallback(DtSimMessage* msg, void* usr);
101  virtual void preocesSpawnTemplateList(DtSimMessage* msg);
103 
107  virtual void sendSpawnListMessage(const DtSimulationAddress& recipient,
108  bool initialSend = false);
109 
113  static void addSinkPointCallback(DtSimMessage* msg, void* usr);
114  virtual void processAddSinkPoint(DtSimMessage* msg);
116 
119  static void requestSpawnDataCallback(DtSimMessage* msg, void* usr);
120  virtual void processRequestSpawnData(DtSimMessage* msg);
122 
125  static void updateSpawnTemplateCallback(DtSimMessage* msg, void* usr);
126  virtual void processUpdateSpawnTemplate(DtSimMessage* msg);
128 
131  static void createTemplateCallback(DtSimMessage* msg, void* usr);
132  virtual void processCreateTemplate(DtSimMessage* msg);
134 
137  static void deleteSpawnTemplateCallback(DtSimMessage* msg, void* usr);
138  virtual void processDeleteSpawnTemplate(DtSimMessage* msg);
140 
146  virtual void processSimObjectDeleted(DtSimObjectReference ref);
148 
152  virtual void processAddSpawnPoint(const DtSimObject *object);
154 
158  virtual void addSpawnSinkPoint(DtSimObjectReference ref);
160 
161  virtual void renameSpawnPoint(DtLocalObject *spawnEntity, const DtString& oldTemplateName,
162  const DtString& newTemplateName);
163  virtual void renameSinkPoint(DtLocalObject *spawnEntity, const DtString& oldTemplateName,
164  const DtString& newTemplateName);
165 
166  virtual void removeSpawnTemplateAsParentOfSinkPoint(const DtUUID& templateUUID, const DtUUID& sinkPoint);
167  virtual void addSpawnTemplateAsParentOfSinkPoint(const DtUUID& templateUUID, const DtUUID& sinkPoint);
168 
169  virtual void upgradeTemplates(const DtRwSpawnDataList& templates, bool andRename = false);
170  virtual void removeNameMappings(const DtRwSpawnDataList& templates);
171  virtual void resolveUnmatchedSpawnPoints();
172 
173  virtual const DtRwSpawnDataList& templates();
174 
175  typedef void (*DtClearTemplateUUIDFunction)(void* userData);
176  typedef void (*DtRefreshSpawnDataFunction)(void* userData);
177 
178  virtual void addClearTemplateUUIDEntry(
179  DtClearTemplateUUIDFunction fcn, void* userData);
180  virtual void removeClearTemplateUUIDEntry(
181  DtClearTemplateUUIDFunction fcn, void* userData);
182 
183  virtual void addRefreshSpawnDataEntry(
184  DtRefreshSpawnDataFunction fcn, void* userData);
185  virtual void removeRefreshSpawnDataEntry(
186  DtRefreshSpawnDataFunction fcn, void* userData);
187 
189  virtual DtUUID uuidBasedOnName(const DtList& templateList, const DtString&) const;
190 
191 protected:
194 
197 
200 
201  boost::unordered_map<DtRwSpawnData*, DtString> myCurrentUUIDsOnImport;
203 
204  typedef boost::unordered_map<DtUUID, DtUUID> PointByTemplate;
207 
208  typedef std::map<DtString, DtUUID> WaitingForSinkPoints;
210 
211  std::map<DtString, DtString> myNewSpawnNameToOldSpawnNameMap;
212 
213  boost::signals2::scoped_connection mySimObjectAddedConnection;
214  boost::signals2::scoped_connection mySimObjectDeletedConnection;
215 
216  tbb::mutex myMutex;
217 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
std::map< DtString, DtString > myNewSpawnNameToOldSpawnNameMap
Definition: spawnSinkManager.h:211
class DtLocalObjectManager:
Definition: localObjectManager.h:151
DtNoArgumentCallbackList myRefreshSpawnDataCallbackList
Definition: spawnSinkManager.h:199
Definition: rwSpawnDataList.h:25
Definition: scenario.h:52
Manages all of the spawn points, sink points, and spawn templates in the current scenario.
Definition: spawnSinkManager.h:24
WaitingForSinkPoints myWaitingForSinkPoints
Definition: spawnSinkManager.h:209
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: spawnSinkManager.h:213
DtRwSpawnDataList myTemplates
Definition: spawnSinkManager.h:195
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
bool myTemplatesModified
Definition: spawnSinkManager.h:202
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
Base library for data that is used to control how spawn points generate entities. This data structure...
Definition: rwSpawnData.h:37
File: simMsg.h.
Definition: simMessage.h:35
boost::unordered_map< DtRwSpawnData *, DtString > myCurrentUUIDsOnImport
Definition: spawnSinkManager.h:201
This class works just as DtCalllbackTable, but manages callbacks that have no arguments, and therefore don&#39;t fit in the template defined by DtCallbackList.
Definition: noArgumentCallbackList.h:152
std::map< DtString, DtUUID > WaitingForSinkPoints
Definition: spawnSinkManager.h:208
tbb::mutex myMutex
Definition: spawnSinkManager.h:216
PointByTemplate mySpawnPoints
Definition: spawnSinkManager.h:205
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
boost::unordered_map< DtUUID, DtUUID > PointByTemplate
Definition: spawnSinkManager.h:204
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
DtSimulationServices * mySimulationServices
Definition: spawnSinkManager.h:192
PointByTemplate mySinkPoints
Definition: spawnSinkManager.h:206
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtNoArgumentCallbackList myClearTemplatesCallbackList
Definition: spawnSinkManager.h:198
Contains the DtSimObjectReference class declaration.
boost::signals2::scoped_connection mySimObjectDeletedConnection
Definition: spawnSinkManager.h:214
DtLocalObjectManager * myObjectManager
Definition: spawnSinkManager.h:193
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
DtRwSpawnDataList myCurrentTemplates
Definition: spawnSinkManager.h:196

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)