VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
taskControllerComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 
13 #pragma once
14 
16 #include "vrftasks/simTaskState.h"
20 
21 
22 class DtSimManager;
23 class DtTaskMessage;
24 class DtSimMessage;
26 
27 typedef void (*DtTaskMessageCallbackFcn)(DtSimMessage * msg, void * usr,
29 
31 {
33  void* myUserData;
35 
49 {
50 
51 public:
52 
56  {
57  AcceptLevel_Accept = 0,
58  AcceptLevel_Partial = 1,
59  AcceptLevel_Error = 2,
60  AcceptLevel_NoAccept = 99
61  };
62 
69  DtSimulationServices* simServices,
70  DtComponentDescriptor* compDesc = nullptr,
71  DtReaderWriterRegistry* parentRegistry = nullptr);
72 
74  virtual ~DtTaskControllerComponent() override;
75 
77  virtual const char* type() const override = 0;
78 
91  virtual AcceptLevel acceptTask(const DtTaskMessage& task);
92 
101  virtual bool beginProcessingTask(const DtTaskMessage& task,
102  DtSimTaskStatePtr taskState);
103 
106  virtual void taskNotify(const DtSimTask & task) override {};
107 
109  virtual void setTasked(bool tasked);
112  virtual bool tasked() const;
114 
120  virtual bool showCurrentTaskInGui() const;
121 
123  virtual void setRadio(DtSimRadio * radio) override;
124 
125  virtual void registerTaskMsgCallbacks();
126 
136  virtual void addTaskProcessorCallback(const DtSimTaskMessageType& taskType, DtTaskMessageCallbackFcn fcn, void* usr);
137 
140  virtual void addTaskProcessorCallback(const DtSimTaskMessageType& taskType, DtMessageCallbackFcn fcn, void* usr);
141 
142 
144  virtual void removeTaskProcessorCallback(const DtSimTaskMessageType& taskType, DtMessageCallbackFcn fcn, void* usr);
145 
148  virtual void removeTaskProcessorCallback(const DtSimTaskMessageType& taskType, DtTaskMessageCallbackFcn fcn, void* usr);
149 
153  static void deprecatedTaskProcessorCallbackAdapter(DtSimMessage * msg, void * usr,
154  DtSimTaskStatePtr taskState);
155 
157  virtual bool taskActive(int taskId) const = 0;
158 
161  virtual bool clearTopLevelTasks() = 0;
162 
165  virtual void clearConflictingTopLevelTasks(const DtSimTaskMessageType& conflictType) = 0;
166 
168  virtual void clearTasksByType(const DtSimTaskMessageType& taskType) = 0;
169 
171  virtual void clearTaskById(int taskId) = 0;
172 
173  virtual DtSuspendedTaskInfo* suspendTaskById(int taskId) = 0;
174 
175  virtual DtSuspendedTaskInfo* suspendSubtaskById(int taskId, int subtaskId) = 0;
176 
179  virtual std::list<DtTaskMessage*> currentTaskMessages() const = 0;
180 
183  virtual DtTaskWithTaskStateListPtr topLevelTasks() const = 0;
184 
186  virtual void enable() override;
187 
191  virtual void disable() override;
192 
194  virtual void sendTaskCanceled(DtTaskMessage* taskMsg);
195 
199  virtual bool taskVisualizationsActive() const override;
200 
201 protected:
202 
205  virtual void suspendSubtasksOfTask(int taskId, DtSuspendedTaskInfo* suspendInfo);
206 
209  virtual void suspendSubtaskOfTask(int taskId, int subtaskId, DtSuspendedTaskInfo* suspendInfo);
210 
212  virtual DtSimTaskMessageType remapScriptId(const DtSimTaskMessageType&) const;
213 
214 protected:
215 
218  typedef std::pair<DtTaskMessageCallbackFcn, void*> DtTaskCallbackMapPair;
219  typedef std::map<DtSimTaskMessageType, DtTaskCallbackMapPair> DtTaskCallbackMap;
221 
224  std::list<DtTaskProcessorCallbackInfo*> myTaskProcessorCallbackInfoList;
225 
227 
228 private:
232 
235 
238  orig);
239 };
240 
void(* DtTaskMessageCallbackFcn)(DtSimMessage *msg, void *usr, DtSimTaskStatePtr taskState)
Definition: taskControllerComponent.h:27
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
virtual bool taskVisualizationsActive() const
Returns true if task visualizations are currently active for this component. Default behavior is to r...
Definition: simRadio.h:30
All the information about a single suspended task. This information should be sufficient to resume th...
Definition: suspendedTaskInfo.h:23
virtual void setRadio(DtSimRadio *radio)
virtual void enable() override
Enables the component and resends capable tasks and sets.
AcceptLevel
Levels that a task controller can accept a task it has registered for.
Definition: taskControllerComponent.h:55
DtMessageCallbackFcn myFunction
Definition: taskControllerComponent.h:32
std::map< DtSimTaskMessageType, DtTaskCallbackMapPair > DtTaskCallbackMap
Definition: taskControllerComponent.h:219
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
End User Description: DtTaskControllerComponent is the base class for all controllers that respond to...
Definition: taskControllerComponent.h:48
virtual const char * type() const override=0
This returns a string from compTypes.h, and identifies the type of component.
Definition: readerWriterRegistry.h:39
std::shared_ptr< DtSimTaskState > DtSimTaskStatePtr
Definition: taskAndTaskStateDefines.h:18
virtual void disable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
virtual DtSimTaskStatePtr taskState()
void * myUserData
Definition: taskControllerComponent.h:33
virtual void taskNotify(const DtSimTask &task) override
This is called to let us know when some other component receives a task In the case of this component...
Definition: taskControllerComponent.h:106
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
File: simMsg.h.
Definition: simMessage.h:35
Define constants for types of tasks, sets, admin messages, reports, and sim commands (all sent via ra...
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
Definition: taskControllerComponent.h:30
bool myTaskIsRunning
Definition: taskControllerComponent.h:226
DtSimTask is an abstract base class from which real tasks can derive. It manages the read/write capab...
Definition: simTask.h:30
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:137
std::list< DtTaskProcessorCallbackInfo * > myTaskProcessorCallbackInfoList
This list stores any DtTaskProcessorCallbackInfo allocated locally so that they can be deleted when t...
Definition: taskControllerComponent.h:224
struct DtTaskProcessorCallbackInfo DtTaskProcessorCallbackInfo
std::shared_ptr< DtTaskWithTaskStateList > DtTaskWithTaskStateListPtr
Definition: taskAndTaskStateDefines.h:27
DtTaskCallbackMap myTaskCallbackMap
Definition: taskControllerComponent.h:220
A DtTaskMsg is a DtRadioMsg with a pointer to a task. The type of the taskMsg is just the type of the...
Definition: taskMessage.h:21
std::pair< DtTaskMessageCallbackFcn, void * > DtTaskCallbackMapPair
This map stores callbacks that have been registered to processes various tasks. The map is indexed by...
Definition: taskControllerComponent.h:218
DtCallbackList< DtSimMessage * >::DtCallbackFunctionType DtMessageCallbackFcn
Message callback function signature.
Definition: messageExecutive.h:21
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)