Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/CdbBase/CdbAlwaysClosePolicy.hh

Go to the documentation of this file.
00001 #ifndef CDB_ALWAYS_CLOSE_POLICY_HH
00002 #define CDB_ALWAYS_CLOSE_POLICY_HH
00003 
00004 #include "CdbBase/CdbCommon.hh"
00005 #include "CdbBase/CdbClosePolicy.hh"
00006 
00007 /// This is a policy class meant to parametrize smart pointer classes
00008 /**
00009   * This class extends the marker interface CdbClosePolicy.
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   * @see CdbClosePolicy
00030   */
00031 template < class P >
00032 class CdbAlwaysClosePolicy : public CdbClosePolicy {
00033 
00034 protected:
00035 
00036   /// The constructor
00037   /**
00038     * Is disabled...
00039     */
00040     CdbAlwaysClosePolicy( );
00041 
00042 public:
00043 
00044   /// Close specified pointer
00045   /**
00046     * In accordance with this policy this method interracts with
00047     * specified object and makes sure it's closed.
00048     */
00049     static void close( P* ptr );
00050 };
00051 
00052 #ifdef     BABAR_COMP_INST
00053 #include "CdbBase/CdbAlwaysClosePolicy.cc"
00054 #endif  // BABAR_COMP_INST
00055 
00056 #endif  // CDB_ALWAYS_CLOSE_POLICY_HH

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002