00001 #ifndef CDB_ALWAYS_CLOSE_POLICY_HH 00002 #define CDB_ALWAYS_CLOSE_POLICY_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbAlwaysClosePolicy.hh,v 1.3 2004/07/13 01:41:48 gapon Exp $ 00006 00007 #include "CdbBase/CdbCommon.hh" 00008 00009 /// This is a policy class meant to parametrize smart pointer classes 00010 /** 00011 * This class is passed as a parameter to the counted smart pointer 00012 * classes in order to close a pointed object (pointee) when (right before) 00013 * it's going to be destroyed. 00014 * 00015 * This particular implementation ensures that a pointed object gets 00016 * always closed before deleted. This means that some interraction 00017 * with this class takes place. So we expect the pointee class to 00018 * expose the following interface: 00019 * 00020 * @code 00021 * class P ... { 00022 * public: 00023 * ... 00024 * bool isOpen( ); 00025 * void close( ); 00026 * }; 00027 * @endcode 00028 */ 00029 template < class P > 00030 class CdbAlwaysClosePolicy { 00031 00032 public: 00033 00034 /// Close specified pointer 00035 /** 00036 * In accordance with this policy this method interracts with 00037 * specified object and makes sure it's closed. 00038 */ 00039 static void close( P* ptr ); 00040 }; 00041 00042 #ifdef BABAR_COMP_INST 00043 #include "CdbBase/CdbAlwaysClosePolicy.cc" 00044 #endif // BABAR_COMP_INST 00045 00046 #endif // CDB_ALWAYS_CLOSE_POLICY_HH
1.3-rc3