00001 #ifndef DDI_Singleton_h 00002 #define DDI_Singleton_h 00003 #include "DetectorDescription/Base/interface/Ptr.h" 00004 00005 namespace DDI { 00006 template <class I> 00007 class Singleton //: private I 00008 { 00009 public: 00010 typedef I value_type; 00011 //typedef I* pointer_type; 00012 00013 //~Singleton() { delete instance_; } 00014 00015 static value_type & instance() { 00016 static Ptr<I> value = new I; 00017 return *value; 00018 00019 //static char buf [sizeof (I)]; 00020 //static pointer_type obj = new (buf) I; 00021 //return obj; 00022 } 00023 00024 private: 00025 Singleton(); 00026 Singleton& operator=(const Singleton &); 00027 //static pointer_type instance_; 00028 }; 00029 } 00030 #endif