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