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 Reflex::Type &objectType, MappingElement &mapping)
 
virtual ~PrimitiveStreamerBase ()
 

Private Attributes

int m_columnIndex
 
DataElementm_dataElement
 
MappingElementm_mapping
 
Reflex::Type m_objectType
 
IRelationalDatam_relationalData
 

Detailed Description

Definition at line 13 of file PrimitiveStreamer.h.

Constructor & Destructor Documentation

ora::PrimitiveStreamerBase::PrimitiveStreamerBase ( const Reflex::Type &  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
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 56 of file PrimitiveStreamer.cc.

References ora::throwException().

56  {
57  if( ! m_dataElement ){
58  throwException( "The streamer has not been built.",
59  "PrimitiveStreamerBase::bindDataForRead");
60  }
61  void* dataElementAddress = m_dataElement->address( data );
62  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
63  relDataElement.copyValueToAddress( dataElementAddress );
64 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:48
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 40 of file PrimitiveStreamer.cc.

References ora::throwException().

40  {
41  if( ! m_dataElement ){
42  throwException( "The streamer has not been built.",
43  "PrimitiveStreamerBase::bindDataForUpdate");
44  }
45  void* dataElementAddress = m_dataElement->address( data );
46  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
47  relDataElement.setValueFromAddress( dataElementAddress );
48  if(!relDataElement.isValidData()){
49  throwException("Data provided for column \""+
50  relDataElement.specification().name()+
51  "\" is not valid for RDBMS storage.",
52  "PrimitiveStreamerBase::bindDataForUpdate");
53  }
54 }
void * address(const void *topLevelAddress) const
Definition: DataElement.cc:48
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.TypeInfo();
31  if(m_objectType.IsEnum()) attrType = &typeid(int);
32  if(ClassUtils::isTypeString( m_objectType )) attrType = &typeid(std::string);
33  std::string columnName = m_mapping.columnNames()[0];
34  m_columnIndex = relationalData.addData( columnName, *attrType );
35  m_dataElement = &dataElement;
36  m_relationalData = &relationalData;
37  return true;
38 }
bool isTypeString(const Reflex::Type &typ)
Definition: ClassUtils.cc:137
IRelationalData * m_relationalData
const std::vector< std::string > & columnNames() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10

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.

Reflex::Type 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.