VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
syncMatrixController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 #include <tbb/mutex.h>
14 
17 class DtRwSyncMatrixPlan;
19 class DtPlan;
20 
21 typedef std::map<DtUUID, boost::signals2::scoped_connection> SuperiorChangedCallbacksMap;
22 
26 {
27 public:
30  DtSyncMatrixController(const DtString& name,
31  DtLocalObject* owner,
32  DtSimulationServices* simManager,
33  DtComponentDescriptor* desc = 0,
34  DtReaderWriterRegistry* parentRegistry = 0);
35 
37  virtual ~DtSyncMatrixController();
38 
39  virtual bool init();
40 
43  virtual const char* type() const;
44 
45  virtual void preFirstTickInit();
46 
47  virtual void tick();
48 
52  static DtSimComponent * creator(const DtString& name,
53  DtLocalObject* owner,
54  DtSimulationServices* simManager,
55  DtComponentDescriptor* desc = 0,
56  DtReaderWriterRegistry* parentRegistry = 0);
57 
58 protected:
59 
60  virtual bool createPSR();
61 
62  static void syncMatrixRenameRequestCallback(const DtVrfObjectMessage * msg, void* usr);
63  virtual void processSyncMatrixRenameRequest(const DtVrfObjectMessage * msg);
64 
65  static void syncMatrixRemovePhaseRequestCallback(const DtVrfObjectMessage * msg, void* usr);
66  virtual void processSyncMatrixRemovePhaseRequest(const DtVrfObjectMessage * msg);
67 
68  static void syncMatrixInfoRequestCallback(const DtVrfObjectMessage * msg, void* usr);
69  virtual void processSyncMatrixInfoRequest(const DtVrfObjectMessage * msg);
70 
71  static void syncMatrixAddObjectsRequestCallback(const DtVrfObjectMessage * msg, void* usr);
72  virtual void processSyncMatrixAddObjectsRequest(const DtVrfObjectMessage * msg);
73 
74  static void syncMatrixRemoveObjectRequestCallback(const DtVrfObjectMessage * msg, void* usr);
75  virtual void processSyncMatrixRemoveObjectRequest(const DtVrfObjectMessage * msg);
76 
77  static void syncMatrixPlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
78  virtual void processSyncMatrixPlanRequest(const DtVrfObjectMessage * msg);
79 
80  static void syncMatrixSetPlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
81  virtual void processSyncMatrixSetPlanRequest(const DtVrfObjectMessage * msg);
82 
83  static void syncMatrixRemovePlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
84  virtual void processSyncMatrixRemovePlanRequest(const DtVrfObjectMessage * msg);
85 
86  static void syncMatrixPhaseInfoRequestCallback(const DtVrfObjectMessage * msg, void* usr);
87  virtual void processSyncMatrixPhaseInfoRequest(const DtVrfObjectMessage * msg);
88 
89  static void syncMatrixActivatePlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
90  virtual void processSyncMatrixActivatePlanRequest(const DtVrfObjectMessage * msg);
91 
92  static void planStatementMessageCallback(DtSimMessage* msg, void* usr);
93  virtual void processPlanStatementMessage(DtSimMessage* msg);
94 
96  virtual void sendSyncMatrixRenameResponse();
97 
99  virtual void sendSyncMatrixRemoveResponse();
100 
102  virtual void sendSyncMatrixRemovePhaseResponse(const DtString& phaseName);
103 
105  virtual void sendSyncMatrixInfoResponse();
106 
108  virtual void sendSyncMatrixObjectsListResponse(bool refreshPlans);
109 
111  virtual void sendSyncMatrixPhaseInfoResponse(const DtString& origName, int phaseIndex, DtRwSyncMatrixPhase* phase, bool endConditionSpecified = true);
112 
114  virtual void sendSyncMatrixMoveToPhase(const DtString& requestedPhase,
115  const DtString& previousPhase = "", bool previousPhaseCompleted = false);
116 
118  virtual void sendSyncMatrixPlanStatus(const DtRwSyncMatrixPlanList& planStatusList);
119 
122  virtual bool isObjectSuperior(const DtSimObjectReference object1, const DtSimObjectReference object2, bool direct = false);
123  virtual bool isObjectSuperior(const DtUUID& object1, const DtUUID& object2, bool direct = false);
124 
126  virtual void mergeRequestedObjects(const std::vector<DtUUID>& requestedObjects);
127 
129  virtual void executeObjectPlanInPhase(DtRwSyncMatrixPlan* planEntry);
130 
132  virtual void cancelObjectPlanInPhase(const DtRwSyncMatrixPlan* planEntry);
133 
137  virtual void removeObjectByUUID(const DtUUID& uuid, bool mergeSubordinates);
138 
139  virtual void processSimObjectDeleted(DtSimObjectReference object);
140  virtual void processSuperiorChanged(const DtSimObject* object, const DtUUID& oldSuperior, const DtUUID& newSuperior);
141 
142  virtual void executePhasePlans();
143  virtual void processPhasePlansStatus();
144 
145  virtual DtPlan* createAndInitPlan(const DtUUID& object);
146 
147  virtual void activatePlan(const DtUUID& uuid, const DtString& phaseName, bool activate);
148  virtual void activatePlan(DtRwSyncMatrixPlan* planEntry, bool activate);
149 
150  virtual void abandonPlan(const DtUUID& uuid);
151  virtual void registerToPlanStatus(const DtUUID& uuid);
152 
153  virtual void proceedToNextPhase();
154 
155  void initSuperiorChangedCallbacksMap();
156  void resetSuperiorChangedCallbacksMap();
157  void registerSuperiorChangedCallbacks();
158 
160  virtual void initPlanPhaseCallbacks();
161 
162 private:
163 
166 
169  DtSyncMatrixController & orig);
170 
173  const DtSyncMatrixController & orig);
174 
175 
176 protected:
177 
179 
180  boost::signals2::scoped_connection mySimObjectDeletedConnection;
181 
184  tbb::mutex myRemovalMutex;
185 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
class DtRwSyncMatrixPlan:
Definition: rwSyncMatrixPlan.h:23
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
virtual const char * type() const =0
This returns a string from compTypes.h, and identifies the type of component.
DtSyncMatrixControllerPSR * myProcessState
Definition: syncMatrixController.h:178
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
tbb::mutex myRemovalMutex
Definition: syncMatrixController.h:184
This class controls a synchronization matrix by assigning its objects with plans according to its pha...
Definition: syncMatrixController.h:25
virtual bool init() override
Calls setRadio()
File: simMsg.h.
Definition: simMessage.h:35
std::map< DtUUID, boost::signals2::scoped_connection > SuperiorChangedCallbacksMap
Definition: syncMatrixController.h:19
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
boost::signals2::scoped_connection mySimObjectDeletedConnection
Definition: syncMatrixController.h:180
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
class DtPlan:
Definition: plan.h:92
SuperiorChangedCallbacksMap mySuperiorChangedCallbacksMap
Definition: syncMatrixController.h:182
class DtRwSyncMatrixPhase:
Definition: rwSyncMatrixPhase.h:23
DtSyncMatrixControllerPSR is a process state repository which holds state variables for the DtSyncMat...
Definition: syncMatrixControllerPSR.h:20
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
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
bool mySuperiorChangedRegistrationIsComplete
Definition: syncMatrixController.h:183
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
This list stores entries of DtRwSyncMatrixPlan.
Definition: rwSyncMatrixPlanList.h:17

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)