VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
currentTasksAdminContent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
12 #include "vrftasks/adminContent.h"
13 #include <vlutil/vlString.h>
15 #include <list>
16 #include <vector>
19 
20 class DtSimTask;
21 class DtSetDataRequest;
22 
26 {
27  DtCurrentTaskData() {task = 0;}
29  task(orig.task), subtasks(orig.subtasks), status(orig.status), conflictingTaskIds(orig.conflictingTaskIds),
30  controller(orig.controller), taskId(orig.taskId) {};
31 
33  DtSimTask* task;
34  int taskId;
36 
37  std::list<DtCurrentTaskData> subtasks;
38 
43  int status;
44 
46  std::vector<DtSimTaskMessageType> conflictingTaskIds;
47 };
48 
52 {
55  set(orig.set), controller(orig.controller), setId(orig.setId) {};
56 
58  DtSetDataRequest* set;
59  int setId;
61 };
62 
66 
71 DT_DLL_vrftasks char *encode(const DtCurrentTaskData& val, char *buffer);
72 
76 DT_DLL_vrftasks const char *decode(DtCurrentTaskData& val, const char *buffer);
77 
78 
82 
87 DT_DLL_vrftasks char *encode(const DtCurrentScriptedSetData& val, char *buffer);
88 
92 DT_DLL_vrftasks const char *decode(DtCurrentScriptedSetData& val, const char *buffer);
93 
94 
102 {
103 public:
104  typedef std::list<DtCurrentTaskData> DtTaskList;
105  typedef std::list<DtCurrentScriptedSetData> DtScriptedSetList;
106 
109 
112 
116 
118  virtual ~DtCurrentTasksAdminContent() override;
119 
121  static DtAdminContent* create();
122 
124  virtual bool init() override;
125 
127  virtual const DtAdminContentMessageType& type() const override;
128 
131  virtual void addTaskToList(const DtSimTask* task, const std::vector<DtSimTaskMessageType>& conflictingTaskTypes, int taskId,
132  int status, const DtString& controller);
133 
135  virtual void addScriptedSetToList(const DtSetDataRequest* set, int taskId,
136  const DtString& controller);
137 
139  virtual void addSubtask(const DtSimTask* task, int subtaskId, int spawningTaskId, int status, const DtString& controller,
140  bool addIfNoParent = false);
141 
143  virtual void clearTaskList();
144 
146  virtual void clearScriptedSetsList();
147 
152  virtual const DtTaskList& taskList() const;
153 
158  virtual const DtScriptedSetList& scriptedSetList() const;
159 
163  virtual bool testTaskForConflict(const DtSimTaskMessageType& taskType) const;
164 
167  virtual DtAdminContent * clone() const override;
168 
170  virtual DtString stringRep() const override;
171 
173  virtual int netRepSize() const override;
174 
176  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
177 
179  virtual bool setToNet() override;
180 
182  virtual void resolveUnparentedSubtasks();
183 
185  virtual void clearUnparentedSubtasks();
186 
187 protected:
190  virtual void addUnparentedSubtask(const DtSimTask* task, int subtaskId, int spawningTaskId, int status, const DtString& controller);
191 
194  void clearTaskList(DtTaskList& taskList);
195 
197  virtual void clearAllTasks();
198 
202  void copyTaskList(const DtTaskList& taskList, DtTaskList& into);
203 
207  void copyScriptedSetList(const DtScriptedSetList& taskList, DtScriptedSetList& into);
208 
210  virtual DtString printTasksToString(const DtTaskList& tasks) const;
211  virtual DtString printSetsToString(const DtScriptedSetList& tasks) const;
212 
214  virtual void addTaskWithStatus(DtTaskList& list, const DtSimTask* task, int status, const std::vector<DtSimTaskMessageType>& conflictingTaskTypes,
215  int taskId, const DtString& controller);
216 
217 protected:
220 
222  typedef std::map<int, DtCurrentTaskData*> InternalTaskMap;
224 
226  {
228  int parentId;
230  int status;
232  };
233 
234  typedef std::vector<UnparentedSubtask> UnparentedSubtasks;
236 };
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Sets the contents of this set request based on the network buffer. Base class does nothing and return...
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
virtual int netRepSize() const
std::vector< DtSimTaskMessageType > conflictingTaskIds
The task types of all the tasks that conflict with the task.
Definition: currentTasksAdminContent.h:46
int status
The status of the task can be: 1 - Active 2 - Suspended 3 - Enabled to checking for reaction (if reac...
Definition: currentTasksAdminContent.h:43
virtual DtAdminContent * clone() const =0
Make a copy of this content. Returns a pointer to a newly created copy of this class. Derived classes must override this function to create and return an instance of the derived type.
int setId
Definition: currentTasksAdminContent.h:59
DtTaskList myTaskList
Definition: currentTasksAdminContent.h:218
Definition: vrfObjectMessageTypeTemplate.h:24
DtSimTask * task
Definition: currentTasksAdminContent.h:227
Structure holding the current task information for one of the current tasks for an entity...
Definition: currentTasksAdminContent.h:25
DtCurrentScriptedSetData()
Definition: currentTasksAdminContent.h:53
int status
Definition: currentTasksAdminContent.h:230
DtString controller
Definition: currentTasksAdminContent.h:60
DtCurrentTaskData()
Definition: currentTasksAdminContent.h:27
InternalTaskMap myInternalTaskMap
Definition: currentTasksAdminContent.h:223
int parentId
Definition: currentTasksAdminContent.h:228
UnparentedSubtasks myUnparentedSubtasks
Definition: currentTasksAdminContent.h:235
DtSetDataRequest is an abstract base class from which real setDataRequests can derive. It manages the read/write capability; derived classes need only use and register read/writatble data types for derived information.
Definition: setDataRequest.h:41
const DtAdminContent & operator=(const DtAdminContent &orig)
assignment operator; same as copy costructor.
DtCurrentTaskData(const DtCurrentTaskData &orig)
Definition: currentTasksAdminContent.h:28
int taskId
Definition: currentTasksAdminContent.h:34
int subtaskId
Definition: currentTasksAdminContent.h:229
DtString controller
Definition: currentTasksAdminContent.h:231
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
DtScriptedSetList myScriptedSetList
Definition: currentTasksAdminContent.h:219
std::list< DtCurrentTaskData > DtTaskList
Definition: currentTasksAdminContent.h:104
#define DT_DLL_vrftasks
This file is used to determine how to build.
Definition: vrftasksDefines.h:26
std::vector< UnparentedSubtask > UnparentedSubtasks
Definition: currentTasksAdminContent.h:234
virtual bool init()
Base class init does nothing, but this will be called by create, in case any other deriving class nee...
Admin content that is used to send the current tasks status from a specific entity. This message is sent in response to a DtRequstCurrentTasksAdminContent or a subscription to the current task status using the same message. The current task status is a list of all the currently executing top level tasks that an entity has.
Definition: currentTasksAdminContent.h:101
DtAdminContent.
Definition: adminContent.h:23
virtual const DtAdminContentMessageType & type() const =0
DtString controller
Definition: currentTasksAdminContent.h:35
DtSimTask is an abstract base class from which real tasks can derive. It manages the read/write capab...
Definition: simTask.h:30
std::list< DtCurrentTaskData > subtasks
Definition: currentTasksAdminContent.h:37
Definition: currentTasksAdminContent.h:225
virtual bool setToNet()
Sets netRep buffer to the contents of this set request. Base class does nothing and returns true...
Structure holding the current set information for one of the current scripted sets for an entity...
Definition: currentTasksAdminContent.h:51
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
virtual DtString stringRep() const =0
Get a readable string representation of this content. Derived classes must implement this function...
DtCurrentScriptedSetData(const DtCurrentScriptedSetData &orig)
Definition: currentTasksAdminContent.h:54
std::map< int, DtCurrentTaskData * > InternalTaskMap
Internal map that keeps track of tasks such that when adding a subtask it can be added efficiently...
Definition: currentTasksAdminContent.h:222
std::list< DtCurrentScriptedSetData > DtScriptedSetList
Definition: currentTasksAdminContent.h:105

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)