aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/common')
-rw-r--r--src/libjin/common/singleton.h6
-rw-r--r--src/libjin/common/subsystem.h6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libjin/common/singleton.h b/src/libjin/common/singleton.h
index e6326b2..a6c7d6d 100644
--- a/src/libjin/common/singleton.h
+++ b/src/libjin/common/singleton.h
@@ -21,7 +21,7 @@ namespace jin
protected:
Singleton() {};
virtual ~Singleton() {};
- private:
+ private:
Singleton(const Singleton&);
Singleton& operator = (const Singleton&);
@@ -29,6 +29,10 @@ namespace jin
};
template<class T> T* Singleton<T>::_instance = nullptr;
+
+#define SINGLETON(T) \
+ friend Singleton<T>
+
}
#endif \ No newline at end of file
diff --git a/src/libjin/common/subsystem.h b/src/libjin/common/subsystem.h
index 55b0f0d..90e8570 100644
--- a/src/libjin/common/subsystem.h
+++ b/src/libjin/common/subsystem.h
@@ -16,7 +16,7 @@ namespace jin
void init(const SettingBase* setting)
{
- CallOnce(initSystem(setting));
+ CALLONCE(initSystem(setting));
}
void quit()
@@ -26,11 +26,15 @@ namespace jin
}
protected:
+
Subsystem() {};
virtual ~Subsystem() {};
+ SINGLETON(System);
+
virtual bool initSystem(const Setting* setting) = 0;
virtual void quitSystem() = 0;
+
};
}