CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/CondCore/ORA/src/InlineCArrayStreamer.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_INLINECARRAYSTREAMER_H
00002 #define INCLUDE_ORA_INLINECARRAYSTREAMER_H
00003 
00004 #include "IRelationalStreamer.h"
00005 #include "RelationalStreamerFactory.h"
00006 // externals
00007 #include "Reflex/Type.h"
00008 
00009 namespace ora {
00010 
00011   class MappingElement;
00012   class ContainerSchema;
00013   class DataElement;
00014 
00015   class InlineCArrayStreamerBase  {
00016 
00017     public:
00018 
00019     InlineCArrayStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00020 
00021     virtual ~InlineCArrayStreamerBase();
00022 
00023     bool buildDataElement( DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer* operationBuffer );
00024     
00025     virtual void processArrayElement( DataElement& arrayElementOffset, IRelationalData& relationalData, MappingElement& arrayElementMapping, RelationalBuffer* operationBuffer ) = 0;
00026 
00027     protected:
00028 
00029     Reflex::Type m_objectType;
00030     Reflex::Type m_arrayType;
00031     RelationalStreamerFactory m_streamerFactory;
00032     private:
00033 
00034     MappingElement& m_mapping;
00035   };
00036 
00037   class InlineCArrayWriter : public InlineCArrayStreamerBase, public IRelationalWriter {
00038     public:
00039     InlineCArrayWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00040 
00041     virtual ~InlineCArrayWriter();
00042 
00043     void processArrayElement( DataElement& arrayElementOffset, IRelationalData& relationalData, MappingElement& arrayElementMapping, RelationalBuffer* operationBuffer );
00044 
00045     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00046 
00047     void setRecordId( const std::vector<int>& identity );
00048 
00049     void write( int oid, const void* data );
00050 
00051     private:
00052     std::vector<IRelationalWriter*> m_writers;
00053   };
00054   
00055 
00056   class InlineCArrayUpdater : public InlineCArrayStreamerBase, public IRelationalUpdater {
00057     public:
00058     InlineCArrayUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00059 
00060     virtual ~InlineCArrayUpdater();
00061 
00062     void processArrayElement( DataElement& arrayElementOffset, IRelationalData& relationalData, MappingElement& arrayElementMapping, RelationalBuffer* operationBuffer );
00063 
00064     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00065 
00066     void setRecordId( const std::vector<int>& identity );
00067 
00068     void update( int oid, const void* data );
00069     private:
00070     std::vector<IRelationalUpdater*> m_updaters;
00071     
00072   };
00073 
00074   class InlineCArrayReader : public InlineCArrayStreamerBase, public IRelationalReader {
00075     public:
00076     InlineCArrayReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00077 
00078     virtual ~InlineCArrayReader();
00079 
00080     void processArrayElement( DataElement& arrayElementOffset, IRelationalData& relationalData, MappingElement& arrayElementMapping, RelationalBuffer* operationBuffer );
00081 
00082     bool build(DataElement& dataElement, IRelationalData& relationalData );
00083 
00084     void select( int oid );
00085 
00086     void setRecordId( const std::vector<int>& identity );
00087 
00088     void read( void* data );
00089 
00090     void clear();
00091     
00092     private:
00093     std::vector<IRelationalReader*> m_readers;
00094   };
00095 
00096   class InlineCArrayStreamer : public IRelationalStreamer 
00097   {
00098     public:
00099     InlineCArrayStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00100 
00101     ~InlineCArrayStreamer();
00102 
00103     IRelationalWriter* newWriter();
00104 
00105     IRelationalUpdater* newUpdater();
00106 
00107     IRelationalReader* newReader();
00108 
00109     private:
00110     Reflex::Type m_objectType;
00111     MappingElement& m_mapping;
00112     ContainerSchema& m_schema;
00113 
00114   }; 
00115   
00116 }
00117 
00118 
00119 #endif
00120 
00121     
00122