CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::BlobWriterBase Class Reference

#include <BlobStreamer.h>

Inheritance diagram for ora::BlobWriterBase:
ora::BlobUpdater ora::BlobWriter

List of all members.

Public Member Functions

void bindData (const void *data)
 BlobWriterBase (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
bool buildDataElement (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
virtual ~BlobWriterBase ()

Private Attributes

IBlobStreamingServicem_blobWriter
int m_columnIndex
DataElementm_dataElement
MappingElementm_mapping
Reflex::Type m_objectType
RelationalBufferm_relationalBuffer
IRelationalDatam_relationalData
ContainerSchemam_schema
bool m_useCompression

Detailed Description

Definition at line 15 of file BlobStreamer.h.


Constructor & Destructor Documentation

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

Definition at line 16 of file BlobStreamer.cc.

                                                                  :
  m_objectType( objectType ),
  m_mapping( mapping ),
  m_columnIndex(-1),
  m_schema( contSchema ),
  m_dataElement( 0 ),
  m_relationalData( 0 ),
  m_relationalBuffer( 0 ),
  m_blobWriter( 0 ),
  m_useCompression( true ){
}
ora::BlobWriterBase::~BlobWriterBase ( ) [virtual]

Definition at line 30 of file BlobStreamer.cc.

                                  {
}

Member Function Documentation

void ora::BlobWriterBase::bindData ( const void *  data)

Definition at line 55 of file BlobStreamer.cc.

References ora::throwException().

                                                  {
  if( ! m_dataElement ){
    throwException( "The streamer has not been built.",
                    "BlobWriterBase::bindData");
  }
  void* dataElementAddress = m_dataElement->address( data );
  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
  boost::shared_ptr<coral::Blob> blobData = m_blobWriter->write( dataElementAddress, m_objectType, m_useCompression );
  m_relationalBuffer->storeBlob( blobData );
  relDataElement.bind<coral::Blob>( *blobData );
}
bool ora::BlobWriterBase::buildDataElement ( DataElement dataElement,
IRelationalData relationalData,
RelationalBuffer operationBuffer 
)

Definition at line 33 of file BlobStreamer.cc.

References ora::IRelationalData::addBlobData(), ora::poolSchemaVersion(), and ora::throwException().

                                                                             {
  if( m_mapping.columnNames().size() == 0 ){
    throwException( "The mapping element does not contain columns.",
                    "BlobWriterBase::build");
  }

  m_dataElement = &dataElement;
  std::string columnName = m_mapping.columnNames()[0];
  m_columnIndex = relationalData.addBlobData( columnName );
  m_relationalData = &relationalData;
  m_relationalBuffer = &operationBuffer;
  m_blobWriter = m_schema.blobStreamingService();
  if(!m_blobWriter){
    throwException("Blob Streaming Service is not installed.",
                   "BlobWriterBase::::build");
  }
  if( m_schema.dbSession().schema().mainTable().schemaVersion()==poolSchemaVersion() ) m_useCompression = false;
  return true;
}

Member Data Documentation

Definition at line 36 of file BlobStreamer.h.

Definition at line 29 of file BlobStreamer.h.

Definition at line 33 of file BlobStreamer.h.

Definition at line 28 of file BlobStreamer.h.

Reflex::Type ora::BlobWriterBase::m_objectType [private]

Definition at line 27 of file BlobStreamer.h.

Definition at line 35 of file BlobStreamer.h.

Definition at line 34 of file BlobStreamer.h.

Definition at line 30 of file BlobStreamer.h.

Definition at line 37 of file BlobStreamer.h.