8 #ifndef SCARAB_SINGLETON_HH_ 9 #define SCARAB_SINGLETON_HH_ 24 #define allow_singleton_access( class_name ) \ 25 friend class scarab::singleton< class_name >; \ 26 friend class scarab::destroyer< class_name >; 42 template<
class x_type >
49 template<
class... x_args >
70 template<
class x_type >
73 template<
class x_type >
76 template<
class x_type >
79 template<
class x_type >
84 std::unique_lock< std::mutex > t_lock(
f_mutex );
90 template<
class x_type >
95 std::unique_lock< std::mutex > t_lock(
f_mutex );
101 template<
class x_type >
102 template<
class... x_args >
107 throw error() <<
"Instance already exists; create_instance can only be called before the instance exists";
109 std::unique_lock< std::mutex > t_lock(
f_mutex );
115 template<
class x_type >
125 template<
class x_type >
136 template<
class x_type >
140 template<
class x_type >
void set_doomed(XDoomed *)
static void kill_instance()
static void construct_instance()
static x_type * f_instance
static destroyer< x_type > f_destroyer
static x_type * get_instance()
static x_type * create_instance(x_args... args)
Base class that turns a class into a singleton.
static void delete_instance()
static std::mutex f_mutex