00001 #ifndef CDBBDB_OBJECT_FACTORY_HH 00002 #define CDBBDB_OBJECT_FACTORY_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbObjectFactory.hh,v 1.3 2005/09/15 05:06:26 gapon Exp $ 00006 00007 #include "CdbBase/CdbObjectFactoryBase.hh" 00008 00009 #include "CdbBase/CdbConditionPtrFwd.hh" 00010 #include "CdbBase/CdbObjectPtrFwd.hh" 00011 00012 #include "BdbCond/BdbObject.hh" 00013 00014 class BdbTime; 00015 00016 /// This is an abstract base class for factories of the CdbObject class 00017 /** 00018 * The "create" method of the base interface gets its default implementation 00019 * in here. This implementattion will call a user provided pure virtual 00020 * method to do the actual object creation. In fact this is a kind of "shell" 00021 * for the object creation code. This shell will be called with the righ 00022 * value of the hint. 00023 * 00024 * @see CdbObjectFactoryBase 00025 */ 00026 class CdbBdbObjectFactory : public CdbObjectFactoryBase { 00027 00028 public: 00029 00030 /// The constructor. 00031 /** 00032 * The only parameter of the constructor is an optional switch 00033 * allowing to turn of the verification of the user created object. 00034 * This may be needed on some special occasions. 00035 */ 00036 explicit CdbBdbObjectFactory( bool verifyFlag = true ); 00037 00038 /// The destructor. 00039 /** 00040 * It's here only to delete classes by a pointer onto this interface. 00041 */ 00042 virtual ~CdbBdbObjectFactory( ); 00043 00044 /// Create a new object for specified validity interval 00045 /** 00046 * This is a default implementation for this creator. 00047 * 00048 * @see CdbObjectFactoryBase::create() 00049 */ 00050 virtual CdbStatus create( CdbObjectPtr& thePtr, /**< a smart pointer to an object to be created */ 00051 const CdbConditionPtr& theConditionPtr, /**< a condition where the new object will be registered at */ 00052 const BdbTime& theBegin, /**< a point where the object's validity begins from */ 00053 const BdbTime& theEnd /**< ... and finishes (exclusing) at */ 00054 ); 00055 00056 protected: 00057 00058 /// This is a specialized persistent object creation method 00059 /** 00060 * This method (to be implemented by developers of specific persistent classes) 00061 * handles the creation process. This method is parametrized through a "hint" 00062 * parameter. The product of the operation is delivered into supplied pointer variable 00063 * passed by reference. 00064 * 00065 * This method will indicate the completion status of the operation through 00066 * its return value of the CdbStatus type. A user can set this variable to communicate 00067 * with the calling shell in order to indicate if the creation (for some reason) 00068 * is not possible or failed. 00069 * 00070 * @see CdbStatus 00071 */ 00072 virtual CdbStatus doCreate( BdbHandle(BdbObject)& theProduct, /**< a reference to a new persistent object to be created */ 00073 const BdbRefAny& theHint /**< a placement hint for new object */ 00074 ) = 0; 00075 00076 private: 00077 00078 bool _verifyFlag; 00079 }; 00080 00081 #endif // CDBBDB_OBJECT_FACTORY_HH
1.3-rc3