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() override;
42 
43  virtual bool loadScenarioPiece(const DtScenario&, void* userData = 0, bool reinitializingScenario = false) override;
44  virtual bool loadScenarioPiece(const std::vector<std::string*>&, void* userData = 0, bool reinitializingScenario = false);
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 
64  virtual DtLoadScenarioPieceHandler* clone() const override {
65  return new DtLoadOrderOfBattleHandler(*this);
66  }
67 
69  virtual bool recreateObject(const DtUUID& lo, DtLoadScenarioData& data);
70 
71 protected:
73  virtual bool readOrderOfBattleFileFromZipFile(const DtScenario&, DtLoadScenarioData&);
74 
76  virtual bool readOrderOfBattleFile(const DtScenario&, DtLoadScenarioData&);
77 
79  virtual bool readOrderOfBattleFile(DtlInputStream*, DtLoadScenarioData&);
80 
82  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
83  const DtVariableBindingsList& variableBindings) override;
84 
86  virtual void reserveGlobalObjectIds(unsigned numToReserve);
87 
89  virtual DtEntityIdentifier findEntityIdentifier(DtlObjPtr mtlStream) const;
90 
93  virtual bool hasUUIDOrMarkingText(DtlObjPtr args, DtUUID&) const;
94 
95  virtual DtLocalObject* createObjectFromMemoryBuffer(const std::string& buffer);
96 
97  virtual void clearAllocatedProxies();
98 
99  virtual bool loadSimulationObjectGroupOrderOfBattleFromZipFile(const DtScenario& scenario, DtlObjPtr* retArgs, void* userData = 0);
100  virtual bool loadSimulationObjectGroupOrderOfBattle(const DtScenario& scenario, DtlObjPtr* retArgs, void* userData = 0);
101  virtual bool loadSimulationObjectGroupOrderOfBattle(DtlInputStream* fStream, DtlObjPtr* retArgs, void* userData = 0);
102 
105  virtual bool addObjectsReadyForSimulation(PendingObjectsInformation&);
106 
109  virtual bool ignoreImportObject(const DtEntityType&) const;
110  static void addIgnoreImportObject(const DtEntityType&);
111  static void removeIgnoreImportObject(const DtEntityType&);
113 
114 protected:
115  friend class CreateObjectCallback;
116 
120  virtual DtLocalObject* createAndInit(DtlObjPtr mtlStream, int flags, int force, const DtVector& geocentricOffsetLocation,
121  double offsetRotation = 0.);
122 
123  virtual bool finalizeObjectRead(DtLocalObject* newObject);
124 
125 protected:
129 
130  tbb::spin_mutex myFinalizeObjectMutex;
131  typedef std::map<DtUUID, DtVrfObjectLocalObjectFacade*> AllocatedProxies;
132 
133  tbb::spin_mutex myAllocatedProxiesMutex;
135 
137  std::vector<DtLocalObject*> myObjectsAdded;
138  static std::vector<DtEntityType> theIgnoreObjectsOnImport;
139 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
static std::vector< DtEntityType > theIgnoreObjectsOnImport
Definition: loadOrderOfBattleHandler.h:138
class DtLocalObjectManager:
Definition: localObjectManager.h:157
virtual bool loadScenarioPiece(const DtScenario &, void *userData=0, bool reinitializingScenario=false)=0
Creates a new scenario object from the given file. It is up to the caller to delete this scenario obj...
virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override=0
This method must be overridden by a subclass. Within this method, new instances of the DtReaderWriter...
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:131
Definition: vrfObjectLocalObjectFacade.h:63
std::vector< DtLocalObject * > myObjectsAdded
Definition: loadOrderOfBattleHandler.h:137
virtual DtLoadScenarioPieceHandler * clone() const override
Definition: loadOrderOfBattleHandler.h:64
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:127
#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:126
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
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:130
ObjectsAwaitingDiscovery myObjectsAwaitingDiscovery
Definition: loadOrderOfBattleHandler.h:136
tbb::spin_mutex myAllocatedProxiesMutex
Definition: loadOrderOfBattleHandler.h:133
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
const DtLoadScenarioData & loadOrderOfBattleData() const
Definition: loadOrderOfBattleHandler.h:59
AllocatedProxies myAllocatedProxies
Definition: loadOrderOfBattleHandler.h:134
DtLoadScenarioData myLoadOrderOfBattleUserData
Definition: loadOrderOfBattleHandler.h:128
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.
Definition: localObject.h:98

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)