#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 | |
int | m_columnIndexes [2] |
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 71 of file UniqueRefStreamer.h.
ora::UniqueRefReader::UniqueRefReader | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | contSchema | ||
) |
Definition at line 284 of file UniqueRefStreamer.cc.
References m_columnIndexes.
: m_objectType( objectType ), m_mappingElement( mapping ), m_schema( contSchema ), m_dataElement( 0 ), m_relationalData( 0 ), m_loaders(){ m_columnIndexes[0]=-1; m_columnIndexes[1]=-1; }
ora::UniqueRefReader::~UniqueRefReader | ( | ) | [virtual] |
Definition at line 297 of file UniqueRefStreamer.cc.
bool ora::UniqueRefReader::build | ( | DataElement & | offset, |
IRelationalData & | relationalData | ||
) | [virtual] |
Implements ora::IRelationalReader.
Definition at line 304 of file UniqueRefStreamer.cc.
References ora::IRelationalData::addData(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().
{ m_dataElement = &dataElement; const std::vector<std::string>& columns = m_mappingElement.columnNames(); if( columns.size() < 2 ){ throwException("Expected column names have not been found in the mapping.", "UniqueRefReader::build"); } // booking for ref metadata m_columnIndexes[0] = relationalData.addData( columns[0],typeid(std::string) ); // booking for ref id m_columnIndexes[1] = 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 327 of file UniqueRefStreamer.cc.
References ora::DataElement::addChild(), ora::DataElement::address(), className(), ora::ClassUtils::lookupDictionary(), AlCaHLTBitMon_QueryRunRegistry::string, 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_columnIndexes[0]].data<std::string>(); int refId = row[m_columnIndexes[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] |
int ora::UniqueRefReader::m_columnIndexes[2] [private] |
Definition at line 94 of file UniqueRefStreamer.h.
Referenced by UniqueRefReader().
DataElement* ora::UniqueRefReader::m_dataElement [private] |
Definition at line 96 of file UniqueRefStreamer.h.
std::vector<boost::shared_ptr<RelationalRefLoader> > ora::UniqueRefReader::m_loaders [private] |
Definition at line 98 of file UniqueRefStreamer.h.
Definition at line 93 of file UniqueRefStreamer.h.
Reflex::Type ora::UniqueRefReader::m_objectType [private] |
Definition at line 92 of file UniqueRefStreamer.h.
Definition at line 97 of file UniqueRefStreamer.h.
ContainerSchema& ora::UniqueRefReader::m_schema [private] |
Definition at line 95 of file UniqueRefStreamer.h.