CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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       const std::vector<std::string>& m_columns;
00031       ContainerSchema& m_schema;
00032       DataElement* m_dataElement;
00033       DataElement* m_dataElemOId0;
00034       DataElement* m_dataElemOId1;
00035       IRelationalData* m_relationalData;
00036   };
00037 
00038   class OraReferenceWriter : public OraReferenceStreamerBase, public IRelationalWriter {
00039     public:
00040     explicit OraReferenceWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00041 
00042     virtual ~OraReferenceWriter();
00043 
00044     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00045 
00046     void setRecordId( const std::vector<int>& identity );
00047 
00048     void write( int oid, const void* data );
00049     
00050   };
00051   
00052 
00053   class OraReferenceUpdater : public OraReferenceStreamerBase, public IRelationalUpdater {
00054     public:
00055     explicit OraReferenceUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00056 
00057     virtual ~OraReferenceUpdater();
00058 
00059     bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00060 
00061     void setRecordId( const std::vector<int>& identity );
00062 
00063     void update( int oid, const void* data );
00064     
00065   };
00066 
00067   class OraReferenceReader : public OraReferenceStreamerBase, public IRelationalReader {
00068     public:
00069     explicit OraReferenceReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00070 
00071     virtual ~OraReferenceReader();
00072 
00073     bool build(DataElement& dataElement, IRelationalData& relationalData );
00074 
00075     void select( int oid );
00076 
00077     void setRecordId( const std::vector<int>& identity );
00078 
00079     void read( void* data );
00080 
00081     void clear();
00082     
00083   };
00084 
00085   class OraReferenceStreamer : public IRelationalStreamer 
00086   {
00087     public:
00088     explicit OraReferenceStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& schema );
00089 
00090     ~OraReferenceStreamer();
00091 
00092     IRelationalWriter* newWriter();
00093 
00094     IRelationalUpdater* newUpdater();
00095 
00096     IRelationalReader* newReader();
00097 
00098     private:
00099     Reflex::Type m_objectType;
00100     MappingElement& m_mapping;
00101     ContainerSchema& m_schema;
00102   }; 
00103   
00104 }
00105 
00106 
00107 #endif
00108 
00109     
00110