-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjectManager.h
44 lines (32 loc) · 976 Bytes
/
ObjectManager.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
#ifndef BaseLib_ObjectManager_h_Included
#define BaseLib_ObjectManager_h_Included
#include"BaseLib/CommonDefines.h"
#include"BaseLib/Mutex.h"
#include"BaseLib/Thread.h"
#include"BaseLib/Exception.h"
#include"BaseLib/Export.h"
namespace BaseLib
{
class ObjectBase;
class DLL_STATE ObjectManager : public Thread
{
private:
ObjectManager(std::string name = std::string("BaseLib.Manager.Object"));
~ObjectManager();
public:
static ObjectManager* createObjectManager() throw();
static ObjectManager* getObjectManager();
public:
bool AddObject(ObjectBase *base) throw();
bool RemoveObject(ObjectBase *base) throw();
ObjectBase* GetObject(const std::string &objectName) const throw();
private:
virtual void run();
private:
static ObjectManager *objectManager_;
typedef std::set<ObjectBase*> SetObjectBase;
SetObjectBase setObjectBase_;
mutable Mutex managerMutex_;
};
}; // namespace ObjectManager
#endif // BaseLib_ObjectManager_h_Included