CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ora::UniqueRefReader Class Reference

#include <UniqueRefStreamer.h>

Inheritance diagram for ora::UniqueRefReader:
ora::IRelationalReader

Public Member Functions

bool build (DataElement &offset, IRelationalData &relationalData)
 
void clear ()
 
void read (void *destination)
 Reads a data element. More...
 
void select (int oid)
 
void setRecordId (const std::vector< int > &identity)
 
 UniqueRefReader (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
 
virtual ~UniqueRefReader ()
 
- Public Member Functions inherited from ora::IRelationalReader
virtual ~IRelationalReader ()
 

Private Attributes

int m_columnIndexes [2]
 
DataElementm_dataElement
 
std::vector< boost::shared_ptr
< RelationalRefLoader > > 
m_loaders
 
MappingElementm_mappingElement
 
Reflex::Type m_objectType
 
IRelationalDatam_relationalData
 
ContainerSchemam_schema
 

Detailed Description

Definition at line 71 of file UniqueRefStreamer.h.

Constructor & Destructor Documentation

ora::UniqueRefReader::UniqueRefReader ( const Reflex::Type &  objectType,
MappingElement mapping,
ContainerSchema contSchema 
)

Definition at line 284 of file UniqueRefStreamer.cc.

References m_columnIndexes.

286  :
287  m_objectType( objectType ),
288  m_mappingElement( mapping ),
289  m_schema( contSchema ),
290  m_dataElement( 0 ),
291  m_relationalData( 0 ),
292  m_loaders(){
293  m_columnIndexes[0]=-1;
294  m_columnIndexes[1]=-1;
295 }
std::vector< boost::shared_ptr< RelationalRefLoader > > m_loaders
ContainerSchema & m_schema
IRelationalData * m_relationalData
DataElement * m_dataElement
MappingElement & m_mappingElement
ora::UniqueRefReader::~UniqueRefReader ( )
virtual

Definition at line 297 of file UniqueRefStreamer.cc.

297  {
298  for(std::vector<boost::shared_ptr<RelationalRefLoader> >::const_iterator iL = m_loaders.begin();
299  iL != m_loaders.end(); ++iL ){
300  (*iL)->invalidate();
301  }
302 }
std::vector< boost::shared_ptr< RelationalRefLoader > > m_loaders

Member Function Documentation

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().

305  {
306  m_dataElement = &dataElement;
307  const std::vector<std::string>& columns = m_mappingElement.columnNames();
308  if( columns.size() < 2 ){
309  throwException("Expected column names have not been found in the mapping.",
310  "UniqueRefReader::build");
311  }
312  // booking for ref metadata
313  m_columnIndexes[0] = relationalData.addData( columns[0],typeid(std::string) );
314  // booking for ref id
315  m_columnIndexes[1] = relationalData.addData( columns[1],typeid(int) );
316  m_relationalData = &relationalData;
317  return true;
318 }
const std::vector< std::string > & columnNames() const
IRelationalData * m_relationalData
DataElement * m_dataElement
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
MappingElement & m_mappingElement
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.

Referenced by Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

327  {
328  if(!m_dataElement){
329  throwException("The streamer has not been built.",
330  "UniqueRefReader::read");
331  }
332  coral::AttributeList& row = m_relationalData->data();
334  int refId = row[m_columnIndexes[1]].data<int>();
335 
336  Reflex::Type refType = ClassUtils::lookupDictionary(className);
337 
338  // building the dependent buffer
339  MappingElement& depMapping = m_schema.mappingForDependentClass( refType );
340 
341  // resolving loader address
342  Reflex::Member loaderMember = m_objectType.MemberByName("m_loader");
343  DataElement& loaderElement = m_dataElement->addChild( loaderMember.Offset(), 0 );
344  void* loaderAddress = loaderElement.address( data );
345  boost::shared_ptr<IPtrLoader>* loaderPtr = static_cast<boost::shared_ptr<IPtrLoader>*>( loaderAddress );
346  // creating new loader
347  boost::shared_ptr<RelationalRefLoader> newLoader( new RelationalRefLoader( refId ) );
348  newLoader->build( refType, depMapping, m_schema );
349  m_loaders.push_back( newLoader );
350  // installing the new loader
351  boost::shared_ptr<IPtrLoader> tmp( newLoader );
352  *loaderPtr = tmp;
353 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:48
std::vector< boost::shared_ptr< RelationalRefLoader > > m_loaders
DataElement & addChild(size_t declaringScopeOffset, Reflex::OffsetFunction offsetFunction)
Definition: DataElement.cc:26
ContainerSchema & m_schema
MappingElement & mappingForDependentClass(const Reflex::Type &dependentClass, bool writeEnabled=false)
IRelationalData * m_relationalData
virtual coral::AttributeList & data()=0
DataElement * m_dataElement
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:93
std::string className(const T &t)
Definition: ClassName.h:30
void ora::UniqueRefReader::select ( int  oid)
virtual
void ora::UniqueRefReader::setRecordId ( const std::vector< int > &  identity)
virtual

Implements ora::IRelationalReader.

Definition at line 323 of file UniqueRefStreamer.cc.

323  {
324 }

Member Data Documentation

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.

MappingElement& ora::UniqueRefReader::m_mappingElement
private

Definition at line 93 of file UniqueRefStreamer.h.

Reflex::Type ora::UniqueRefReader::m_objectType
private

Definition at line 92 of file UniqueRefStreamer.h.

IRelationalData* ora::UniqueRefReader::m_relationalData
private

Definition at line 97 of file UniqueRefStreamer.h.

ContainerSchema& ora::UniqueRefReader::m_schema
private

Definition at line 95 of file UniqueRefStreamer.h.