Go to the documentation of this file.00001 #ifndef INCLUDE_ORA_UNIQUEREFSTREAMER_H
00002 #define INCLUDE_ORA_UNIQUEREFSTREAMER_H
00003
00004 #include "IRelationalStreamer.h"
00005 #include "DataElement.h"
00006 #include "RelationalBuffer.h"
00007
00008 #include <memory>
00009 #include <boost/shared_ptr.hpp>
00010
00011 #include "Reflex/Type.h"
00012
00013
00014 namespace ora {
00015
00016 class MappingElement;
00017 class ContainerSchema;
00018 class RelationalRefLoader;
00019 class DependentClassReader;
00020
00021 std::string uniqueRefNullLabel();
00022
00023 class UniqueRefWriter : public IRelationalWriter{
00024
00025 public:
00026
00027 UniqueRefWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00028
00029 virtual ~UniqueRefWriter();
00030
00031 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00032
00033 void setRecordId( const std::vector<int>& identity );
00034
00036 void write( int oid, const void* data );
00037
00038 private:
00039
00040 Reflex::Type m_objectType;
00041 MappingElement& m_mappingElement;
00042 ContainerSchema& m_schema;
00043 DataElement* m_dataElement;
00044 IRelationalData* m_relationalData;
00045 RelationalBuffer* m_operationBuffer;
00046 };
00047
00048 class UniqueRefUpdater : public IRelationalUpdater {
00049
00050 public:
00051
00052 UniqueRefUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00053
00054 virtual ~UniqueRefUpdater();
00055
00056 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00057
00058 void setRecordId( const std::vector<int>& identity );
00059
00061 void update( int oid,
00062 const void* data );
00063
00064 private:
00065
00066 UniqueRefWriter m_writer;
00067
00068 };
00069
00070 class UniqueRefReader : public IRelationalReader {
00071
00072 public:
00073
00074 UniqueRefReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00075
00076 virtual ~UniqueRefReader();
00077
00078 bool build( DataElement& offset, IRelationalData& relationalData);
00079
00080 void select( int oid );
00081
00082 void setRecordId( const std::vector<int>& identity );
00083
00085 void read( void* destination );
00086
00087 void clear();
00088
00089 private:
00090
00091 Reflex::Type m_objectType;
00092 MappingElement& m_mappingElement;
00093 ContainerSchema& m_schema;
00094 DataElement* m_dataElement;
00095 IRelationalData* m_relationalData;
00096 std::vector<boost::shared_ptr<RelationalRefLoader> > m_loaders;
00097 };
00098
00099 class UniqueRefStreamer : public IRelationalStreamer
00100 {
00101 public:
00102 UniqueRefStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00103
00104 ~UniqueRefStreamer();
00105
00106 IRelationalWriter* newWriter();
00107
00108 IRelationalUpdater* newUpdater();
00109
00110 IRelationalReader* newReader();
00111
00112 private:
00113 Reflex::Type m_objectType;
00114 MappingElement& m_mapping;
00115 ContainerSchema& m_schema;
00116 };
00117
00118 }
00119 #endif
00120
00121
00122