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() override;
38 
39  virtual bool init() override;
40 
43  virtual const char* type() const override;
44 
45  virtual void preFirstTickInit() override;
46 
47  virtual void tick() override;
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...
DtSyncMatrixControllerPSR * myProcessState
Definition: syncMatrixController.h:178
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
virtual const char * type() const override=0
This returns a string from compTypes.h, and identifies the type of component.
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:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
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:80
bool mySuperiorChangedRegistrationIsComplete
Definition: syncMatrixController.h:183
A locally simulated VRF object.
Definition: localObject.h:98
This list stores entries of DtRwSyncMatrixPlan.
Definition: rwSyncMatrixPlanList.h:17

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)