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 edm::TypeWithDict &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
 
edm::TypeWithDict m_objectType
 
IRelationalDatam_relationalData
 
ContainerSchemam_schema
 

Detailed Description

Definition at line 71 of file UniqueRefStreamer.h.

Constructor & Destructor Documentation

ora::UniqueRefReader::UniqueRefReader ( const edm::TypeWithDict objectType,
MappingElement mapping,
ContainerSchema contSchema 
)

Definition at line 289 of file UniqueRefStreamer.cc.

References m_columnIndexes.

291  :
292  m_objectType( objectType ),
293  m_mappingElement( mapping ),
294  m_schema( contSchema ),
295  m_dataElement( 0 ),
296  m_relationalData( 0 ),
297  m_loaders(){
298  m_columnIndexes[0]=-1;
299  m_columnIndexes[1]=-1;
300 }
edm::TypeWithDict m_objectType
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 302 of file UniqueRefStreamer.cc.

302  {
303  for(std::vector<boost::shared_ptr<RelationalRefLoader> >::const_iterator iL = m_loaders.begin();
304  iL != m_loaders.end(); ++iL ){
305  (*iL)->invalidate();
306  }
307 }
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 309 of file UniqueRefStreamer.cc.

References ora::IRelationalData::addData(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().

Referenced by psClasses.BuildThread::run().

310  {
311  m_dataElement = &dataElement;
312  const std::vector<std::string>& columns = m_mappingElement.columnNames();
313  if( columns.size() < 2 ){
314  throwException("Expected column names have not been found in the mapping.",
315  "UniqueRefReader::build");
316  }
317  // booking for ref metadata
318  m_columnIndexes[0] = relationalData.addData( columns[0],typeid(std::string) );
319  // booking for ref id
320  m_columnIndexes[1] = relationalData.addData( columns[1],typeid(int) );
321  m_relationalData = &relationalData;
322  return true;
323 }
const std::vector< std::string > & columnNames() const
IRelationalData * m_relationalData
DataElement * m_dataElement
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
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 332 of file UniqueRefStreamer.cc.

References ora::DataElement::addChild(), ora::DataElement::address(), className(), ora::ClassUtils::lookupDictionary(), edm::MemberWithDict::offset(), AlCaHLTBitMon_QueryRunRegistry::string, ora::throwException(), and tmp.

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

332  {
333  if(!m_dataElement){
334  throwException("The streamer has not been built.",
335  "UniqueRefReader::read");
336  }
337  coral::AttributeList& row = m_relationalData->data();
339  int refId = row[m_columnIndexes[1]].data<int>();
340 
341  edm::TypeWithDict refType = ClassUtils::lookupDictionary(className);
342 
343  // building the dependent buffer
344  MappingElement& depMapping = m_schema.mappingForDependentClass( refType );
345 
346  // resolving loader address
347  edm::MemberWithDict loaderMember = m_objectType.dataMemberByName("m_loader");
348  DataElement& loaderElement = m_dataElement->addChild( loaderMember.offset(), 0 );
349  void* loaderAddress = loaderElement.address( data );
350  boost::shared_ptr<IPtrLoader>* loaderPtr = static_cast<boost::shared_ptr<IPtrLoader>*>( loaderAddress );
351  // creating new loader
352  boost::shared_ptr<RelationalRefLoader> newLoader( new RelationalRefLoader( refId ) );
353  newLoader->build( refType, depMapping, m_schema );
354  m_loaders.push_back( newLoader );
355  // installing the new loader
356  boost::shared_ptr<IPtrLoader> tmp( newLoader );
357  *loaderPtr = tmp;
358 }
edm::TypeWithDict m_objectType
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:49
std::vector< boost::shared_ptr< RelationalRefLoader > > m_loaders
size_t offset() const
MemberWithDict dataMemberByName(std::string const &) const
ContainerSchema & m_schema
DataElement & addChild(size_t declaringScopeOffset, size_toffset)
Definition: DataElement.cc:27
IRelationalData * m_relationalData
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
virtual coral::AttributeList & data()=0
DataElement * m_dataElement
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::string className(const T &t)
Definition: ClassName.h:30
MappingElement & mappingForDependentClass(const edm::TypeWithDict &dependentClass, bool writeEnabled=false)
void ora::UniqueRefReader::select ( int  oid)
virtual
void ora::UniqueRefReader::setRecordId ( const std::vector< int > &  identity)
virtual

Implements ora::IRelationalReader.

Definition at line 328 of file UniqueRefStreamer.cc.

328  {
329 }

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.

edm::TypeWithDict 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.