00001 #ifndef CDB_ROO_OBJECT_TRANSLATOR_RT_HH 00002 #define CDB_ROO_OBJECT_TRANSLATOR_RT_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbRooObjectTranslatorRT.hh,v 1.1 2005/05/03 21:23:49 gapon Exp $ 00006 00007 #include "CdbBase/CdbObjectTranslatorT.hh" 00008 00009 #include <string> 00010 00011 /// The transient & persistent type specific specialization of persistent-to-transient translators 00012 /** 00013 * This class is an element of the "persistent-to-transient" translation facility 00014 * extending the core CDB API and allowing a better (and more confined) controll 00015 * over persistency in client applications. 00016 * 00017 * Roles of this class are: 00018 * 00019 * 1. to translate an actual persistent type into its name 00020 * 2. to be a direct base class for concrete persistent-technology translators 00021 * 00022 * @see class CdbObjectTranslatorT 00023 */ 00024 template< class R, 00025 class T > 00026 class CdbRooObjectTranslatorRT : public CdbObjectTranslatorT<T> { 00027 00028 private: 00029 00030 /// Obtain a name of the current persistent type 00031 /** 00032 * IMPLEMENTATION NOTES: 00033 * 00034 * 1. This operation will crash if it will faild to get the type information! 00035 * 00036 * 2. The operation may start a short transaction of none is available yet. 00037 * The transaction is needed to translate the specified persistent type into 00038 * its name. 00039 */ 00040 static std::string persistentType2Name( ); 00041 00042 private: 00043 00044 /// Copy constructor (NOT IMPLEMENTED) 00045 00046 CdbRooObjectTranslatorRT( const CdbRooObjectTranslatorRT<R,T>& ); 00047 00048 /// Assignment operator (NOT IMPLEMENTED) 00049 00050 CdbRooObjectTranslatorRT<R,T>& operator=( const CdbRooObjectTranslatorRT<R,T>& ); 00051 00052 protected: 00053 00054 /// Default constructor 00055 /** 00056 * IMPLEMENTATION NOTES: 00057 * 00058 * The constructor may start a short transaction of none is available yet. 00059 * The transaction is needed to translate the specified persistent type into 00060 * its name. 00061 */ 00062 CdbRooObjectTranslatorRT( ); 00063 00064 private: 00065 00066 /// Translate into a transient object (transient type specific translation) 00067 /** 00068 * This method is implemented in terms of the redefined persistent type specific, 00069 * version which itself will have to be implemented by subclasses. 00070 * 00071 * DESIGN NOTE: 00072 * 00073 * Note, that this method has moved into the "private" area to prevent 00074 * it from being see by subclasses. Is this going to work w/o causing 00075 * any compiler complains? 00076 * 00077 * @see CdbObjectTranslatorT::toTransientT() 00078 */ 00079 virtual CdbStatus toTransientT( T*& theTransientPtr, /**< the pointer to be initialized with the result */ 00080 const CdbObjectPtr& theObjectPtr /**< the input metadata object */ 00081 ) const; 00082 protected: 00083 00084 /// Translate into a transient object (persistent & transient type specific translation) 00085 /** 00086 * This is a redefined version of a similar method CdbObjectTranslatorT::toTransientT() 00087 * defined in the base class and implemented above. Its role is to force translation 00088 * procedures of subclasses be written in terms of the specified persistent & transinet types. 00089 * 00090 * The method is supposed to be implemented by subclasses. The method is guaranteed 00091 * to be called with the correct parameters. 00092 * 00093 * @see CdbObjectTranslatorT::toTransientT() 00094 */ 00095 virtual CdbStatus toTransientRT( T*& theTransientPtr, /**< the pointer to be initialized with the result */ 00096 const CdbCPtr<R>& theObjectPtr /**< the input persistent object */ 00097 ) const = 0; 00098 public: 00099 00100 /// Destructor 00101 00102 virtual ~CdbRooObjectTranslatorRT( ) { } 00103 }; 00104 00105 #ifdef BABAR_COMP_INST 00106 #include "CdbRoo/CdbRooObjectTranslatorRT.cc" 00107 #endif /* BABAR_COMP_INST */ 00108 00109 #endif // CDB_ROO_OBJECT_TRANSLATOR_RT_HH
1.3-rc3