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

CdbBdb2RooNTupleConverter.hh

Go to the documentation of this file.
00001 #ifndef CDBROOCONVERSIONFWK_BDB_2_ROO_NTUPLE_CONVERTER_HH
00002 #define CDBROOCONVERSIONFWK_BDB_2_ROO_NTUPLE_CONVERTER_HH
00003 
00004 // File and Version Information:
00005 //      $Id: CdbBdb2RooNTupleConverter.hh,v 1.2 2005/07/14 16:10:48 jtinslay Exp $
00006 
00007 #include "CdbBase/CdbCPtr.hh"
00008 
00009 #include "CdbRooConversionFwk/CdbBdb2RooPayloadConverter.hh"
00010 
00011 #include "CdbBdbTable/CdbBdbNTupleConversionRules.hh"
00012 #include "CdbRooTable/CdbRooNTupleConversionRules.hh"
00013 
00014 /// The converter for Cdb N-Tuples
00015 /**
00016   * This class represents a family of converters based on types of persistent
00017   * classes passed as template parameters.
00018   *
00019   * The parameters of the template are:
00020   *
00021   *   'P' - the input  "Bdb" object type. This type should be a model of
00022   *         CDB persistent N-Tuples  based on an abstract interface
00023   *         of the CdbBdbNTupleP class. 
00024   *
00025   *   'R' - the output "Roo" object type. The actual type has to be a model
00026   *         of the 'CdbRooNTupleR< R::element_type >' class.
00027   *
00028   *   'P_ELEMENT_CONVERSION_RULES' - rules for converting a persistent element type
00029   *                                  into its transient counterpart for the "Bdb" technology.
00030   *
00031   *   'R_ELEMENT_CONVERSION_RULES' - rules for converting a persistent element type
00032   *                                  into its transient counterpart for the "Roo" technology.
00033   *
00034   * Tests for a compatibility of actual types used as template parameters will be
00035   * be performed both at a compilation and run time.
00036   *
00037   * By default the converter will be using default conversion rules for element types,
00038   * which is good for elementary types. For complex user defined types the corresponding
00039   * element type converters must be provided.
00040   *
00041   * CLASS DESIGN NOTES:
00042   *
00043   *   1. The persistent type verification is performed by the direct base
00044   *      class of the converter and in the c-tor of the current class (for a compliance
00045   *      with the model of Generic N-tuples).
00046   *
00047   *   2. All (but the default) class's constructors, its assignment operator, and its destructor are
00048   *      generated automatically by a C++ compiler. They're all public.
00049   *
00050   *   3. Two element conversion rules (one for each technology) are needed to avoid
00051   *      knowing direct element type conversion rules like:
00052   *
00053   *        P::ElementType -> R::ElementType
00054   *
00055   *      We're replacing this with an indirect (through a common transient) type
00056   *      conversion chain:
00057   *
00058   *        P::ElementType -> T -> R::ElementType
00059   *
00060   *      See more details in the implementation file of the class.
00061   *
00062   * @see class CdbBdb2RooPayloadConverter
00063   * @see class CdbBdbNTupleConversionReverseRules_Default
00064   * @see class CdbRooNTupleConversionReverseRules_Default
00065   */
00066 template< class P,
00067           class R,
00068           class P_ELEMENT_CONVERSION_RULES = CdbBdbNTupleConversionReverseRules_Default< typename P::ElementType >,
00069           class R_ELEMENT_CONVERSION_RULES = CdbRooNTupleConversionReverseRules_Default< typename R::ElementType > >
00070 
00071 class CdbBdb2RooNTupleConverter : public CdbBdb2RooPayloadConverter<P,R> {
00072 
00073 public:
00074 
00075   /// Default constructor
00076   /**
00077     * It will perform additional type checking for the specified persistent types.
00078     */
00079     CdbBdb2RooNTupleConverter( );
00080 
00081 protected:
00082 
00083   /// Implement a user-defined conversion
00084   /**
00085     * Implements the corresponding method from the base class or interface.
00086     *
00087     * @see CdbRooConverterBase::userDefinedConversion()
00088     */
00089     virtual CdbStatus userDefinedConversion( const BdbRef(BdbObject)& theInputObjectRef,
00090                                              R*&                      theOutputObjectPtr
00091                                            ) const;
00092 };
00093 
00094 #ifdef     BABAR_COMP_INST
00095 #include "CdbRooConversionFwk/CdbBdb2RooNTupleConverter.cc"
00096 #endif  // BABAR_COMP_INST
00097 
00098 #endif  // CDBROOCONVERSIONFWK_BDB_2_ROO_NTUPLE_CONVERTER_HH

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