$search
00001 /* -*- C++ -*- 00002 * $Id: ref_count_manager.hh 957 2005-03-07 16:01:20Z sjoyeux $ 00003 */ 00004 #ifndef UTILMM_SMART_REF_COUNT_MANAGER_HEADER 00005 # define UTILMM_SMART_REF_COUNT_MANAGER_HEADER 00006 00007 #include "utilmm/singleton/wrapper_fwd.hh" 00008 00009 namespace utilmm { 00010 namespace smart { 00017 namespace ref_count { 00018 00034 template<class Memory> 00035 class manager { 00036 public: 00038 typedef typename Memory::base_type base_type; 00045 typedef typename Memory::mem_cell mem_cell; 00046 00056 mem_cell manage(base_type *ptr); 00068 mem_cell assign(mem_cell c); 00069 00080 void release(mem_cell c); 00081 00090 bool null(mem_cell c) { 00091 return c==mem.null_cell(); 00092 } 00093 00103 base_type *get_ptr(mem_cell c) { 00104 return c->first; 00105 } 00106 00107 private: 00108 manager() {} 00109 00110 ~manager() {} 00111 00112 Memory mem; 00113 00114 template<class Ty> 00115 friend class singleton::wrapper; 00116 }; // class utilmm::smart::ref_count::manager<> 00117 00118 } // namespace utilmm::smart::ref_count 00119 } // namespace utilmm::smart 00120 } // namespace utilmm 00121 00122 # define IN_UTILMM_SMART_REF_COUNT_MANAGER_HEADER 00123 #include "utilmm/smart/bits/ref_count_manager.tcc" 00124 # undef IN_UTILMM_SMART_REF_COUNT_MANAGER_HEADER 00125 #endif // UTILMM_SMART_REF_COUNT_MANAGER_HEADER 00126