CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CondCore/ORA/src/RelationalMapping.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_RELATIONALMAPPING_H
00002 #define INCLUDE_ORA_RELATIONALMAPPING_H
00003 
00004 //
00005 #include <utility>
00006 #include <string>
00007 // externals
00008 #include "Reflex/Type.h"
00009 
00010 namespace Reflex {
00011   class Type;
00012 }
00013 
00014 namespace ora {
00015 
00016   namespace RelationalMapping {
00017     size_t sizeInColumns(const Reflex::Type& topLevelClassType );
00018     std::pair<bool,size_t> sizeInColumnsForCArray( const Reflex::Type& arrayType );
00019     void _sizeInColumns(const Reflex::Type& typ, size_t& sz, bool& hasDependencies );
00020     void _sizeInColumnsForCArray(const Reflex::Type& typ, size_t& sz, bool& hasDependencies );
00021   }
00022 
00023   class MappingElement;
00024   class TableRegister;
00025   
00026   class IRelationalMapping {
00027     public:
00028     virtual ~IRelationalMapping(){
00029     }
00030 
00031     virtual void process( MappingElement& parentElement, const std::string& attributeName,
00032                           const std::string& attributeNameForSchema, const std::string& scopeNameForSchema ) = 0;
00033   };
00034 
00035   class RelationalMappingFactory {
00036     public:
00037     explicit RelationalMappingFactory( TableRegister& tableRegister );
00038     virtual ~RelationalMappingFactory();
00039 
00040     public:
00041     IRelationalMapping* newProcessor( const Reflex::Type& attributeType, bool blobStreaming=false );
00042 
00043     private:
00044     TableRegister& m_tableRegister;    
00045   };
00046 
00047   class PrimitiveMapping : public IRelationalMapping {
00048     public:
00049     PrimitiveMapping( const Reflex::Type& attributeType, TableRegister& tableRegister  );
00050     ~PrimitiveMapping();
00051 
00052     void process( MappingElement& parentElement, const std::string& attributeName,
00053                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00054     private:
00055     Reflex::Type m_type;
00056     TableRegister& m_tableRegister;
00057     
00058   };
00059   
00060   class BlobMapping : public IRelationalMapping {
00061     public:
00062     BlobMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00063 
00064     ~BlobMapping();
00065 
00066     void process( MappingElement& parentElement, const std::string& attributeName,
00067                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00068     private:
00069     Reflex::Type m_type;
00070     TableRegister& m_tableRegister;
00071     
00072   };
00073   
00074   class OraReferenceMapping : public IRelationalMapping {
00075     public:
00076     OraReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00077 
00078     ~OraReferenceMapping();
00079 
00080     void process( MappingElement& parentElement, const std::string& attributeName,
00081                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00082     private:
00083     Reflex::Type m_type;
00084     TableRegister& m_tableRegister;
00085     
00086   };
00087 
00088   class UniqueReferenceMapping : public IRelationalMapping {
00089     public:
00090     UniqueReferenceMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00091 
00092     ~UniqueReferenceMapping();
00093 
00094     void process( MappingElement& parentElement, const std::string& attributeName,
00095                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00096     private:
00097     Reflex::Type m_type;
00098     TableRegister& m_tableRegister;
00099     
00100   };
00101 
00102   class OraPtrMapping : public IRelationalMapping {
00103     public:
00104     OraPtrMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00105 
00106     ~OraPtrMapping();
00107 
00108     void process( MappingElement& parentElement, const std::string& attributeName,
00109                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00110     private:
00111     Reflex::Type m_type;
00112     TableRegister& m_tableRegister;
00113     
00114   };
00115 
00116   class NamedRefMapping: public IRelationalMapping {
00117     public:
00118     NamedRefMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00119     ~NamedRefMapping();
00120 
00121     void process( MappingElement& parentElement, const std::string& attributeName,
00122                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00123 
00124     private:
00125     Reflex::Type m_type;
00126     TableRegister& m_tableRegister;
00127   };
00128 
00129   class ArrayMapping : public IRelationalMapping {
00130     public:
00131     ArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00132 
00133     ~ArrayMapping();
00134 
00135     void process( MappingElement& parentElement, const std::string& attributeName,
00136                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00137     private:
00138     Reflex::Type m_type;
00139     TableRegister& m_tableRegister;
00140     
00141   };
00142   
00143   class CArrayMapping : public IRelationalMapping {
00144     public:
00145     CArrayMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00146 
00147     ~CArrayMapping();
00148 
00149     void process( MappingElement& parentElement, const std::string& attributeName,
00150                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00151     private:
00152     Reflex::Type m_type;
00153     TableRegister& m_tableRegister;
00154     
00155   };
00156   
00157   class ObjectMapping : public IRelationalMapping {
00158     public:
00159     ObjectMapping( const Reflex::Type& attributeType, TableRegister& tableRegister );
00160 
00161     ~ObjectMapping();
00162 
00163     void process( MappingElement& parentElement, const std::string& attributeName,
00164                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00165     private:
00166     Reflex::Type m_type;
00167     TableRegister& m_tableRegister;
00168     
00169   };
00170 
00171   class EmptyMapping : public IRelationalMapping {
00172     public:
00173     EmptyMapping();
00174 
00175     ~EmptyMapping();
00176 
00177     void process( MappingElement& parentElement, const std::string& attributeName,
00178                   const std::string& attributeNameForSchema, const std::string& scopeNameForSchema );
00179   };
00180 
00181 }
00182 
00183 #endif