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 const std::vector<std::string>& m_columns;
00038 ContainerSchema& m_schema;
00039 DataElement* m_dataElement;
00040 DataElement* m_refNameDataElement;
00041 DataElement* m_ptrDataElement;
00042 DataElement* m_flagDataElement;
00043 IRelationalData* m_relationalData;
00044 };
00045
00046 class NamedRefWriter : public NamedReferenceStreamerBase, public IRelationalWriter{
00047
00048 public:
00049
00050 NamedRefWriter( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00051
00052 virtual ~NamedRefWriter();
00053
00054 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00055
00056 void setRecordId( const std::vector<int>& identity );
00057
00059 void write( int oid, const void* data );
00060
00061 };
00062
00063 class NamedRefUpdater : public NamedReferenceStreamerBase, public IRelationalUpdater {
00064
00065 public:
00066
00067 NamedRefUpdater( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00068
00069 virtual ~NamedRefUpdater();
00070
00071 bool build(DataElement& dataElement, IRelationalData& relationalData, RelationalBuffer& operationBuffer);
00072
00073 void setRecordId( const std::vector<int>& identity );
00074
00076 void update( int oid,
00077 const void* data );
00078
00079 };
00080
00081 class NamedRefReader : public NamedReferenceStreamerBase, public IRelationalReader {
00082
00083 public:
00084
00085 NamedRefReader( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00086
00087 virtual ~NamedRefReader();
00088
00089 bool build( DataElement& offset, IRelationalData& relationalData);
00090
00091 void select( int oid );
00092
00093 void setRecordId( const std::vector<int>& identity );
00094
00096 void read( void* destination );
00097
00098 void clear();
00099
00100 };
00101
00102 class NamedRefStreamer : public IRelationalStreamer
00103 {
00104 public:
00105 NamedRefStreamer( const Reflex::Type& objectType, MappingElement& mapping, ContainerSchema& contSchema );
00106
00107 ~NamedRefStreamer();
00108
00109 IRelationalWriter* newWriter();
00110
00111 IRelationalUpdater* newUpdater();
00112
00113 IRelationalReader* newReader();
00114
00115 private:
00116 Reflex::Type m_objectType;
00117 MappingElement& m_mapping;
00118 ContainerSchema& m_schema;
00119 };
00120
00121 }
00122 #endif
00123
00124
00125