CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::OraPtrReadBuffer Class Reference

List of all members.

Public Member Functions

bool build (DataElement &dataElement)
 OraPtrReadBuffer (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void * read (const std::vector< int > &fullId)
 ~OraPtrReadBuffer ()

Private Attributes

DataElementm_dataElement
DataElement m_localElement
MappingElementm_mapping
Reflex::Type m_objectType
SelectOperation m_query
std::auto_ptr< IRelationalReaderm_reader
ContainerSchemam_schema

Detailed Description

Definition at line 16 of file OraPtrStreamer.cc.


Constructor & Destructor Documentation

ora::OraPtrReadBuffer::OraPtrReadBuffer ( const Reflex::Type &  objectType,
MappingElement mapping,
ContainerSchema contSchema 
) [inline]

Definition at line 18 of file OraPtrStreamer.cc.

                  {
      }

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

Definition at line 28 of file OraPtrStreamer.cc.

                                            {

Member Function Documentation

bool ora::OraPtrReadBuffer::build ( DataElement dataElement) [inline]

Definition at line 31 of file OraPtrStreamer.cc.

References ora::SelectOperation::addWhereId(), i, and m_query.

                                      {
          m_query.addWhereId( columns[ i ] );
        }
        
        // Check the  type
        Reflex::Type ptrType = m_objectType.TemplateArgumentAt(0);
        Reflex::Type ptrResolvedType = ClassUtils::resolvedType(ptrType);
        // Check the component type
        if ( ! ptrType || !ptrResolvedType ) {
          throwException( "Missing dictionary information for the type of the pointer \"" +
                          m_objectType.Name(Reflex::SCOPED|Reflex::FINAL) + "\"",
                          "OraPtrReadBuffer::build" );
        }

        std::string ptrTypeName = ptrType.Name();
        // Retrieve the relevant mapping element
        MappingElement::iterator iMe = m_mapping.find( ptrTypeName );
        if ( iMe == m_mapping.end() ) {
          throwException( "Item for \"" + ptrTypeName + "\" not found in the mapping element",
                          "OraPtrReadBuffer::build" );
        }
        RelationalStreamerFactory streamerFactory( m_schema );
        m_reader.reset( streamerFactory.newReader( ptrResolvedType, iMe->second ) );
        return m_reader->build( m_localElement, m_query );     
      }
      
void* ora::OraPtrReadBuffer::read ( const std::vector< int > &  fullId) [inline]

Definition at line 63 of file OraPtrStreamer.cc.

                                                                                                   {
          if( i<fullId.size() ){
            iCol->data<int>() = fullId[i];
          }
          i++;
        }
        
        std::vector<int> recordId( fullId.size()-1 );
        for( size_t i=0; i<fullId.size()-1; i++ ){
          recordId[i] = fullId[i+1];
          ++i;
        }
        
        m_query.execute();
        m_reader->select( fullId[0] );
        void* destination = 0;
        if( m_query.nextCursorRow() ){
          destination = ClassUtils::constructObject( m_objectType.TemplateArgumentAt(0) );
          m_reader->setRecordId( recordId );
          m_reader->read( destination );
        }
        m_query.clear();
        return destination;
      }
      

Member Data Documentation

Definition at line 102 of file OraPtrStreamer.cc.

Definition at line 100 of file OraPtrStreamer.cc.

Definition at line 98 of file OraPtrStreamer.cc.

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

Definition at line 97 of file OraPtrStreamer.cc.

Definition at line 101 of file OraPtrStreamer.cc.

Referenced by build().

Definition at line 103 of file OraPtrStreamer.cc.

Definition at line 99 of file OraPtrStreamer.cc.