Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbBdbNTupleFactory.hh

Go to the documentation of this file.
00001 #ifndef CDBBDBTABLE_NTUPLE_FACTORY_HH
00002 #define CDBBDBTABLE_NTUPLE_FACTORY_HH
00003 
00004 // File and Version Information:
00005 //      $Id: CdbBdbNTupleFactory.hh,v 1.1 2004/03/24 07:17:07 gapon Exp $
00006 
00007 #include "CdbBase/CdbCPtr.hh"
00008 
00009 #include "CdbTable/CdbNTuple.hh"
00010 
00011 #include "CdbBdb/CdbBdbObjectFactory.hh"
00012 
00013 #include "BdbCond/BdbObject.hh"
00014 
00015 /// This is a BDB specific implementation for the factory
00016 /**
00017   * This class is meant to be used to create persistent objects from
00018   * instances of CdbTable and its derived classes assuming that the default
00019   * conversion is available for element types of these tuples.
00020   *
00021   * TEMPLATE PARAMETERS:
00022   *
00023   *   This class has two template parameters defining the type of a transient n-tuple.
00024   *   Teh parameters are the sdame (and have the same meaning) as in case of
00025   *   the transient CdbNTuple class.
00026   *
00027   *   Here is an example:
00028   *
00029   *     CdbCPtr<float,3> tuplePtr = ... ;                   // have a tuple
00030   *
00031   *     CdbBdbNTupleFactory<float,3> factory( tuplePtr );   // the factory is ready to be used
00032   *
00033   * IMPORTANT USE NOTE:
00034   *
00035   *   Remember that the factory will accept and cache a counted smart pointer onto
00036   *   a tuple. This instance will be used as a source of information later on, at
00037   *   a time when a CDB API's implementation will be about to store the tuple.
00038   *   So make sure that you don't change the contents of the transient tuple (pointed
00039   *   to by the smart reference) between a code creating the factory and a code invoking
00040   *   CDB API, unless this is done on purpose.
00041   *
00042   * @see class CdbBdbObjectFactory
00043   * @see class CdbTuple
00044   * @see class CdbBdbNTupleConversion
00045   */
00046 template< class        T,
00047           unsigned int NCOL >
00048 class CdbBdbNTupleFactory : public CdbBdbObjectFactory {
00049 
00050 private:
00051 
00052   /// The default constructor (NOT IMPLEMENTED)
00053   /**
00054     * Is disabled...
00055     */
00056     CdbBdbNTupleFactory( );
00057 
00058 public:
00059 
00060   /// The destructor.
00061   /**
00062     * It's here only to delete classes by a pointer onto this interface.
00063     */
00064     virtual ~CdbBdbNTupleFactory( );
00065 
00066   /// The constructor
00067   /**
00068     * The value of T type will be passed to the constructor of the corresponding
00069     * class when the creation will be triggered. It's up to the developer of
00070     * the persistent class how to treat this situation.
00071     */
00072     CdbBdbNTupleFactory( const CdbCPtr< CdbNTuple<T,NCOL> >& thePtr );
00073 
00074 protected:
00075 
00076   /// This is a specialized persistent object creation method
00077   /**
00078     * This is a default implementation for this creator.
00079     *
00080     * @see CdbObjectFactory::create()
00081     */
00082     virtual CdbStatus doCreate( BdbHandle(BdbObject)& theProduct,   /**< a reference to a new persistent object to be created */
00083                                 const BdbRefAny&      theHint       /**< a placement hint for new object */
00084                               );
00085 
00086 private:
00087 
00088     CdbCPtr< CdbNTuple<T,NCOL> > _ptr;
00089 };
00090 
00091 #ifdef     BABAR_COMP_INST
00092 #include "CdbBdbTable/CdbBdbNTupleFactory.cc"
00093 #endif  // BABAR_COMP_INST
00094 
00095 #endif  // CDBBDBTABLE_NTUPLE_FACTORY_HH

Generated on Mon Dec 5 18:22:00 2005 for CDB by doxygen1.3-rc3