24 #include "wxgis/tskmngr_app/tskmngr.h"
25 #include "wxgis/core/process.h"
26 #include "wxgis/core/json/jsonval.h"
28 #include <wx/dynarray.h>
29 #include <wx/thread.h>
30 #define SUBTSKDIR wxT("subtasks")
33 WX_DECLARE_HASH_MAP(
int,
wxGISTaskBase*, wxIntegerHash, wxIntegerEqual, wxGISTaskMap );
50 virtual wxString GetName() const;
51 virtual
int GetId(
void) const;
52 virtual
int GetNewId(
void);
54 virtual
bool HasName(const wxString &sName) const;
56 virtual
void OnDestroy(
void);
57 virtual
void StartNextQueredTask(
void);
59 virtual wxString GetNewStorePath(const wxString &sAddToName, const wxString &sSubDir = wxEmptyString );
60 virtual wxString GetStorePath() const;
61 virtual
bool Save(
void);
62 virtual
bool Load(
void) = 0;
64 virtual
void SendNetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState, wxGISMessagePriority ePrio, const
wxJSONValue &val, const wxString &sMsg,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND) = 0;
65 virtual
void NetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState, const
wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND) = 0;
66 virtual
void NetCommand(wxGISNetCommandState eCmdState, const
wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND) = 0;
69 virtual
void ClearTasks(
void);
78 int m_nId, m_nTaskCounter;
79 wxString m_sName, m_sStoragePath;
80 wxString m_sLastError;
81 wxGISTaskMap m_omSubTasks;
86 WX_DEFINE_ARRAY(wxGISTask *, wxGISQueredTasksArray);
99 DECLARE_CLASS(wxGISTask)
101 wxGISTask(wxGISTaskBase* pParentTask, const wxString &sPath);
102 virtual ~wxGISTask(
void);
103 virtual
int GetGroupId(
void) const;
104 virtual
bool Load(
void);
105 virtual
bool Delete(
long nMessageId = -2,
int nUserId = -2);
106 virtual
void GetChildren(
long nMessageId,
int nUserId);
107 virtual
bool StartTask(
long nMessageId,
int nUserId);
108 virtual
bool StopTask(
long nMessageId,
int nUserId);
109 virtual
bool ChangeTask(const
wxJSONValue& TaskVal,
long nMessageId,
int nUserId);
110 virtual
bool Create(const
wxJSONValue& TaskConfig);
112 virtual
long GetCommonPriority(
void);
116 virtual
void OnDestroy(
void);
117 virtual
void OnStart(
void);
118 virtual
void OnStop(
void);
119 virtual
void OnTerminate(
int pid,
int status);
120 virtual
int GetRunningTaskCount(
void) const;
121 virtual
void GetQueredTasks(wxGISQueredTasksArray &oaTasks);
122 virtual
void ChangeTask(
void);
123 virtual
void ChangeTaskMsg(wxGISEnumMessageType nType, const wxString &sInfoData);
126 virtual
long Execute(
void);
127 virtual
bool IsGroupIdExecuting(
int nGroupId) const;
128 virtual
void AddInfo(wxGISEnumMessageType nType, const wxString &sInfoData);
130 virtual
void UpdatePercent(const wxString &sPercentData);
133 virtual
bool Start(
void);
140 wxGISEnumMessageType m_nType;
143 virtual void SendNetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState, wxGISMessagePriority ePrio,
const wxJSONValue &val,
const wxString &sMsg,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
144 virtual void NetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState,
const wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
145 virtual void NetCommand(wxGISNetCommandState eCmdState,
const wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
149 wxString m_sDescription;
151 wxULongLong m_nVolume;
152 wxString m_sExecPath;
156 wxDateTime m_dtCreated;
174 virtual
bool Load(
void);
175 virtual
void SetMaxExecTaskCount(
int nMaxExecTasks);
176 virtual wxString GetNewStorePath(const wxString &sAddToName, const wxString &sSubDir = wxEmptyString );
177 virtual
bool Save(
void);
178 virtual
void GetChildren(
long nMessageId,
int nUserId);
179 virtual
bool AddTask(const
wxJSONValue &TaskConfig,
long nMessageId,
int nUserId);
181 virtual
bool IsGroupIdExecuting(
int nGroupId) const;
182 virtual
int GetRunningTaskCount(
void) const;
183 virtual
void GetQueredTasks(wxGISQueredTasksArray &oaTasks);
191 virtual
void StartNextQueredTask(
void);
192 virtual
void SendNetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState, wxGISMessagePriority ePrio, const
wxJSONValue &val, const wxString &sMsg,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
193 virtual
void NetMessage(wxGISNetCommand eCmd, wxGISNetCommandState eCmdState, const
wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
194 virtual
void NetCommand(wxGISNetCommandState eCmdState, const
wxJSONValue &val,
long nMessageId = wxNOT_FOUND,
int nUserId = wxNOT_FOUND);
197 virtual
wxGISTask* const GetQueredTask(
void);
201 wxCriticalSection m_CritSect;
The JSON value class implementation.
Definition: jsonval.h:91
Task Manager Server communicate class.
Definition: tskmngr.h:89
The process class which stores the application execution data.
Definition: process.h:43