#include <NamedRefStreamer.h>
Public Member Functions | |
void | bindDataForRead (void *data) |
void | bindDataForUpdate (const void *data) |
bool | buildDataElement (DataElement &dataElement, IRelationalData &relationalData) |
NamedReferenceStreamerBase (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &schema) | |
virtual | ~NamedReferenceStreamerBase () |
Private Attributes | |
int | m_columnIndex |
DataElement * | m_dataElement |
DataElement * | m_flagDataElement |
MappingElement & | m_mapping |
Reflex::Type | m_objectType |
DataElement * | m_ptrDataElement |
DataElement * | m_refNameDataElement |
IRelationalData * | m_relationalData |
ContainerSchema & | m_schema |
Definition at line 20 of file NamedRefStreamer.h.
ora::NamedReferenceStreamerBase::NamedReferenceStreamerBase | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | schema | ||
) | [explicit] |
Definition at line 19 of file NamedRefStreamer.cc.
: m_objectType( objectType ), m_mapping( mapping ), m_columnIndex( -1 ), m_schema( schema ), m_dataElement( 0 ), m_refNameDataElement( 0 ), m_ptrDataElement( 0 ), m_flagDataElement( 0 ), m_relationalData( 0 ){ }
ora::NamedReferenceStreamerBase::~NamedReferenceStreamerBase | ( | ) | [virtual] |
Definition at line 33 of file NamedRefStreamer.cc.
{ }
void ora::NamedReferenceStreamerBase::bindDataForRead | ( | void * | data | ) |
Definition at line 83 of file NamedRefStreamer.cc.
References mergeVDriftHistosByStation::name, ora::namedRefNullLabel(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().
{ if(!m_relationalData){ throwException("The streamer has not been built.", "NamedReferenceStreamerBase::bindDataForRead"); } void* refNameAddress = m_refNameDataElement->address( data ); void* ptrAddress = m_ptrDataElement->address( data ); void* flagAddress = m_flagDataElement->address( data ); coral::Attribute& refNameAttr = m_relationalData->data()[ m_columnIndex ]; std::string name = refNameAttr.data<std::string>(); if( name == namedRefNullLabel() ){ name = std::string(""); } if(!name.empty()){ Reflex::Type namedRefType = m_objectType.TemplateArgumentAt(0); boost::shared_ptr<void> ptr = m_schema.dbSession().fetchTypedObjectByName( name, namedRefType ); *static_cast<boost::shared_ptr<void>*>(ptrAddress) = ptr; *static_cast<bool*>(flagAddress) = true; } *static_cast<std::string*>(refNameAddress) = name; }
void ora::NamedReferenceStreamerBase::bindDataForUpdate | ( | const void * | data | ) |
Definition at line 70 of file NamedRefStreamer.cc.
References mergeVDriftHistosByStation::name, ora::namedRefNullLabel(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().
{ if(!m_relationalData){ throwException("The streamer has not been built.", "NamedReferenceStreamerBase::bindDataForUpdate"); } void* refNameAddress = m_refNameDataElement->address( data ); coral::Attribute& refNameAttr = m_relationalData->data()[ m_columnIndex ]; std::string name = *static_cast<std::string*>(refNameAddress); if( name.empty() ) name = namedRefNullLabel(); refNameAttr.data<std::string>()= name; }
bool ora::NamedReferenceStreamerBase::buildDataElement | ( | DataElement & | dataElement, |
IRelationalData & | relationalData | ||
) |
Definition at line 37 of file NamedRefStreamer.cc.
References ora::DataElement::addChild(), ora::IRelationalData::addData(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().
{ m_dataElement = &dataElement; m_objectType.UpdateMembers(); Reflex::Member nameMember = m_objectType.DataMemberByName("m_name"); if( !nameMember ){ throwException("Data member \"m_name\" not found in class \""+m_objectType.Name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } m_refNameDataElement = &dataElement.addChild( nameMember.Offset(), 0 ); Reflex::Member ptrMember = m_objectType.DataMemberByName("m_ptr"); if( !ptrMember ){ throwException("Data member \"m_ptr\" not found in class \""+m_objectType.Name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } m_ptrDataElement = &dataElement.addChild( ptrMember.Offset(), 0 ); Reflex::Member flagMember = m_objectType.DataMemberByName("m_isPersistent"); if( !flagMember ){ throwException("Data member \"m_isPersistent\" not found in class \""+m_objectType.Name()+"\".", "NamedReferenceStreamerBase::buildDataElement"); } m_flagDataElement = &dataElement.addChild( flagMember.Offset(), 0 ); // then book the column in the data attribute... const std::vector<std::string>& columns = m_mapping.columnNames(); if( columns.size()==0 ){ throwException("No columns found in the mapping element", "NamedReferenceStreamerBase::buildDataElement"); } m_columnIndex = relationalData.addData( columns[0], typeid(std::string) ); m_relationalData = &relationalData; return true; }
int ora::NamedReferenceStreamerBase::m_columnIndex [private] |
Definition at line 38 of file NamedRefStreamer.h.
Definition at line 40 of file NamedRefStreamer.h.
Definition at line 43 of file NamedRefStreamer.h.
Definition at line 37 of file NamedRefStreamer.h.
Reflex::Type ora::NamedReferenceStreamerBase::m_objectType [private] |
Definition at line 36 of file NamedRefStreamer.h.
Definition at line 42 of file NamedRefStreamer.h.
Definition at line 41 of file NamedRefStreamer.h.
Definition at line 44 of file NamedRefStreamer.h.
Definition at line 39 of file NamedRefStreamer.h.