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