VR-Forces 5.0.3 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 
17 class DtScenario;
18 class DtRwSpawnTemplateList;
20 class DtLocalObject;
21 
24 {
25 public:
28 
30  virtual ~DtSpawnSinkManager();
31 
32  virtual bool init();
33 
35  virtual bool loadTemplates(const DtFilename& filename, bool sendUpdate = true);
36 
38  virtual const DtRwSpawnDataList* spawnTemplates() const;
39 
40  virtual DtRwSpawnData* findSpawnDataByUUID(const DtUUID& uuid);
41 
42  virtual void updateSpawnSinkTemplates(
43  const DtRwSpawnDataList& spawnDataList);
44 
45  //****************************************************************************
47  //****************************************************************************
52  static void preScenarioLoadCallback(DtScenario& scenario,
53  void* usrData);
54 
57  static void preScenarioRewindCallback(void* usrData);
58 
60  static void preScenarioImportCallback(DtScenario& scenario,
61  void* usrData);
62  virtual void preScenarioImport(DtScenario& scenario);
63 
65  static void postScenarioImportCallback(const DtScenario& scenario,
66  void* usrData);
67  virtual void postScenarioImport(const DtScenario& scenario);
68 
69  virtual DtUUID uuidForTemplateName(const DtString& templateName) const;
70 
72  virtual bool addSpawnPoint(const DtUUID& templateUuid, const DtUUID& spawnPointUuid);
73 
74  virtual void removeSpawnPoint(const DtUUID& templateUuid, const DtUUID& spawnPointUuid);
75 
81  virtual void resetManagerTemplates(const DtRwSpawnDataList& templates, const DtFilename& templateFilename, bool sendUpdates = true);
82 
83  virtual void clearTemplates();
84 
85 //****************************************************************************
87 //****************************************************************************
91  static void requestSpawnListCallback(DtSimMessage* msg, void* usr);
92  virtual void processRequestSpawnList(DtSimMessage* msg);
94 
99  static void spawnTemplateListCallback(DtSimMessage* msg, void* usr);
100  virtual void preocesSpawnTemplateList(DtSimMessage* msg);
102 
106  virtual void sendSpawnListMessage(const DtSimulationAddress& recipient,
107  bool initialSend = false);
108 
112  static void addSinkPointCallback(DtSimMessage* msg, void* usr);
113  virtual void processAddSinkPoint(DtSimMessage* msg);
115 
118  static void requestSpawnDataCallback(DtSimMessage* msg, void* usr);
119  virtual void processRequestSpawnData(DtSimMessage* msg);
121 
124  static void updateSpawnTemplateCallback(DtSimMessage* msg, void* usr);
125  virtual void processUpdateSpawnTemplate(DtSimMessage* msg);
127 
130  static void createTemplateCallback(DtSimMessage* msg, void* usr);
131  virtual void processCreateTemplate(DtSimMessage* msg);
133 
136  static void deleteSpawnTemplateCallback(DtSimMessage* msg, void* usr);
137  virtual void processDeleteSpawnTemplate(DtSimMessage* msg);
139 
145  virtual void processSimObjectDeleted(DtSimObjectReference ref);
147 
151  virtual void processAddSpawnPoint(const DtSimObject *object);
153 
157  virtual void addSpawnSinkPoint(DtSimObjectReference ref);
159 
160  virtual void renameSpawnPoint(DtLocalObject *spawnEntity, const DtString& oldTemplateName,
161  const DtString& newTemplateName);
162  virtual void renameSinkPoint(DtLocalObject *spawnEntity, const DtString& oldTemplateName,
163  const DtString& newTemplateName);
164 
165  virtual void removeSpawnTemplateAsParentOfSinkPoint(const DtUUID& templateUUID, const DtUUID& sinkPoint);
166  virtual void addSpawnTemplateAsParentOfSinkPoint(const DtUUID& templateUUID, const DtUUID& sinkPoint);
167 
168  virtual void upgradeTemplates(const DtRwSpawnDataList& templates, bool andRename = false);
169  virtual void removeNameMappings(const DtRwSpawnDataList& templates);
170  virtual void resolveUnmatchedSpawnPoints();
171 
172  virtual const DtRwSpawnDataList& templates();
173 
174  typedef void (*DtClearTemplateUUIDFunction)(void* userData);
175  typedef void (*DtRefreshSpawnDataFunction)(void* userData);
176 
177  virtual void addClearTemplateUUIDEntry(
178  DtClearTemplateUUIDFunction fcn, void* userData);
179  virtual void removeClearTemplateUUIDEntry(
180  DtClearTemplateUUIDFunction fcn, void* userData);
181 
182  virtual void addRefreshSpawnDataEntry(
183  DtRefreshSpawnDataFunction fcn, void* userData);
184  virtual void removeRefreshSpawnDataEntry(
185  DtRefreshSpawnDataFunction fcn, void* userData);
186 
188  virtual DtUUID uuidBasedOnName(const DtList& templateList, const DtString&) const;
189 
190 protected:
193 
196 
199 
200  boost::unordered_map<DtRwSpawnData*, DtString> myCurrentUUIDsOnImport;
202 
203  typedef boost::unordered_map<DtUUID, DtUUID> PointByTemplate;
206 
207  typedef std::map<DtString, DtUUID> WaitingForSinkPoints;
209 
210  std::map<DtString, DtString> myNewSpawnNameToOldSpawnNameMap;
211 
212  boost::signals2::scoped_connection mySimObjectAddedConnection;
213  boost::signals2::scoped_connection mySimObjectDeletedConnection;
214 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
std::map< DtString, DtString > myNewSpawnNameToOldSpawnNameMap
Definition: spawnSinkManager.h:210
class DtLocalObjectManager:
Definition: localObjectManager.h:151
DtNoArgumentCallbackList myRefreshSpawnDataCallbackList
Definition: spawnSinkManager.h:198
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:23
WaitingForSinkPoints myWaitingForSinkPoints
Definition: spawnSinkManager.h:208
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: spawnSinkManager.h:212
DtRwSpawnDataList myTemplates
Definition: spawnSinkManager.h:194
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:201
#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:200
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:207
PointByTemplate mySpawnPoints
Definition: spawnSinkManager.h:204
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
boost::unordered_map< DtUUID, DtUUID > PointByTemplate
Definition: spawnSinkManager.h:203
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:79
DtSimulationServices * mySimulationServices
Definition: spawnSinkManager.h:191
PointByTemplate mySinkPoints
Definition: spawnSinkManager.h:205
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
DtNoArgumentCallbackList myClearTemplatesCallbackList
Definition: spawnSinkManager.h:197
Contains the DtSimObjectReference class declaration.
boost::signals2::scoped_connection mySimObjectDeletedConnection
Definition: spawnSinkManager.h:213
DtLocalObjectManager * myObjectManager
Definition: spawnSinkManager.h:192
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:195

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)