CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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       std::string m_columnName;
00029       ContainerSchema& m_schema;
00030       
00031     private:
00032       DataElement* m_dataElement;
00033       IRelationalData* m_relationalData;
00034       RelationalBuffer* m_relationalBuffer;
00035       IBlobStreamingService* m_blobWriter;
00036       bool m_useCompression;
00037   };
00038 
00039   class BlobWriter : public BlobWriterBase, public IRelationalWriter {
00040     
00041     public:
00042     BlobWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00043 
00044     virtual ~BlobWriter();
00045 
00046     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00047 
00048     void setRecordId( const std::vector<int>& identity );
00049 
00050     void write( int oid, const void* data );
00051     
00052   };
00053   
00054 
00055   class BlobUpdater : public BlobWriterBase, public IRelationalUpdater {
00056     
00057     public:
00058     BlobUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00059 
00060     virtual ~BlobUpdater();
00061 
00062     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00063 
00064     void setRecordId( const std::vector<int>& identity );
00065 
00066     void update( int oid, const void* data );
00067     
00068   };
00069 
00070   class BlobReader : public IRelationalReader {
00071     
00072     public:
00073     BlobReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00074 
00075     virtual ~BlobReader();
00076 
00077     bool build(DataElement& dataElement, IRelationalData& relationalData );
00078 
00079     void select( int oid );
00080 
00081     void setRecordId( const std::vector<int>& identity );
00082 
00083     void read( void* data );
00084 
00085     void clear();
00086 
00087     private:
00088       Reflex::Type m_objectType;
00089       std::string m_columnName;
00090       ContainerSchema& m_schema;
00091       
00092     private:
00093       DataElement* m_dataElement;
00094       IRelationalData* m_relationalData;
00095       IBlobStreamingService* m_blobReader;
00096 
00097   };
00098 
00099   class BlobStreamer : public IRelationalStreamer 
00100   {
00101     public:
00102     BlobStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00103 
00104     ~BlobStreamer();
00105 
00106     IRelationalWriter* newWriter();
00107 
00108     IRelationalUpdater* newUpdater();
00109 
00110     IRelationalReader* newReader();
00111 
00112     private:
00113     Reflex::Type m_objectType;
00114     MappingElement& m_mapping;
00115     ContainerSchema& m_schema;
00116   }; 
00117   
00118 }
00119 
00120 
00121 #endif
00122 
00123     
00124