00001 #ifndef CDBSQL_API_HH 00002 #define CDBSQL_API_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbSQLApi.hh,v 1.2 2005/09/15 05:15:31 gapon Exp $ 00006 00007 #include "CdbBase/Cdb.hh" 00008 #include "CdbBase/CdbCPtr.hh" 00009 #include "CdbBase/CdbObjectPtrFwd.hh" 00010 #include "CdbBase/CdbConditionPtrFwd.hh" 00011 00012 class BdbTime; 00013 00014 class CdbObjectFactoryBase; 00015 class CdbSQLObjectId; 00016 class CdbSQLCondition; 00017 class CdbSQLPartition; 00018 00019 /// The starting point for the public API of the Conditions/DB. 00020 /** 00021 * The only reason to have this abtsract class in the hierarchy is that it provides 00022 * the "::createObject()" meant to deffer an actual object creation sequence by a subclass 00023 * down the hierarchy. That allows final implementations of the current API class 00024 * to instantiate objects (those produced by the above mentioned method) of correct types. 00025 * 00026 * A general idea is that we have enough data at the current level to create new objects 00027 * but we don't know types of that objects. 00028 * 00029 * NOTE: A similar idea would be to define a method delivering a factory interface. 00030 * This could even work at a higher level of this class's hierarchy (class Cdb). 00031 * 00032 * @see CdbSQLApi::createObject() 00033 * @see Cdb 00034 * @see CdbEnvironment 00035 */ 00036 class CdbSQLApi : public Cdb { 00037 00038 private: 00039 00040 /// The copy constructor (NOT IMPLEMENTED) 00041 /** 00042 * Is disabled... 00043 */ 00044 CdbSQLApi( const CdbSQLApi& ); 00045 00046 /// The assignment operator (NOT IMPLEMENTED) 00047 /** 00048 * Is disabled... 00049 */ 00050 CdbSQLApi& operator=( const CdbSQLApi& ); 00051 00052 protected: 00053 00054 /// The default constructor. 00055 /** 00056 * The c-tor is only availble to subclasses. 00057 */ 00058 CdbSQLApi( ); 00059 00060 public: 00061 00062 /// The destructor 00063 /** 00064 * More details... 00065 */ 00066 virtual ~CdbSQLApi( ); 00067 00068 /// Create a metadata object of a right type 00069 /** 00070 * This method is meant to defer the actual operation to a more specialized 00071 * implementation of the current class. This way we let that (specialized) 00072 * implementation to decide on an object type. 00073 * 00074 * The method is supposed to be implemented by a subclass. 00075 * 00076 * @see CdbObject 00077 * @see CdbCondition 00078 * @see CdbSQLObjectId 00079 * 00080 * @return CdbStatus::Success if the operation succeeds 00081 */ 00082 virtual CdbStatus createObject( CdbObjectPtr& theObjectPtr, 00083 const CdbConditionPtr& theParentConditionPtr, 00084 const BdbTime& theOriginalValidityBeginTime, 00085 const BdbTime& theOriginalValidityEndTime, 00086 const BdbTime& theVisibleValidityBeginTime, 00087 const BdbTime& theVisibleValidityEndTime, 00088 const BdbTime& theDurationBeginTime, 00089 const BdbTime& theDurationEndTime, 00090 const BdbTime& theInsertionTime, 00091 const CdbSQLObjectId& theObjectId 00092 ) = 0; 00093 00094 /// Create a persistent object (in the specified context) and store it in a database 00095 /** 00096 * This method is meant to defer the actual operation to a more specialized 00097 * implementation of the current class. This way we let that (specialized) 00098 * implementation to decide on an object type. 00099 * 00100 * The method is supposed to be implemented by a subclass. 00101 * 00102 * @see CdbObject 00103 * @see CdbCondition 00104 * 00105 * @return CdbStatus::Success if the operation succeeds 00106 */ 00107 virtual CdbStatus storeObject( CdbObjectPtr& theObjectPtr, 00108 CdbObjectFactoryBase& theObjectFactory, 00109 CdbCPtr<CdbSQLCondition>& thePersistentConditionPtr, 00110 CdbCPtr<CdbSQLPartition>& thePersistentPartitionPtr, 00111 const CdbConditionPtr& theParentConditionPtr, 00112 const BdbTime& theOriginalValidityBeginTime, 00113 const BdbTime& theOriginalValidityEndTime 00114 ) = 0; 00115 }; 00116 00117 #endif // CDBSQL_API_HH
1.3-rc3