00001 #ifndef CDB_ROO_SIMPLETRANSLATOR_HH 00002 #define CDB_ROO_SIMPLETRANSLATOR_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbRooSimpleTranslator.hh,v 1.1 2005/07/12 21:55:28 jtinslay Exp $ 00006 00007 #include "CdbRoo/CdbRooObjectTranslatorRT.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 R : public CdbRooObjectR { 00016 * public: 00017 * T* transient() const; 00018 * }; 00019 * 00020 * Where: 00021 * 00022 * T - is a transient type 00023 * R - is a persistent type 00024 * 00025 * @see class CdbRooObjectTranslatorRT 00026 */ 00027 template< class R, 00028 class T > 00029 class CdbRooSimpleTranslator : public CdbRooObjectTranslatorRT<R,T> { 00030 00031 private: 00032 00033 /// Copy constructor (NOT IMPLEMENTED) 00034 00035 CdbRooSimpleTranslator( const CdbRooSimpleTranslator<R,T>& ); 00036 00037 /// Assignment operator (NOT IMPLEMENTED) 00038 00039 CdbRooSimpleTranslator<R,T>& operator=( const CdbRooSimpleTranslator<R,T>& ); 00040 00041 public: 00042 00043 /// Default constructor 00044 /** 00045 * @see CdbRooObjectTranslatorRT::CdbRooObjectTranslatorRT() 00046 */ 00047 CdbRooSimpleTranslator( ) : 00048 CdbRooObjectTranslatorRT<R,T>( ) 00049 { } 00050 00051 /// Destructor 00052 00053 virtual ~CdbRooSimpleTranslator( ) { } 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 CdbRooObjectTranslatorRT::toTransientRT() 00062 */ 00063 virtual CdbStatus toTransientRT( T*& theTransientPtr, 00064 const CdbCPtr<R>& theObjectPtr ) const 00065 { 00066 theTransientPtr = theObjectPtr->transient( ); 00067 return ( 0 == theTransientPtr ? CdbStatus::Error : CdbStatus::Success ); 00068 } 00069 }; 00070 00071 #endif // CDB_ROO_SIMPLETRANSLATOR_HH
1.3-rc3