$search
00001 /* -*- C++ -*- 00002 * $Id: wrapper.hh 971 2005-04-08 16:31:47Z sjoyeux $ 00003 */ 00004 #ifndef UTILMM_SINGLETON_WRAPPER_HEADER 00005 # define UTILMM_SINGLETON_WRAPPER_HEADER 00006 00007 #include "utilmm/singleton/bits/dummy.hh" 00008 00009 namespace utilmm { 00010 namespace singleton { 00011 namespace details { 00012 template<typename Ty> 00013 class wrapper_factory; 00014 } 00015 00030 template<typename Ty> 00031 class wrapper :private dummy { 00032 public: 00040 static void attach(); 00050 static void detach(); 00051 00058 static Ty &instance(); 00059 00060 private: 00061 wrapper(); 00062 ~wrapper(); 00063 00064 static std::string name(); 00065 00066 Ty value; 00067 00068 friend class details::wrapper_factory<Ty>; 00069 }; // class utilmm::singleton::wrapper<> 00070 00071 } // namespace utilmm::singleton 00072 } // namespace utilmm 00073 00074 # define IN_UTILMM_SINGLETON_WRAPPER_HEADER 00075 #include "utilmm/singleton/bits/wrapper.tcc" 00076 # undef IN_UTILMM_SINGLETON_WRAPPER_HEADER 00077 #endif // UTILMM_SINGLETON_WRAPPER_HEADER 00078