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::PrimitiveStreamerBase Class Reference

#include <PrimitiveStreamer.h>

Inheritance diagram for ora::PrimitiveStreamerBase:
ora::PrimitiveReader ora::PrimitiveUpdater ora::PrimitiveWriter

Public Member Functions

void bindDataForRead (void *data)
 
void bindDataForUpdate (const void *data)
 
bool buildDataElement (DataElement &dataElement, IRelationalData &relationalData)
 
 PrimitiveStreamerBase (const edm::TypeWithDict &objectType, MappingElement &mapping)
 
virtual ~PrimitiveStreamerBase ()
 

Private Attributes

int m_columnIndex
 
DataElementm_dataElement
 
MappingElementm_mapping
 
edm::TypeWithDict m_objectType
 
IRelationalDatam_relationalData
 

Detailed Description

Definition at line 13 of file PrimitiveStreamer.h.

Constructor & Destructor Documentation

ora::PrimitiveStreamerBase::PrimitiveStreamerBase ( const edm::TypeWithDict objectType,
MappingElement mapping 
)

Definition at line 11 of file PrimitiveStreamer.cc.

12  :
13  m_objectType( objectType ),
14  m_mapping(mapping),
15  m_columnIndex(-1),
16  m_dataElement( 0 ),
17  m_relationalData( 0 ){
18 }
IRelationalData * m_relationalData
edm::TypeWithDict m_objectType
ora::PrimitiveStreamerBase::~PrimitiveStreamerBase ( )
virtual

Definition at line 20 of file PrimitiveStreamer.cc.

20  {
21 }

Member Function Documentation

void ora::PrimitiveStreamerBase::bindDataForRead ( void *  data)

Definition at line 55 of file PrimitiveStreamer.cc.

References ora::throwException().

55  {
56  if( ! m_dataElement ){
57  throwException( "The streamer has not been built.",
58  "PrimitiveStreamerBase::bindDataForRead");
59  }
60  void* dataElementAddress = m_dataElement->address( data );
61  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
62  relDataElement.copyValueToAddress( dataElementAddress );
63 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:49
IRelationalData * m_relationalData
virtual coral::AttributeList & data()=0
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ora::PrimitiveStreamerBase::bindDataForUpdate ( const void *  data)

Definition at line 39 of file PrimitiveStreamer.cc.

References ora::throwException().

39  {
40  if( ! m_dataElement ){
41  throwException( "The streamer has not been built.",
42  "PrimitiveStreamerBase::bindDataForUpdate");
43  }
44  void* dataElementAddress = m_dataElement->address( data );
45  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
46  relDataElement.setValueFromAddress( dataElementAddress );
47  if(!relDataElement.isValidData()){
48  throwException("Data provided for column \""+
49  relDataElement.specification().name()+
50  "\" is not valid for RDBMS storage.",
51  "PrimitiveStreamerBase::bindDataForUpdate");
52  }
53 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:49
IRelationalData * m_relationalData
virtual coral::AttributeList & data()=0
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool ora::PrimitiveStreamerBase::buildDataElement ( DataElement dataElement,
IRelationalData relationalData 
)

Definition at line 23 of file PrimitiveStreamer.cc.

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

24  {
25  if( m_mapping.columnNames().size()==0 ){
26  throwException( "The mapping element does not contain columns.",
27  "PrimitiveStreamerBase::buildDataElement");
28  }
29 
30  const std::type_info* attrType = m_objectType.isEnum() ? &typeid(int) : &m_objectType.typeInfo();
31  if(ClassUtils::isTypeString( m_objectType )) attrType = &typeid(std::string);
32  std::string columnName = m_mapping.columnNames()[0];
33  m_columnIndex = relationalData.addData( columnName, *attrType );
34  m_dataElement = &dataElement;
35  m_relationalData = &relationalData;
36  return true;
37 }
bool isEnum() const
bool isTypeString(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:212
IRelationalData * m_relationalData
std::type_info const & typeInfo() const
const std::vector< std::string > & columnNames() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
edm::TypeWithDict m_objectType

Member Data Documentation

int ora::PrimitiveStreamerBase::m_columnIndex
private

Definition at line 31 of file PrimitiveStreamer.h.

DataElement* ora::PrimitiveStreamerBase::m_dataElement
private

Definition at line 32 of file PrimitiveStreamer.h.

MappingElement& ora::PrimitiveStreamerBase::m_mapping
private

Definition at line 30 of file PrimitiveStreamer.h.

edm::TypeWithDict ora::PrimitiveStreamerBase::m_objectType
private

Definition at line 29 of file PrimitiveStreamer.h.

IRelationalData* ora::PrimitiveStreamerBase::m_relationalData
private

Definition at line 33 of file PrimitiveStreamer.h.