CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::DependentClassReader Class Reference

List of all members.

Public Member Functions

void build (const Reflex::Type &objectType, MappingElement &depMapping, ContainerSchema &contSchema)
 DependentClassReader ()
void * read (int refId)
 ~DependentClassReader ()

Private Attributes

DataElement m_dataElement
std::auto_ptr< SelectOperationm_depQuery
std::auto_ptr< IRelationalReaderm_reader
Reflex::Type m_type

Detailed Description

Definition at line 74 of file UniqueRefStreamer.cc.


Constructor & Destructor Documentation

ora::DependentClassReader::DependentClassReader ( ) [inline]

Definition at line 76 of file UniqueRefStreamer.cc.

ora::DependentClassReader::~DependentClassReader ( ) [inline]

Definition at line 101 of file UniqueRefStreamer.cc.

                             {
      }

Member Function Documentation

void ora::DependentClassReader::build ( const Reflex::Type &  objectType,
MappingElement depMapping,
ContainerSchema contSchema 
) [inline]

Definition at line 83 of file UniqueRefStreamer.cc.

References ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_dataElement, m_depQuery, m_reader, m_type, ora::RelationalStreamerFactory::newReader(), ora::ContainerSchema::storageSchema(), ora::MappingElement::tableName(), and ora::throwException().

Referenced by ora::RelationalRefLoader::build().

                                                                                                         {

        m_type = objectType;
        m_depQuery.reset( new SelectOperation( depMapping.tableName(), contSchema.storageSchema()));
        m_depQuery->addWhereId(  depMapping.columnNames()[ 1 ] );
        MappingElement::iterator iMap = depMapping.find( m_type.Name(Reflex::SCOPED) );
        // the first inner mapping is the good one ...
        if( iMap == depMapping.end()){
          throwException("Could not find a mapping element for class \""+
                         m_type.Name(Reflex::SCOPED)+"\"",
                         "DependentClassReadBuffer::ReadBuffer");
        }
        MappingElement& mapping = iMap->second;
        RelationalStreamerFactory streamerFactory( contSchema );
        m_reader.reset( streamerFactory.newReader( m_type, mapping )) ;
        m_reader->build( m_dataElement , *m_depQuery );
      }
void* ora::DependentClassReader::read ( int  refId) [inline]

Definition at line 104 of file UniqueRefStreamer.cc.

References ora::ClassUtils::constructObject(), m_depQuery, m_reader, m_type, and ora::throwException().

Referenced by ora::RelationalRefLoader::load().

                             {
        if( !m_depQuery.get() ){
          throwException( "DependentClassReader has not been built.",
                          "DependentClassReader::read");
        }
        coral::AttributeList& whereData = m_depQuery->whereData();
        coral::AttributeList::iterator iWData = whereData.begin();
        iWData->data<int>() = refId;
        m_depQuery->execute();
        m_reader->select( refId );
        void* destination = 0;
        if( m_depQuery->nextCursorRow() ){
          destination = ClassUtils::constructObject( m_type );
          m_reader->read( destination );
        }
        m_depQuery->clear();
        return destination;
      }

Member Data Documentation

Definition at line 124 of file UniqueRefStreamer.cc.

Referenced by build().

Definition at line 127 of file UniqueRefStreamer.cc.

Referenced by build(), and read().

Definition at line 126 of file UniqueRefStreamer.cc.

Referenced by build(), and read().

Reflex::Type ora::DependentClassReader::m_type [private]

Definition at line 125 of file UniqueRefStreamer.cc.

Referenced by build(), and read().