VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loadOrderOfBattleHandler.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include <mtl/mtl.h>
12 #include "readerWriter/rwList.h"
13 #include "vlpi/entityIdentifier.h"
14 #include <string>
15 #include <tbb/spin_mutex.h>
16 
18 class DtlInputStream;
20 class DtLocalObject;
21 class DtUUID;
23 
28  , public DtRwList
29 {
30 protected:
32  typedef std::pair<DtLocalObject*, DtVrfSimulationObjectGroupGeometry*> PendingObjectInformation;
33  typedef std::vector<PendingObjectInformation> PendingObjectsInformation;
34  typedef std::vector<PendingObjectsInformation> ObjectsAwaitingDiscovery;
35 
36 public:
39 
41  virtual ~DtLoadOrderOfBattleHandler();
42 
43  virtual bool loadScenarioPiece(const DtScenario&, void* userData = 0);
44  virtual bool loadScenarioPiece(const std::vector<std::string*>&, void* userData = 0);
45 
49  virtual bool loadSimulationObjectGroupPiece(const DtScenario&, DtlObjPtr* retArgs = 0, void* userData = 0);
50  virtual bool loadSimulationObjectGroupPiece(DtlObjPtr args, void* userData = 0);
51 
55  virtual void tick();
56 
57  virtual bool complete() const;
58 
60  {
61  return myLoadOrderOfBattleUserData;
62  }
63 
65  {
66  return new DtLoadOrderOfBattleHandler(*this);
67  }
68 
69 protected:
71  virtual bool readOrderOfBattleFileFromZipFile(const DtScenario&, DtLoadScenarioData&);
72 
74  virtual bool readOrderOfBattleFile(const DtScenario&, DtLoadScenarioData&);
75 
77  virtual bool readOrderOfBattleFile(DtlInputStream*, DtLoadScenarioData&);
78 
80  virtual DtlObjPtr getData(DtlObjPtr args,
81  const DtReaderWriter::SearchPaths& searchPaths,
82  const DtVariableBindingsList& variableBindings);
83 
85  virtual void reserveGlobalObjectIds(unsigned numToReserve);
86 
88  virtual DtEntityIdentifier findEntityIdentifier(DtlObjPtr mtlStream) const;
89 
92  virtual bool hasUUIDOrMarkingText(DtlObjPtr args, DtUUID&) const;
93 
94  virtual DtLocalObject* createObjectFromMemoryBuffer(const std::string& buffer);
95 
96  virtual void clearAllocatedProxies();
97 
98  virtual bool loadSimulationObjectGroupOrderOfBattleFromZipFile(const DtScenario& scenario, DtlObjPtr* retArgs, void* userData = 0);
99  virtual bool loadSimulationObjectGroupOrderOfBattle(const DtScenario& scenario, DtlObjPtr* retArgs, void* userData = 0);
100  virtual bool loadSimulationObjectGroupOrderOfBattle(DtlInputStream* fStream, DtlObjPtr* retArgs, void* userData = 0);
101 
104  virtual bool addObjectsReadyForSimulation(PendingObjectsInformation&);
105 
108  virtual bool ignoreImportObject(const DtEntityType&) const;
109  static void addIgnoreImportObject(const DtEntityType&);
110  static void removeIgnoreImportObject(const DtEntityType&);
112 
113 protected:
114  friend class CreateObjectCallback;
115 
119  virtual DtLocalObject* createAndInit(DtlObjPtr mtlStream, int flags, int force, const DtVector& geocentricOffsetLocation,
120  double offsetRotation = 0.);
121 
122  virtual bool finalizeObjectRead(DtLocalObject* newObject);
123 
124 protected:
128 
129  tbb::spin_mutex myFinalizeObjectMutex;
130  typedef std::map<DtUUID, DtVrfObjectLocalObjectFacade*> AllocatedProxies;
131 
132  tbb::spin_mutex myAllocatedProxiesMutex;
134 
136  std::vector<DtLocalObject*> myObjectsAdded;
137  static std::vector<DtEntityType> theIgnoreObjectsOnImport;
138 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
static std::vector< DtEntityType > theIgnoreObjectsOnImport
Definition: loadOrderOfBattleHandler.h:137
class DtLocalObjectManager:
Definition: localObjectManager.h:151
Definition: scenario.h:52
A Readable, Writable version of DtList. This class cannot be used directly, but must be inherited to ...
Definition: rwList.h:26
std::map< DtUUID, DtVrfObjectLocalObjectFacade * > AllocatedProxies
Definition: loadOrderOfBattleHandler.h:130
Definition: vrfObjectLocalObjectFacade.h:62
virtual DtLoadScenarioPieceHandler * clone() const
Definition: loadOrderOfBattleHandler.h:64
std::vector< DtLocalObject * > myObjectsAdded
Definition: loadOrderOfBattleHandler.h:136
virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)=0
This method must be overridden by a subclass. Within this method, new instances of the DtReaderWriter...
std::pair< DtLocalObject *, DtVrfSimulationObjectGroupGeometry * > PendingObjectInformation
Kept around when in simulation object group creation mode.
Definition: loadOrderOfBattleHandler.h:32
Definition: asyncJobServer.h:37
DtSimulationServices * mySimulationServices
Definition: loadOrderOfBattleHandler.h:126
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
std::vector< PendingObjectInformation > PendingObjectsInformation
Definition: loadOrderOfBattleHandler.h:33
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
DtLocalObjectManager * myObjectManager
Definition: loadOrderOfBattleHandler.h:125
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
This is a two way structure. It will contain read data (import) and output dat objects created...
Definition: loadScenarioData.h:39
virtual bool loadScenarioPiece(const DtScenario &, void *userData=0)=0
Creates a new scenario object from the given file. It is up to the caller to delete this scenario obj...
The class to load a piece of the scenario. Return false if the load of that piece fails...
Definition: scenarioLoadManager.h:46
tbb::spin_mutex myFinalizeObjectMutex
Definition: loadOrderOfBattleHandler.h:129
ObjectsAwaitingDiscovery myObjectsAwaitingDiscovery
Definition: loadOrderOfBattleHandler.h:135
tbb::spin_mutex myAllocatedProxiesMutex
Definition: loadOrderOfBattleHandler.h:132
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
const DtLoadScenarioData & loadOrderOfBattleData() const
Definition: loadOrderOfBattleHandler.h:59
AllocatedProxies myAllocatedProxies
Definition: loadOrderOfBattleHandler.h:133
DtLoadScenarioData myLoadOrderOfBattleUserData
Definition: loadOrderOfBattleHandler.h:127
std::vector< PendingObjectsInformation > ObjectsAwaitingDiscovery
Definition: loadOrderOfBattleHandler.h:34
The DtLoadOrderOfBattleHandler will load an order of battle file (oob) and create all the local objec...
Definition: loadOrderOfBattleHandler.h:26
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

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)