Version: 0.6.0
tskmngr.h
1 /******************************************************************************
2  * Project: wxGIS (Task Manager)
3  * Purpose: Task manager class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012-2013 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 
22 #pragma once
23 
24 #include "wxgis/base.h"
25 #include "wxgis/core/config.h"
26 #include "wxgis/core/app.h"
27 #include "wxgis/tskmngr_app/net.h"
28 
29 #include <wx/ffile.h>
30 #include <wx/hashmap.h>
31 
32 #define TSKDIR wxT("tasks")
33 
34 class wxGISTaskCategory;
35 WX_DECLARE_STRING_HASH_MAP(wxGISTaskCategory*, wxGISTaskCategoryMap);
36 
42 class wxGISTaskManager :
43  public wxObject,
44  public INetEventProcessor
45 {
46  DECLARE_CLASS(wxGISTaskManager)
47  friend class wxGISTaskCategory;
48 public:
49  wxGISTaskManager( void );
50  virtual ~wxGISTaskManager(void);
51  virtual void SetExitState(wxGISNetCommandState nExitState);
52  //void LoadTasks(const wxString & sPath);
53  virtual bool Init(void);
54  virtual void Exit(void);
55  virtual void SendNetMessage(const wxNetMessage &msg, int nUserId = wxNOT_FOUND);
56  virtual int GetExecTaskCount(void) const;
57  virtual int GetMaxExecTaskCount(void) const;
58  virtual void SetMaxExecTaskCount(int nMaxExecTasks);
59  virtual void OnCategoryExecutionFinished(const wxGISTaskCategory* pCat);
60  //INetEventProcessor
61  virtual void ProcessNetEvent(wxGISNetEvent& event);
62 protected:
63  virtual void LoadCategories(const wxString &sPathToCategories);
64  virtual void ProcessNetCommand(const wxNetMessage &msg, int nUserId);
65  virtual void OnExit(void);
66  virtual wxJSONValue GetChildrenAsJSON(const wxJSONValue &val);
67  virtual wxJSONValue GetParamsAsJSON(const wxJSONValue &val);
68  virtual wxString GetNewStorePath(const wxString &sAddToName, const wxString &sSubDir = wxEmptyString);
69  static wxString ReplaceForbiddenCharsInFileName(const wxString &name, const wxString &ch = wxT("_") );
70 protected:
71  wxGISLocalNetworkService* m_pNetworkService;
72  wxGISNetCommandState m_nExitState;
73  wxString m_sUserConfigDir;
74  wxGISTaskCategoryMap m_omCategories;
75  int m_nMaxExecTasks;
76  bool m_bExitState;
77 };
Definition: netevent.h:66
The JSON value class implementation.
Definition: jsonval.h:91
Task Manager Server communicate class.
Definition: tskmngr.h:89
Definition: net.h:33
Definition: message.h:42
Definition: task.h:252
Definition: netevent.h:34