VR-Forces 5.0.2 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 
16 class DtRwSyncMatrixPlan;
18 class DtPlan;
19 
20 typedef std::map<DtUUID, boost::signals2::scoped_connection> SuperiorChangedCallbacksMap;
21 
25 {
26 public:
29  DtSyncMatrixController(const DtString& name,
30  DtLocalObject* owner,
31  DtSimulationServices* simManager,
32  DtComponentDescriptor* desc = 0,
33  DtReaderWriterRegistry* parentRegistry = 0);
34 
36  virtual ~DtSyncMatrixController();
37 
38  virtual bool init();
39 
42  virtual const char* type() const;
43 
44  virtual void preFirstTickInit();
45 
46  virtual void tick();
47 
51  static DtSimComponent * creator(const DtString& name,
52  DtLocalObject* owner,
53  DtSimulationServices* simManager,
54  DtComponentDescriptor* desc = 0,
55  DtReaderWriterRegistry* parentRegistry = 0);
56 
57 protected:
58 
59  virtual bool createPSR();
60 
61  static void syncMatrixRenameRequestCallback(const DtVrfObjectMessage * msg, void* usr);
62  virtual void processSyncMatrixRenameRequest(const DtVrfObjectMessage * msg);
63 
64  static void syncMatrixRemovePhaseRequestCallback(const DtVrfObjectMessage * msg, void* usr);
65  virtual void processSyncMatrixRemovePhaseRequest(const DtVrfObjectMessage * msg);
66 
67  static void syncMatrixInfoRequestCallback(const DtVrfObjectMessage * msg, void* usr);
68  virtual void processSyncMatrixInfoRequest(const DtVrfObjectMessage * msg);
69 
70  static void syncMatrixAddObjectsRequestCallback(const DtVrfObjectMessage * msg, void* usr);
71  virtual void processSyncMatrixAddObjectsRequest(const DtVrfObjectMessage * msg);
72 
73  static void syncMatrixRemoveObjectRequestCallback(const DtVrfObjectMessage * msg, void* usr);
74  virtual void processSyncMatrixRemoveObjectRequest(const DtVrfObjectMessage * msg);
75 
76  static void syncMatrixPlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
77  virtual void processSyncMatrixPlanRequest(const DtVrfObjectMessage * msg);
78 
79  static void syncMatrixSetPlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
80  virtual void processSyncMatrixSetPlanRequest(const DtVrfObjectMessage * msg);
81 
82  static void syncMatrixRemovePlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
83  virtual void processSyncMatrixRemovePlanRequest(const DtVrfObjectMessage * msg);
84 
85  static void syncMatrixPhaseInfoRequestCallback(const DtVrfObjectMessage * msg, void* usr);
86  virtual void processSyncMatrixPhaseInfoRequest(const DtVrfObjectMessage * msg);
87 
88  static void syncMatrixActivatePlanRequestCallback(const DtVrfObjectMessage * msg, void* usr);
89  virtual void processSyncMatrixActivatePlanRequest(const DtVrfObjectMessage * msg);
90 
91  static void planStatementMessageCallback(DtSimMessage* msg, void* usr);
92  virtual void processPlanStatementMessage(DtSimMessage* msg);
93 
95  virtual void sendSyncMatrixRenameResponse();
96 
98  virtual void sendSyncMatrixRemoveResponse();
99 
101  virtual void sendSyncMatrixRemovePhaseResponse(const DtString& phaseName);
102 
104  virtual void sendSyncMatrixInfoResponse();
105 
107  virtual void sendSyncMatrixObjectsListResponse(bool refreshPlans);
108 
110  virtual void sendSyncMatrixPhaseInfoResponse(const DtString& origName, int phaseIndex, DtRwSyncMatrixPhase* phase, bool endConditionSpecified = true);
111 
113  virtual void sendSyncMatrixMoveToPhase(const DtString& requestedPhase,
114  const DtString& previousPhase = "", bool previousPhaseCompleted = false);
115 
117  virtual void sendSyncMatrixPlanStatus(const DtRwSyncMatrixPlanList& planStatusList);
118 
121  virtual bool isObjectSuperior(const DtSimObjectReference object1, const DtSimObjectReference object2, bool direct = false);
122  virtual bool isObjectSuperior(const DtUUID& object1, const DtUUID& object2, bool direct = false);
123 
125  virtual void mergeRequestedObjects(const std::vector<DtUUID>& requestedObjects);
126 
128  virtual void executeObjectPlanInPhase(DtRwSyncMatrixPlan* planEntry);
129 
131  virtual void cancelObjectPlanInPhase(const DtRwSyncMatrixPlan* planEntry);
132 
136  virtual void removeObjectByUUID(const DtUUID& uuid, bool mergeSubordinates);
137 
138  virtual void processSimObjectDeleted(DtSimObjectReference object);
139  virtual void processSuperiorChanged(const DtSimObject* object, const DtUUID& oldSuperior, const DtUUID& newSuperior);
140 
141  virtual void executePhasePlans();
142  virtual void processPhasePlansStatus();
143 
144  virtual DtPlan* createAndInitPlan(const DtUUID& object);
145 
146  virtual void activatePlan(const DtUUID& uuid, const DtString& phaseName, bool activate);
147  virtual void activatePlan(DtRwSyncMatrixPlan* planEntry, bool activate);
148 
149  virtual void abandonPlan(const DtUUID& uuid);
150  virtual void registerToPlanStatus(const DtUUID& uuid);
151 
152  virtual void proceedToNextPhase();
153 
154  void initSuperiorChangedCallbacksMap();
155  void resetSuperiorChangedCallbacksMap();
156  void registerSuperiorChangedCallbacks();
157 
159  virtual void initPlanPhaseCallbacks();
160 
161 private:
162 
165 
168  DtSyncMatrixController & orig);
169 
172  const DtSyncMatrixController & orig);
173 
174 
175 protected:
176 
178 
179  boost::signals2::scoped_connection mySimObjectDeletedConnection;
180 
183 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
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:177
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
virtual bool init()
Calls setRadio()
This class controls a synchronization matrix by assigning its objects with plans according to its pha...
Definition: syncMatrixController.h:24
File: simMsg.h.
Definition: simMessage.h:35
std::map< DtUUID, boost::signals2::scoped_connection > SuperiorChangedCallbacksMap
Definition: syncMatrixController.h:18
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:179
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:181
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:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
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
bool mySuperiorChangedRegistrationIsComplete
Definition: syncMatrixController.h:182
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)