00001 #ifndef CDB_BDB_OBJECT_TRANSLATOR_P2T_HH 00002 #define CDB_BDB_OBJECT_TRANSLATOR_P2T_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbObjectTranslatorP2T.hh,v 1.1 2005/05/03 21:15:14 gapon Exp $ 00006 00007 #include "CdbBdb/CdbBdbObjectTranslatorPT.hh" 00008 00009 /// A simpple implementation of persistent-to-transient translators 00010 /** 00011 * This class is a specialization of generic "persistent-to-transient" 00012 * translators for persistent classes having the following minimal interface: 00013 * 00014 * class T; 00015 * class P : public BdbObject { 00016 * public: 00017 * T* transient() const; 00018 * }; 00019 * 00020 * Where: 00021 * 00022 * T - is a transient type 00023 * P - is a persistent type 00024 * 00025 * @see class CdbBdbObjectTranslatorPT 00026 */ 00027 template< class P, 00028 class T > 00029 class CdbBdbObjectTranslatorP2T : public CdbBdbObjectTranslatorPT<P,T> { 00030 00031 private: 00032 00033 /// Copy constructor (NOT IMPLEMENTED) 00034 00035 CdbBdbObjectTranslatorP2T( const CdbBdbObjectTranslatorP2T<P,T>& ); 00036 00037 /// Assignment operator (NOT IMPLEMENTED) 00038 00039 CdbBdbObjectTranslatorP2T<P,T>& operator=( const CdbBdbObjectTranslatorP2T<P,T>& ); 00040 00041 public: 00042 00043 /// Default constructor 00044 /** 00045 * @see CdbBdbObjectTranslatorPT::CdbBdbObjectTranslatorPT() 00046 */ 00047 CdbBdbObjectTranslatorP2T( ) : 00048 CdbBdbObjectTranslatorPT<P,T>( ) 00049 { } 00050 00051 /// Destructor 00052 00053 virtual ~CdbBdbObjectTranslatorP2T( ) { } 00054 00055 protected: 00056 00057 /// Translate into a transient object (persistent & transient type specific translation) 00058 /** 00059 * Implement the corresponding method defined in the base class. 00060 * 00061 * @see CdbBdbObjectTranslatorPT::toTransientPT() 00062 */ 00063 virtual CdbStatus toTransientPT( T*& theTransientPtr, 00064 const BdbHandle(P)& theObjectH ) const 00065 { 00066 theTransientPtr = theObjectH->transient( ); 00067 return ( 0 == theTransientPtr ? CdbStatus::Error : CdbStatus::Success ); 00068 } 00069 }; 00070 00071 #endif // CDB_BDB_OBJECT_TRANSLATOR_P2T_HH
1.3-rc3