#include <UniqueRefStreamer.h>
Public Member Functions | |
bool | build (DataElement &offset, IRelationalData &relationalData) |
void | clear () |
void | read (void *destination) |
Reads a data element. | |
void | select (int oid) |
void | setRecordId (const std::vector< int > &identity) |
UniqueRefReader (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema) | |
virtual | ~UniqueRefReader () |
Private Attributes | |
DataElement * | m_dataElement |
std::vector< boost::shared_ptr < RelationalRefLoader > > | m_loaders |
MappingElement & | m_mappingElement |
Reflex::Type | m_objectType |
IRelationalData * | m_relationalData |
ContainerSchema & | m_schema |
Definition at line 70 of file UniqueRefStreamer.h.
ora::UniqueRefReader::UniqueRefReader | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | contSchema | ||
) |
Definition at line 277 of file UniqueRefStreamer.cc.
: m_objectType( objectType ), m_mappingElement( mapping ), m_schema( contSchema ), m_dataElement( 0 ), m_relationalData( 0 ), m_loaders(){ }
ora::UniqueRefReader::~UniqueRefReader | ( | ) | [virtual] |
Definition at line 288 of file UniqueRefStreamer.cc.
bool ora::UniqueRefReader::build | ( | DataElement & | offset, |
IRelationalData & | relationalData | ||
) | [virtual] |
Implements ora::IRelationalReader.
Definition at line 295 of file UniqueRefStreamer.cc.
References ora::IRelationalData::addData().
{ m_dataElement = &dataElement; const std::vector<std::string>& columns = m_mappingElement.columnNames(); // booking for ref metadata relationalData.addData( columns[0],typeid(std::string) ); // booking for ref id relationalData.addData( columns[1],typeid(int) ); m_relationalData = &relationalData; return true; }
void ora::UniqueRefReader::clear | ( | void | ) | [virtual] |
void ora::UniqueRefReader::read | ( | void * | destination | ) | [virtual] |
Reads a data element.
Read a data element.
Implements ora::IRelationalReader.
Definition at line 314 of file UniqueRefStreamer.cc.
References ora::DataElement::addChild(), ora::DataElement::address(), className(), ora::ClassUtils::lookupDictionary(), ora::throwException(), and tmp.
{ if(!m_dataElement){ throwException("The streamer has not been built.", "UniqueRefReader::read"); } coral::AttributeList& row = m_relationalData->data(); std::string className = row[m_mappingElement.columnNames()[0]].data<std::string>(); int refId = row[m_mappingElement.columnNames()[1]].data<int>(); Reflex::Type refType = ClassUtils::lookupDictionary(className); // building the dependent buffer MappingElement& depMapping = m_schema.mappingForDependentClass( refType ); // resolving loader address Reflex::Member loaderMember = m_objectType.MemberByName("m_loader"); DataElement& loaderElement = m_dataElement->addChild( loaderMember.Offset(), 0 ); void* loaderAddress = loaderElement.address( data ); boost::shared_ptr<IPtrLoader>* loaderPtr = static_cast<boost::shared_ptr<IPtrLoader>*>( loaderAddress ); // creating new loader boost::shared_ptr<RelationalRefLoader> newLoader( new RelationalRefLoader( refId ) ); newLoader->build( refType, depMapping, m_schema ); m_loaders.push_back( newLoader ); // installing the new loader boost::shared_ptr<IPtrLoader> tmp( newLoader ); *loaderPtr = tmp; }
void ora::UniqueRefReader::select | ( | int | oid | ) | [virtual] |
void ora::UniqueRefReader::setRecordId | ( | const std::vector< int > & | identity | ) | [virtual] |
DataElement* ora::UniqueRefReader::m_dataElement [private] |
Definition at line 94 of file UniqueRefStreamer.h.
std::vector<boost::shared_ptr<RelationalRefLoader> > ora::UniqueRefReader::m_loaders [private] |
Definition at line 96 of file UniqueRefStreamer.h.
Definition at line 92 of file UniqueRefStreamer.h.
Reflex::Type ora::UniqueRefReader::m_objectType [private] |
Definition at line 91 of file UniqueRefStreamer.h.
Definition at line 95 of file UniqueRefStreamer.h.
ContainerSchema& ora::UniqueRefReader::m_schema [private] |
Definition at line 93 of file UniqueRefStreamer.h.