#include <OraPtrStreamer.h>
Public Member Functions | |
bool | build (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer) |
OraPtrWriter (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema) | |
void | setRecordId (const std::vector< int > &identity) |
void | write (int oid, const void *data) |
Writes a data element. | |
virtual | ~OraPtrWriter () |
Private Attributes | |
DataElement * | m_dataElement |
DataElement | m_localElement |
MappingElement & | m_mappingElement |
Reflex::Type | m_objectType |
ContainerSchema & | m_schema |
std::auto_ptr< IRelationalWriter > | m_writer |
Definition at line 20 of file OraPtrStreamer.h.
ora::OraPtrWriter::OraPtrWriter | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | contSchema | ||
) |
Definition at line 141 of file OraPtrStreamer.cc.
: m_objectType( objectType ), m_mappingElement( mapping ), m_schema( contSchema ), m_localElement(), m_dataElement( 0 ), m_writer(){ }
ora::OraPtrWriter::~OraPtrWriter | ( | ) | [virtual] |
Definition at line 152 of file OraPtrStreamer.cc.
{ }
bool ora::OraPtrWriter::build | ( | DataElement & | dataElement, |
IRelationalData & | relationalData, | ||
RelationalBuffer & | operationBuffer | ||
) | [virtual] |
Implements ora::IRelationalWriter.
Definition at line 155 of file OraPtrStreamer.cc.
References ora::DataElement::clear(), ora::RelationalStreamerFactory::newWriter(), ora::ClassUtils::resolvedType(), and ora::throwException().
{ m_dataElement = &dataElement; m_localElement.clear(); // Check the type Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0); Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType); // Check the component type if ( ! ptrType || !ptrResolvedType ) { throwException( "Missing dictionary information for the type of the pointer \"" + m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"", "OraPtrWriter::build" ); } std::string ptrTypeName = ptrType.Name(); // Retrieve the relevant mapping element MappingElement::iterator iMe = m_mappingElement.find( ptrTypeName ); if ( iMe == m_mappingElement.end() ) { throwException( "Item for \"" + ptrTypeName + "\" not found in the mapping element", "OraPtrWriter::build" ); } RelationalStreamerFactory streamerFactory( m_schema ); m_writer.reset( streamerFactory.newWriter( ptrResolvedType, iMe->second )); return m_writer->build( m_localElement, relationalData, operationBuffer ); }
void ora::OraPtrWriter::setRecordId | ( | const std::vector< int > & | identity | ) | [virtual] |
Implements ora::IRelationalWriter.
Definition at line 183 of file OraPtrStreamer.cc.
{ m_writer->setRecordId( identity ); }
void ora::OraPtrWriter::write | ( | int | oid, |
const void * | data | ||
) | [virtual] |
Writes a data element.
Implements ora::IRelationalWriter.
Definition at line 188 of file OraPtrStreamer.cc.
References ora::throwException().
{ if(!m_dataElement){ throwException("The streamer has not been built.", "OraPtrWriter::write"); } Reflex::Object ptrObject( m_objectType, m_dataElement->address( data ) ); // first load if required ptrObject.Invoke("load",0); // then get the data... void* ptrAddress = 0; ptrObject.Invoke("address",ptrAddress); m_writer->write( oid, ptrAddress ); }
DataElement* ora::OraPtrWriter::m_dataElement [private] |
Definition at line 41 of file OraPtrStreamer.h.
DataElement ora::OraPtrWriter::m_localElement [private] |
Definition at line 40 of file OraPtrStreamer.h.
Definition at line 38 of file OraPtrStreamer.h.
Reflex::Type ora::OraPtrWriter::m_objectType [private] |
Definition at line 37 of file OraPtrStreamer.h.
ContainerSchema& ora::OraPtrWriter::m_schema [private] |
Definition at line 39 of file OraPtrStreamer.h.
std::auto_ptr<IRelationalWriter> ora::OraPtrWriter::m_writer [private] |
Definition at line 42 of file OraPtrStreamer.h.