CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/CondCore/ORA/src/OraPtrStreamer.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_ORAPTRSTREAMER_H
00002 #define INCLUDE_ORA_ORAPTRSTREAMER_H
00003 
00004 #include "IRelationalStreamer.h"
00005 #include "DataElement.h"
00006 //
00007 #include <memory>
00008 #include <boost/shared_ptr.hpp>
00009 // externals
00010 #include "Reflex/Type.h"
00011 
00012 
00013 namespace ora {
00014 
00015   class MappingElement;
00016   class ContainerSchema;
00017   class IPtrLoader;
00018   class OraPtrReadBuffer;
00019   
00020   class OraPtrWriter :  public IRelationalWriter{
00021 
00022     public:
00023 
00024       OraPtrWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00025 
00026       virtual ~OraPtrWriter();
00027       
00028       bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00029 
00030       void setRecordId( const std::vector<int>& identity );
00031       
00033       void write( int oid, const void* data );
00034 
00035     private:
00036 
00037       Reflex::Type m_objectType;
00038       MappingElement& m_mappingElement;
00039       ContainerSchema& m_schema;
00040       DataElement m_localElement;
00041       DataElement* m_dataElement;
00042       std::auto_ptr<IRelationalWriter> m_writer;
00043   };
00044   
00045   class OraPtrUpdater :  public IRelationalUpdater {
00046 
00047     public:
00048 
00049       OraPtrUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00050 
00051       virtual ~OraPtrUpdater();
00052       
00053       bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00054       
00055       void setRecordId( const std::vector<int>& identity );
00056       
00058       void update( int oid,
00059                    const void* data );
00060 
00061     private:
00062 
00063       Reflex::Type m_objectType;
00064       MappingElement& m_mappingElement;
00065       ContainerSchema& m_schema;
00066       DataElement m_localElement;
00067       DataElement* m_dataElement;
00068       std::auto_ptr<IRelationalUpdater> m_updater;
00069   };
00070 
00071   class OraPtrReader : public IRelationalReader {
00072 
00073       public:
00074 
00075       OraPtrReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00076 
00077       virtual ~OraPtrReader();
00078       
00079       bool build( DataElement& offset, IRelationalData& relationalData);
00080 
00081       void select( int oid );
00082       
00083       void setRecordId( const std::vector<int>& identity );
00084 
00086       void read( void* destination );
00087 
00088       void clear();
00089 
00090     private:
00091 
00092       Reflex::Type m_objectType;
00093       DataElement* m_dataElement;
00094       std::auto_ptr<OraPtrReadBuffer> m_readBuffer;
00095       std::vector<boost::shared_ptr<IPtrLoader> > m_loaders;
00096       std::vector<int> m_tmpIds;
00097   };
00098 
00099   class OraPtrStreamer : public IRelationalStreamer 
00100   {
00101     public:
00102     OraPtrStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00103 
00104     ~OraPtrStreamer();
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 #endif
00120 
00121     
00122