00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00049 #ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_STATIC_INITIALISERS
00050 #define STLSOFT_INCL_STLSOFT_UTIL_HPP_STATIC_INITIALISERS
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define STLSOFT_VER_STLSOFT_UTIL_HPP_STATIC_INITIALISERS_MAJOR 4
00054 # define STLSOFT_VER_STLSOFT_UTIL_HPP_STATIC_INITIALISERS_MINOR 0
00055 # define STLSOFT_VER_STLSOFT_UTIL_HPP_STATIC_INITIALISERS_REVISION 1
00056 # define STLSOFT_VER_STLSOFT_UTIL_HPP_STATIC_INITIALISERS_EDIT 217
00057 #endif
00058
00059
00060
00061
00062
00063 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00064 # include <stlsoft/stlsoft.h>
00065 #endif
00066
00067
00068
00069
00070
00071 #ifndef _STLSOFT_NO_NAMESPACE
00072 namespace stlsoft
00073 {
00074 #endif
00075
00076
00077
00078
00079
00080 #if 0
00081 class method_constructor
00082 {
00083 public:
00084 template<ss_typename_param_k T>
00085 method_constructor(T const& t, void (T::*const fn)())
00086 {
00087 (t.*fn)();
00088 }
00089 template< ss_typename_param_k T
00090 , ss_typename_param_k R
00091 >
00092 method_constructor(T const& t, R (T::*const fn)())
00093 {
00094 (t.*fn)();
00095 }
00096 };
00097 #endif
00098
00106 class static_initialiser
00107 {
00108 public:
00109 typedef static_initialiser class_type;
00110
00113 public:
00114 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00115 template <ss_typename_param_k T>
00116 static_initialiser(T const& )
00117 {}
00118 template <ss_typename_param_k T>
00119 static_initialiser(T const* )
00120 {}
00121 #else
00122 static_initialiser(int )
00123 {}
00124 static_initialiser(void const* )
00125 {}
00126 #endif // STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00128
00131 private:
00132 static_initialiser(class_type const&);
00133 static_initialiser& operator =(class_type const&);
00134
00135 #ifndef new
00136 # ifdef STLSOFT_COMPILER_IS_COMO
00137 void *operator new(ss_size_t) stlsoft_throw_0()
00138 {
00139 return 0;
00140 }
00141 # else
00142 void *operator new(ss_size_t) stlsoft_throw_0();
00143 # endif
00144 #endif
00145 void operator delete(void*)
00146 {}
00148 };
00149
00155 class api_constructor
00156 {
00159 public:
00160 api_constructor(void (*pfnInit)(), void (*pfnUninit)())
00161 : m_pfnUninit(pfnUninit)
00162 {
00163 if(NULL != pfnInit)
00164 {
00165 (*pfnInit)();
00166 }
00167 }
00168 ~api_constructor() stlsoft_throw_0()
00169 {
00170 if(NULL != m_pfnUninit)
00171 {
00172 (*m_pfnUninit)();
00173 }
00174 }
00176
00179 private:
00180 void (*m_pfnUninit)(void);
00182
00185 private:
00186 api_constructor(api_constructor const&);
00187 api_constructor& operator =(api_constructor const&);
00188
00189 #ifndef new
00190 # ifdef STLSOFT_COMPILER_IS_COMO
00191 void *operator new(ss_size_t) stlsoft_throw_0()
00192 {
00193 return 0;
00194 }
00195 # else
00196 void *operator new(ss_size_t) stlsoft_throw_0();
00197 # endif
00198 #endif
00199 void operator delete(void*)
00200 {}
00202 };
00203
00209 template <ss_typename_param_k T>
00210 class class_constructor
00211 : protected api_constructor
00212 {
00215 public:
00216 typedef void (*class_init_fn_t)();
00217 typedef void (*class_uninit_fn_t)();
00218
00220
00223 public:
00224 ss_explicit_k class_constructor()
00225 : api_constructor(&T::class_init, &T::class_uninit)
00226 {}
00227
00228 ss_explicit_k class_constructor( class_init_fn_t pfnInit
00229 , class_uninit_fn_t pfnUninit)
00230 : api_constructor(pfnInit, pfnUninit)
00231 {}
00233
00236 private:
00237 class_constructor(class_constructor const&);
00238 class_constructor& operator =(class_constructor const&);
00239
00240 #ifndef new
00241 # ifdef STLSOFT_COMPILER_IS_COMO
00242 void *operator new(ss_size_t) stlsoft_throw_0()
00243 {
00244 return 0;
00245 }
00246 # else
00247 void *operator new(ss_size_t) stlsoft_throw_0();
00248 # endif
00249 #endif
00250 void operator delete(void*)
00251 {}
00253 };
00254
00255
00256
00257 #ifndef _STLSOFT_NO_NAMESPACE
00258 }
00259 #endif
00260
00261
00262
00263 #endif
00264
00265