CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::OraPtrReader Class Reference

#include <OraPtrStreamer.h>

Inheritance diagram for ora::OraPtrReader:
ora::IRelationalReader

List of all members.

Public Member Functions

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

Private Attributes

DataElementm_dataElement
std::vector< boost::shared_ptr
< IPtrLoader > > 
m_loaders
Reflex::Type m_objectType
std::auto_ptr< OraPtrReadBufferm_readBuffer
std::vector< int > m_tmpIds

Detailed Description

Definition at line 71 of file OraPtrStreamer.h.


Constructor & Destructor Documentation

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

Definition at line 266 of file OraPtrStreamer.cc.

References m_readBuffer.

                                                              :
  m_objectType( objectType ),
  m_dataElement( 0 ),
  m_readBuffer(),
  m_loaders(),
  m_tmpIds(){
  m_readBuffer.reset( new OraPtrReadBuffer( objectType, mapping, contSchema ));
}
ora::OraPtrReader::~OraPtrReader ( ) [virtual]

Definition at line 277 of file OraPtrStreamer.cc.

                              {
  for(std::vector<boost::shared_ptr<IPtrLoader> >::const_iterator iL = m_loaders.begin();
      iL != m_loaders.end(); ++iL ){
    (*iL)->invalidate();
  }
}

Member Function Documentation

bool ora::OraPtrReader::build ( DataElement offset,
IRelationalData relationalData 
) [virtual]

Implements ora::IRelationalReader.

Definition at line 284 of file OraPtrStreamer.cc.

References ora::DataElement::clear().

                                                 {
  m_dataElement = &dataElement;
  m_tmpIds.clear();
  m_tmpIds.push_back(0);
  return m_readBuffer->build( dataElement );
}
void ora::OraPtrReader::clear ( void  ) [virtual]

Implements ora::IRelationalReader.

Definition at line 322 of file OraPtrStreamer.cc.

                           {
}
void ora::OraPtrReader::read ( void *  destination) [virtual]

Reads a data element.

Read a data element.

Implements ora::IRelationalReader.

Definition at line 305 of file OraPtrStreamer.cc.

References ora::DataElement::addChild(), ora::DataElement::address(), and ora::throwException().

                                      {
  if(!m_dataElement){
    throwException("The streamer has not been built.",
                   "OraPtrReader::read");    
  }
  // resolving loader address
  Reflex::Member loaderMember = m_objectType.MemberByName("m_loader");
  DataElement& loaderElement = m_dataElement->addChild( loaderMember.Offset(), 0 );
  void* loaderAddress = loaderElement.address( data );
  boost::shared_ptr<IPtrLoader>* loaderPtr = static_cast<boost::shared_ptr<IPtrLoader>*>( loaderAddress );
  // creating new loader
  boost::shared_ptr<IPtrLoader> newLoader( new RelationalPtrLoader( *m_readBuffer, m_tmpIds ) );
  m_loaders.push_back( newLoader );
  // installing the new loader
  *loaderPtr = newLoader;
}
void ora::OraPtrReader::select ( int  oid) [virtual]

Implements ora::IRelationalReader.

Definition at line 292 of file OraPtrStreamer.cc.

References ora::throwException().

                                     {
  if(!m_dataElement) throwException( "The streamer has not been built.","OraPtrReader::select");
  m_tmpIds[0] = oid;
}
void ora::OraPtrReader::setRecordId ( const std::vector< int > &  identity) [virtual]

Implements ora::IRelationalReader.

Definition at line 297 of file OraPtrStreamer.cc.

References i.

                                                                 {
  m_tmpIds.resize( 1+identity.size() );
  for( size_t i=0;i<identity.size();i++){
    m_tmpIds[1+i] = identity[i];
  }
}

Member Data Documentation

Definition at line 93 of file OraPtrStreamer.h.

std::vector<boost::shared_ptr<IPtrLoader> > ora::OraPtrReader::m_loaders [private]

Definition at line 95 of file OraPtrStreamer.h.

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

Definition at line 92 of file OraPtrStreamer.h.

Definition at line 94 of file OraPtrStreamer.h.

Referenced by OraPtrReader().

std::vector<int> ora::OraPtrReader::m_tmpIds [private]

Definition at line 96 of file OraPtrStreamer.h.