hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCETaskRequest.hpp
Go to the documentation of this file.
1 
14 #ifndef DRCE_TASK_REQUEST_HPP
15 #define DRCE_TASK_REQUEST_HPP
16 
17 #include "JsonSerializable.hpp"
18 #include "DRCEJsonMessageConst.hpp"
19 
20 namespace HCE
21 {
22 namespace drce
23 {
24 //-----------------------------------------------------------------------------
26 {
27 public:
28  enum TaskState
29  {
30  FINISHED=0, // 0 – finished,
31  IN_PROGRESS=1, // 1 – in progress,
32  SET_AS_NEW=2, // 2 – set as new,
33  NOT_FOUND=3, // 3 – not found,
34  TERMINATED=4, // 4 – terminated before normal finish,
35  CRASHED=5, // 5 – crashed
36  NOT_SET_AS_NEW=6, // 6 – not set as new cause to limits of system resources (CPU, RAM, Disk, threads, processes, etc)
37  UNDEFINED=7, // 7 – undefined
38  QUEUED_TO_RUN=8, // 8 – queued to run
39  DELETED=9, // 9 – deleted
40  BUSY=10, // 10 – busy
41  TERMINATED_BY_TTL=11 // 11 - task was terminated by TTL reason (internal event)
42  };
43 
45  {
53  };
54 
55  explicit DRCETaskRequest(DRCETaskRequest::RequestType requestType_=DRCETaskRequest::RequestType::rtSetTaskExecute)
57  virtual ~DRCETaskRequest(void) {}
58 
59  virtual bool serialize(std::string& json) {return false; }
60  virtual bool unserialize(const std::string& json) {return false;}
61 
62  void setTaskId(unsigned int taskId_) {taskId=taskId_;}
63  unsigned int getTaskId(void) const {return taskId;}
64 
65  void setParentTaskId(unsigned int parentTaskId_) {parentTaskId=parentTaskId_;}
66  unsigned int getParentTaskId(void) const {return parentTaskId;}
67 
68  void setTaskState(TaskState taskState_) {taskState=taskState_;}
69  TaskState getTaskState(void) const {return taskState;}
70 
71  void setRequestType(RequestType requestType_) {requestType=requestType_;}
72  RequestType getRequestType(void) const {return requestType;}
73 
74 protected:
75  unsigned int taskId;
76  unsigned int parentTaskId;
79 };
80 //-----------------------------------------------------------------------------
81 //-----------------------------------------------------------------------------
82 } // end namespace drce
83 } // end namespace HCE
84 
85 #endif // DRCE_TASK_REQUEST_HPP