-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdispatchmanager.h
43 lines (32 loc) · 1.28 KB
/
dispatchmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright: (C) 2016 ESIMTEK ALL RIGHTS RESERVED
// author: Yonghua Zheng
#ifndef __DISPATCHCONTAINER_H
#define __DISPATCHCONTAINER_H
#include <map>
#include "messagedispatch.h"
#include "mutex.h"
typedef std::map<int, MessageDispatch*> MessageDispatchContainer;
class DispatchManager
{
private:
MessageDispatchContainer* container;
MessageDispatch* loop;
Mutex mutex;
static DispatchManager* singleton;
DispatchManager();
public:
virtual ~DispatchManager();
bool registerr(int id, MessageDispatch* dispatch);
bool unregister(int id);
bool post(int id, const char* message);
bool get(int id, char* message, int length);
static void Instantiate();
static void Dispose();
static bool Register(int id, MessageDispatch* dispatch);
static bool Unregister(int id);
static bool Post(int id, const char* message);
static bool Get(int id, char* message, int length);
static const int main_id;
static const int modemmanager_id;
};
#endif