00001 #ifndef CDBBDB_ENV_PROXY_HH 00002 #define CDBBDB_ENV_PROXY_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbEnvProxy.hh,v 1.2 2002/09/23 22:39:08 gapon Exp $ 00006 00007 #include "CdbBdb/CdbBdbProxyBase.hh" 00008 00009 /// Straightforward implementation for the proxy class 00010 /** 00011 * Class CdbBdbEnvProxy 00012 * 00013 * This is a straightforward 1-to-1 proxy implementation assuming 00014 * that there is a simple conversion from a persistent class 00015 * to a transient one. 00016 * 00017 * The proxy class is parametrized by mean of two template parameters: 00018 * 00019 * T - is a transient class representing a proxy product 00020 * P - a persistent class representing a data source 00021 * 00022 * In order to do the "persistent-to-transient" conversion the persistent 00023 * class 'P' is expected to expose the following minimal interface: 00024 * 00025 * class P : public ... BdbObject { 00026 * public: 00027 * T* transient( ) const; 00028 * }; 00029 * 00030 * Comments: 00031 * 00032 * - the type 'T' must match the first template parameter of the proxy. 00033 * 00034 * - the type 'P' must be either direct or indirect subclass of the 'BdbObject' class 00035 * 00036 * - if there is a hierarchy of persistent classes deriving from the common base 00037 * class and if this base class defines the above mentioned "transient" method 00038 * as the virtual one then the base class type can be used as the 'P' 00039 * instead of any of its subclasses. 00040 * 00041 * - make sure that you have loaded the v-tables for thoses persistent 00042 * classes whose objects are loaded through this proxy. 00043 * 00044 * Any incompatibility will be catched during template instantiation 00045 * time. 00046 */ 00047 template< class T, class P > 00048 class CdbBdbEnvProxy : public CdbBdbProxyBase<T> { 00049 00050 private: 00051 00052 /// The default constructor (NOT IMPLEMENTED) 00053 00054 CdbBdbEnvProxy( ); 00055 00056 /// The copy constructor (NOT IMPLEMENTED) 00057 00058 CdbBdbEnvProxy( const CdbBdbEnvProxy<T,P>& theProxy ); 00059 00060 /// The asignment operator (NOT IMPLEMENTED) 00061 00062 CdbBdbEnvProxy<T,P>& operator=( const CdbBdbEnvProxy<T,P>& theProxy ); 00063 00064 public: 00065 00066 /// The normal and default constructor 00067 /** 00068 * The only optional argument of the constructor takes the strategy object 00069 * for locating GenEnv parameters. If 0 pointer is passed then a default 00070 * strategy will be enforced. 00071 * 00072 * Note, that the ownreship of the strategy object is also passed to the constructor. 00073 */ 00074 CdbBdbEnvProxy( const char* theDetectorName, 00075 const char* theConditionName, 00076 BdbCondDefStrategy* theStrategy = 0 ); 00077 00078 /// The destructor 00079 00080 virtual ~CdbBdbEnvProxy( ); 00081 00082 protected: 00083 00084 /// The redefined fault handler 00085 /** 00086 * Implements the method of a base class. 00087 * 00088 * @see CdbBdbProxyBase::redefinedFaultHandler 00089 */ 00090 virtual T* redefinedFaultHandler( const std::vector<CdbBdbProxyElement>& listOfElements ); 00091 }; 00092 00093 #ifdef BABAR_COMP_INST 00094 #include "CdbBdb/CdbBdbEnvProxy.cc" 00095 #endif // BABAR_COMP_INST 00096 00097 #endif // CDBBDB_ENV_PROXY_HH
1.3-rc3