diff options
author | chai <chaifix@163.com> | 2018-07-27 00:01:34 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-27 00:01:34 +0800 |
commit | b855ebb91ad8d97617ec1aa418b4add84670a07d (patch) | |
tree | b11847a1879a2582c9cfd380074ad4c70f17a1a8 /src/libjin/Common/Subsystem.h | |
parent | 1a882936e91826e4d69584745e16a79650272015 (diff) |
*change name
Diffstat (limited to 'src/libjin/Common/Subsystem.h')
-rw-r--r-- | src/libjin/Common/Subsystem.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/libjin/Common/Subsystem.h b/src/libjin/Common/Subsystem.h new file mode 100644 index 0000000..35563da --- /dev/null +++ b/src/libjin/Common/Subsystem.h @@ -0,0 +1,42 @@ +#ifndef __JIN_COMMON_SUBSYSTEM_H +#define __JIN_COMMON_SUBSYSTEM_H + +#include "singleton.h" +#include "../utils/macros.h" + +namespace jin +{ + + template<class System> + class Subsystem : public Singleton<System> + { + public: + struct Setting {}; + typedef Setting SettingBase; + + void init(const SettingBase* setting) + { + CALLONCE(initSystem(setting)); + } + + void quit() + { + CALLONCE(quitSystem()); + destroy(); + } + + protected: + + Subsystem() {}; + virtual ~Subsystem() {}; + + SINGLETON(System); + + virtual onlyonce bool initSystem(const Setting* setting) = 0; + virtual onlyonce void quitSystem() = 0; + + }; + +} + +#endif
\ No newline at end of file |