CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CondCore/ORA/src/BlobStreamer.h

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