LibCT 2.0
|
00001 // ------------------------------------------------------------------ 00012 #ifndef _LIBCT_EVENTMANAGER_H 00013 #define _LIBCT_EVENTMANAGER_H 00014 00015 #include <map> 00016 00017 namespace LibCT 00018 { 00020 class EventType; 00021 00022 typedef std::map<std::string, EventType*> EventList; 00023 typedef std::pair<std::string, EventType*> EventPair; 00024 00026 class EventManager 00027 { 00028 public: 00031 static EventManager* GetInstance() 00032 { 00033 static EventManager instance; 00034 return &instance; 00035 } 00036 00038 void Initialise(); 00039 00041 void Destroy(); 00042 00045 bool IsInitialised() const; 00046 00048 void RegisterEvent( 00049 const std::string& eventName 00050 ); 00051 00053 void UnregisterEvent( 00054 const std::string& eventName 00055 ); 00056 00059 EventType* GetEvent( 00060 const std::string& eventName 00061 ); 00062 00065 const EventList* GetEventList() const; 00066 00067 private: 00068 bool m_Initialised; 00069 EventList m_EventList; 00070 00072 EventManager() {} 00073 00075 ~EventManager() {} 00076 00078 EventManager(const EventManager&); 00079 00081 EventManager& operator=(const EventManager&); 00082 }; 00083 } 00084 00085 #endif // _LIBCT_EVENTMANAGER_H