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
std::string m_columnName
DataElementm_dataElement
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.

References ora::MappingElement::columnNames(), and m_columnName.

                                                                  :
  m_objectType( objectType ),
  m_columnName( "" ),
  m_schema( contSchema ),
  m_dataElement( 0 ),
  m_relationalData( 0 ),
  m_relationalBuffer( 0 ),
  m_blobWriter( 0 ),
  m_useCompression( true ){
  
  if( mapping.columnNames().size() ){
    m_columnName = mapping.columnNames()[0];
  }
}
ora::BlobWriterBase::~BlobWriterBase ( ) [virtual]

Definition at line 33 of file BlobStreamer.cc.

                                  {
}

Member Function Documentation

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

Definition at line 57 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_columnName ];
  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 36 of file BlobStreamer.cc.

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

                                                                             {
  if( m_columnName.empty() ){
    throwException( "Column name not found ",
                    "BlobWriterBase::build");
  }

  m_dataElement = &dataElement;
  relationalData.addBlobData( m_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 35 of file BlobStreamer.h.

std::string ora::BlobWriterBase::m_columnName [private]

Definition at line 28 of file BlobStreamer.h.

Referenced by BlobWriterBase().

Definition at line 32 of file BlobStreamer.h.

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

Definition at line 27 of file BlobStreamer.h.

Definition at line 34 of file BlobStreamer.h.

Definition at line 33 of file BlobStreamer.h.

Definition at line 29 of file BlobStreamer.h.

Definition at line 36 of file BlobStreamer.h.