CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_ORAREFERENCESTREAMER_H
00002 #define INCLUDE_ORA_ORAREFERENCESTREAMER_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   
00013   class OraReferenceStreamerBase {
00014 
00015     public:
00016 
00017     explicit OraReferenceStreamerBase( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00018 
00019     virtual ~OraReferenceStreamerBase();
00020 
00021       bool buildDataElement( DataElement& dataElement, IRelationalData& relationalData );
00022       
00023       void bindDataForUpdate( const void* data );
00024 
00025       void bindDataForRead( void* data );
00026 
00027     private:
00028 
00029       Reflex::Type m_objectType;
00030       MappingElement& m_mapping;
00031       int m_columnIndexes[2];
00032       ContainerSchema& m_schema;
00033       DataElement* m_dataElement;
00034       DataElement* m_dataElemOId0;
00035       DataElement* m_dataElemOId1;
00036       IRelationalData* m_relationalData;
00037   };
00038 
00039   class OraReferenceWriter : public OraReferenceStreamerBase, public IRelationalWriter {
00040     public:
00041     explicit OraReferenceWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00042 
00043     virtual ~OraReferenceWriter();
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   };
00052   
00053 
00054   class OraReferenceUpdater : public OraReferenceStreamerBase, public IRelationalUpdater {
00055     public:
00056     explicit OraReferenceUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00057 
00058     virtual ~OraReferenceUpdater();
00059 
00060     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00061 
00062     void setRecordId( const std::vector<int>& identity );
00063 
00064     void update( int oid, const void* data );
00065     
00066   };
00067 
00068   class OraReferenceReader : public OraReferenceStreamerBase, public IRelationalReader {
00069     public:
00070     explicit OraReferenceReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00071 
00072     virtual ~OraReferenceReader();
00073 
00074     bool build(DataElement& dataElement, IRelationalData& relationalData );
00075 
00076     void select( int oid );
00077 
00078     void setRecordId( const std::vector<int>& identity );
00079 
00080     void read( void* data );
00081 
00082     void clear();
00083     
00084   };
00085 
00086   class OraReferenceStreamer : public IRelationalStreamer 
00087   {
00088     public:
00089     explicit OraReferenceStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00090 
00091     ~OraReferenceStreamer();
00092 
00093     IRelationalWriter* newWriter();
00094 
00095     IRelationalUpdater* newUpdater();
00096 
00097     IRelationalReader* newReader();
00098 
00099     private:
00100     Reflex::Type m_objectType;
00101     MappingElement& m_mapping;
00102     ContainerSchema& m_schema;
00103   }; 
00104   
00105 }
00106 
00107 
00108 #endif
00109 
00110     
00111