#include <PrimitiveStreamer.h>
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 |
DataElement * | m_dataElement |
MappingElement & | m_mapping |
Reflex::Type | m_objectType |
IRelationalData * | m_relationalData |
Definition at line 13 of file PrimitiveStreamer.h.
ora::PrimitiveStreamerBase::PrimitiveStreamerBase | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping | ||
) |
Definition at line 11 of file PrimitiveStreamer.cc.
: m_objectType( objectType ), m_mapping(mapping), m_columnIndex(-1), m_dataElement( 0 ), m_relationalData( 0 ){ }
ora::PrimitiveStreamerBase::~PrimitiveStreamerBase | ( | ) | [virtual] |
Definition at line 20 of file PrimitiveStreamer.cc.
{ }
void ora::PrimitiveStreamerBase::bindDataForRead | ( | void * | data | ) |
Definition at line 56 of file PrimitiveStreamer.cc.
References ora::throwException().
{ if( ! m_dataElement ){ throwException( "The streamer has not been built.", "PrimitiveStreamerBase::bindDataForRead"); } void* dataElementAddress = m_dataElement->address( data ); coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ]; relDataElement.copyValueToAddress( dataElementAddress ); }
void ora::PrimitiveStreamerBase::bindDataForUpdate | ( | const void * | data | ) |
Definition at line 40 of file PrimitiveStreamer.cc.
References ora::throwException().
{ if( ! m_dataElement ){ throwException( "The streamer has not been built.", "PrimitiveStreamerBase::bindDataForUpdate"); } void* dataElementAddress = m_dataElement->address( data ); coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ]; relDataElement.setValueFromAddress( dataElementAddress ); if(!relDataElement.isValidData()){ throwException("Data provided for column \""+ relDataElement.specification().name()+ "\" is not valid for RDBMS storage.", "PrimitiveStreamerBase::bindDataForUpdate"); } }
bool ora::PrimitiveStreamerBase::buildDataElement | ( | DataElement & | dataElement, |
IRelationalData & | relationalData | ||
) |
Definition at line 23 of file PrimitiveStreamer.cc.
References ora::IRelationalData::addData(), ora::ClassUtils::isTypeString(), and ora::throwException().
{ if( m_mapping.columnNames().size()==0 ){ throwException( "The mapping element does not contain columns.", "PrimitiveStreamerBase::buildDataElement"); } const std::type_info* attrType = &m_objectType.TypeInfo(); if(m_objectType.IsEnum()) attrType = &typeid(int); if(ClassUtils::isTypeString( m_objectType )) attrType = &typeid(std::string); std::string columnName = m_mapping.columnNames()[0]; m_columnIndex = relationalData.addData( columnName, *attrType ); m_dataElement = &dataElement; m_relationalData = &relationalData; return true; }
int ora::PrimitiveStreamerBase::m_columnIndex [private] |
Definition at line 31 of file PrimitiveStreamer.h.
Definition at line 32 of file PrimitiveStreamer.h.
Definition at line 30 of file PrimitiveStreamer.h.
Reflex::Type ora::PrimitiveStreamerBase::m_objectType [private] |
Definition at line 29 of file PrimitiveStreamer.h.
Definition at line 33 of file PrimitiveStreamer.h.