* Add #ifdef WIN32 to make main.cpp compile on linux.
[matthijs/ABM2.git] / ABM2 / Engine / Kernel.h
1 // Kernel.h: interface for the CKernel class.\r
2 //\r
3 //////////////////////////////////////////////////////////////////////\r
4 \r
5 #if !defined(AFX_KERNEL_H__4E822B7D_1078_4F70_BC8F_3BB4F83ED0AF__INCLUDED_)\r
6 #define AFX_KERNEL_H__4E822B7D_1078_4F70_BC8F_3BB4F83ED0AF__INCLUDED_\r
7 \r
8 #if _MSC_VER > 1000\r
9 #pragma once\r
10 #endif // _MSC_VER > 1000\r
11 \r
12 #include "singleton.h"\r
13 \r
14 \r
15 class CClient;\r
16 class CServer;\r
17 \r
18 class ITask;\r
19 \r
20 class CKernel : public Singleton<CKernel>\r
21 {\r
22 public:\r
23         CKernel();\r
24         virtual ~CKernel();\r
25 \r
26         int Execute();\r
27 \r
28 #ifdef WIN32\r
29         bool AddTask(CMMPointer<ITask> &t);\r
30 #else\r
31         bool AddTask(CMMPointer<ITask> t);\r
32 #endif\r
33         void SuspendTask(CMMPointer<ITask> &t);\r
34         void ResumeTask(CMMPointer<ITask> &t);\r
35         void RemoveTask(CMMPointer<ITask> &t);\r
36         void KillAllTasks();\r
37 \r
38 protected:\r
39         std::list< CMMPointer<ITask> > taskList;\r
40         std::list< CMMPointer<ITask> > pausedTaskList;\r
41 };\r
42 \r
43 class ITask : public IMMObject\r
44 {\r
45 public:\r
46         ITask(){canKill=false;priority=5000;}\r
47         virtual bool Start()=0;\r
48         virtual void OnSuspend(){};\r
49         virtual void Update()=0;\r
50         virtual void OnResume(){};\r
51         virtual void Stop()=0;\r
52 \r
53         bool canKill;\r
54         long priority;\r
55 };\r
56 \r
57 #endif // !defined(AFX_KERNEL_H__4E822B7D_1078_4F70_BC8F_3BB4F83ED0AF__INCLUDED_)\r