Go to the documentation of this file.00001 #ifndef INCLUDE_ORA_CARRAYSTREAMER_H
00002 #define INCLUDE_ORA_CARRAYSTREAMER_H
00003
00004 #include "DataElement.h"
00005 #include "IRelationalStreamer.h"
00006 #include "RelationalDeleter.h"
00007
00008 #include <memory>
00009
00010 #include "Reflex/Type.h"
00011
00012 namespace ora {
00013
00014 class MappingElement;
00015 class ContainerSchema;
00016
00017 class IArrayHandler;
00018 class MultiRecordInsertOperation;
00019 class MultiRecordSelectOperation;
00020
00021 class CArrayWriter : public IRelationalWriter {
00022
00023 public:
00025 CArrayWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00026 virtual ~CArrayWriter();
00027
00028 bool build( DataElement& offset, 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 Reflex::Type m_objectType;
00037 MappingElement& m_mappingElement;
00038 ContainerSchema& m_schema;
00039 std::vector<int> m_recordId;
00040 DataElement m_localElement;
00041
00042 private:
00043 DataElement* m_offset;
00044 MultiRecordInsertOperation* m_insertOperation;
00045 std::auto_ptr<IArrayHandler> m_arrayHandler;
00046 std::auto_ptr<IRelationalWriter> m_dataWriter;
00047
00048 };
00049
00050 class CArrayUpdater : public IRelationalUpdater {
00051
00052 public:
00053
00055 CArrayUpdater(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00056
00057 virtual ~CArrayUpdater();
00058
00059 bool build( DataElement& offset, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00060
00061 void setRecordId( const std::vector<int>& identity );
00062
00064 void update( int oid,const void* data );
00065
00066 private:
00067
00068 RelationalDeleter m_deleter;
00069 CArrayWriter m_writer;
00070 };
00071
00072 class CArrayReader : public IRelationalReader {
00073
00074 public:
00075
00077 CArrayReader(const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00078
00079 virtual ~CArrayReader();
00080
00081 bool build( DataElement& offset, IRelationalData& relationalData );
00082
00083 void select( int oid );
00084
00085 void setRecordId( const std::vector<int>& identity );
00086
00088 void read( void* address );
00089
00090 void clear();
00091
00092 private:
00093 Reflex::Type m_objectType;
00094 MappingElement& m_mappingElement;
00095 ContainerSchema& m_schema;
00096 std::vector<int> m_recordId;
00097 DataElement m_localElement;
00098
00099 private:
00100 DataElement* m_offset;
00101 std::auto_ptr<MultiRecordSelectOperation> m_query;
00102 std::auto_ptr<IArrayHandler> m_arrayHandler;
00103 std::auto_ptr<IRelationalReader> m_dataReader;
00104 };
00105
00106 class CArrayStreamer : public IRelationalStreamer
00107 {
00108 public:
00109 CArrayStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00110
00111 ~CArrayStreamer();
00112
00113 IRelationalWriter* newWriter();
00114
00115 IRelationalUpdater* newUpdater();
00116
00117 IRelationalReader* newReader();
00118
00119 private:
00120 Reflex::Type m_objectType;
00121 MappingElement& m_mapping;
00122 ContainerSchema& m_schema;
00123 };
00124
00125
00126 }
00127
00128 #endif
00129
00130