00001 #ifndef CDB_TRANSLATORS_DICT_BASE_HH 00002 #define CDB_TRANSLATORS_DICT_BASE_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbTranslatorsDictBase.hh,v 1.1 2005/05/03 20:59:51 gapon Exp $ 00006 00007 #include "CdbBase/CdbCPtr.hh" 00008 00009 #include <string> 00010 00011 class CdbObjectTranslator; 00012 00013 /// A base interface for a dictionary fo user defined translators 00014 /** 00015 * The dictionary manages user defined translators for "persistent-to-transient" 00016 * transformation. 00017 * 00018 * Notes on the dictionary use: 00019 * 00020 * 1. It's expected that there is a unique one-to-one correspondance between 00021 * persistent and transient classes. This policy will be enforced by 00022 * the "add()" method of the dictionary. 00023 * 00024 * 2. Translators are indexed by mean of two keys: 00025 * 00026 * a transient class's identifier (produced using the CdbType2Id class) 00027 * a persistent class's name 00028 * 00029 * @see class CdbType2Id 00030 * @see class CdbObjectTranslator 00031 */ 00032 class CdbTranslatorsDictBase { 00033 00034 public: 00035 00036 /// The destructor 00037 00038 virtual ~CdbTranslatorsDictBase( ) { } 00039 00040 /// Add a translator 00041 /** 00042 * @see class CdbObjectTranslator 00043 */ 00044 virtual CdbStatus add( const CdbCPtr< CdbObjectTranslator>& theTranslatorPtr ) = 0; 00045 00046 /// Find a translator by the specified keys 00047 /** 00048 * The method will return a pointer on the translator or 0 if no object matching 00049 * the specified name is found. 00050 * 00051 * @see class CdbObjectTranslator 00052 */ 00053 virtual CdbCPtr< CdbObjectTranslator > find( unsigned int theTranseintTypeId, 00054 const std::string& thePersistentTypeName 00055 ) const = 0; 00056 }; 00057 00058 #endif // CDB_TRANSLATORS_DICT_BASE_HH
1.3-rc3