Go to the documentation of this file.00001 #ifndef INCLUDE_ORA_PRIMITIVESTREAMER_H
00002 #define INCLUDE_ORA_PRIMITIVESTREAMER_H
00003
00004 #include "IRelationalStreamer.h"
00005
00006 #include "Reflex/Type.h"
00007
00008 namespace ora {
00009
00010 class MappingElement;
00011 class DataElement;
00012
00013 class PrimitiveStreamerBase {
00014
00015 public:
00016
00017 PrimitiveStreamerBase( const Reflex::Type& objectType, MappingElement& mapping );
00018
00019 virtual ~PrimitiveStreamerBase();
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_columnIndex;
00032 DataElement* m_dataElement;
00033 IRelationalData* m_relationalData;
00034 };
00035
00036 class PrimitiveWriter : public PrimitiveStreamerBase, public IRelationalWriter {
00037 public:
00038 PrimitiveWriter( const Reflex::Type& objectType, MappingElement& mapping );
00039
00040 virtual ~PrimitiveWriter();
00041
00042 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00043
00044 void setRecordId( const std::vector<int>& identity );
00045
00046 void write( int oid, const void* data );
00047
00048 };
00049
00050
00051 class PrimitiveUpdater : public PrimitiveStreamerBase, public IRelationalUpdater {
00052 public:
00053 PrimitiveUpdater( const Reflex::Type& objectType, MappingElement& mapping );
00054
00055 virtual ~PrimitiveUpdater();
00056
00057 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00058
00059 void setRecordId( const std::vector<int>& identity );
00060
00061 void update( int oid, const void* data );
00062
00063 };
00064
00065 class PrimitiveReader : public PrimitiveStreamerBase, public IRelationalReader {
00066 public:
00067 PrimitiveReader( const Reflex::Type& objectType, MappingElement& mapping );
00068
00069 virtual ~PrimitiveReader();
00070
00071 bool build(DataElement& dataElement, IRelationalData& relationalData );
00072
00073 void select( int oid );
00074
00075 void setRecordId( const std::vector<int>& identity );
00076
00077 void read( void* data );
00078
00079 void clear();
00080
00081 };
00082
00083 class PrimitiveStreamer : public IRelationalStreamer
00084 {
00085 public:
00086 PrimitiveStreamer( const Reflex::Type& objectType, MappingElement& mapping );
00087
00088 ~PrimitiveStreamer();
00089
00090 IRelationalWriter* newWriter();
00091
00092 IRelationalUpdater* newUpdater();
00093
00094 IRelationalReader* newReader();
00095
00096 private:
00097 Reflex::Type m_objectType;
00098 MappingElement& m_mapping;
00099 };
00100
00101 }
00102
00103
00104 #endif
00105
00106
00107