DestroyingDeleter.h

00001 #ifndef VCDRFGLKVBLFGDGHKJSDFGKJXCHVGKCVF
00002 #define VCDRFGLKVBLFGDGHKJSDFGKJXCHVGKCVF
00003 
00005 
00020 #include "boost/shared_ptr.hpp"
00021 
00022 namespace Sct {
00023 
00024   namespace DestroyingDeleterHelper {
00025     void complain();
00026   };
00027 
00028   template<typename T>
00029     class DestroyingDeleter {
00030     public:
00031     static boost::shared_ptr<T> shared_ptr(T * t) {
00032       return boost::shared_ptr<T>(t, DestroyingDeleter<T>() );
00033     };
00034     public:
00035     void operator() (T * t) throw() {  
00036       try {
00037     t->_destroy();
00038       } catch (...) {
00039     try {
00040       ::Sct::DestroyingDeleterHelper::complain();
00041     } catch (...) {
00042       // fall through
00043     };
00044     // fall through
00045       };
00046     };
00047   };
00048   
00049   
00050 };
00051 
00052 #endif

Generated on Mon Feb 6 14:01:19 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6