CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::BlobReader Class Reference

#include <BlobStreamer.h>

Inheritance diagram for ora::BlobReader:
ora::IRelationalReader

List of all members.

Public Member Functions

 BlobReader (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
bool build (DataElement &dataElement, IRelationalData &relationalData)
void clear ()
void read (void *data)
 Reads a data element.
void select (int oid)
void setRecordId (const std::vector< int > &identity)
virtual ~BlobReader ()

Private Attributes

IBlobStreamingServicem_blobReader
std::string m_columnName
DataElementm_dataElement
Reflex::Type m_objectType
IRelationalDatam_relationalData
ContainerSchemam_schema

Detailed Description

Definition at line 70 of file BlobStreamer.h.


Constructor & Destructor Documentation

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

Definition at line 116 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_blobReader( 0 ){
  
  if( mapping.columnNames().size() ){
    m_columnName = mapping.columnNames()[0];
  }
}
ora::BlobReader::~BlobReader ( ) [virtual]

Definition at line 131 of file BlobStreamer.cc.

                          {
}

Member Function Documentation

bool ora::BlobReader::build ( DataElement dataElement,
IRelationalData relationalData 
) [virtual]

Implements ora::IRelationalReader.

Definition at line 134 of file BlobStreamer.cc.

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

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

  m_dataElement = &dataElement;
  relationalData.addBlobData( m_columnName );
  m_relationalData = &relationalData;
  m_blobReader = m_schema.blobStreamingService();
  if(!m_blobReader){
    throwException("Blob Streaming Service is not installed.",
                   "BlobReader::build");
  }
  return true;
}
void ora::BlobReader::clear ( void  ) [virtual]

Implements ora::IRelationalReader.

Definition at line 169 of file BlobStreamer.cc.

                         {
}
void ora::BlobReader::read ( void *  address) [virtual]

Reads a data element.

Implements ora::IRelationalReader.

Definition at line 159 of file BlobStreamer.cc.

References ora::throwException().

                                    {
  if( ! m_dataElement ){
    throwException( "The streamer has not been built.",
                    "BlobReader::read");
  }
  void* dataElementAddress = m_dataElement->address( data );
  coral::Attribute& relDataElement = m_relationalData->data()[ m_columnName ];
  m_blobReader->read(relDataElement.data<coral::Blob>(), dataElementAddress, m_objectType );
}
void ora::BlobReader::select ( int  oid) [virtual]

Implements ora::IRelationalReader.

Definition at line 153 of file BlobStreamer.cc.

                               {
}
void ora::BlobReader::setRecordId ( const std::vector< int > &  identity) [virtual]

Implements ora::IRelationalReader.

Definition at line 156 of file BlobStreamer.cc.

                                                      {
}

Member Data Documentation

Definition at line 95 of file BlobStreamer.h.

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

Definition at line 89 of file BlobStreamer.h.

Referenced by BlobReader().

Definition at line 93 of file BlobStreamer.h.

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

Definition at line 88 of file BlobStreamer.h.

Definition at line 94 of file BlobStreamer.h.

Definition at line 90 of file BlobStreamer.h.