CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ora::ReadBuffer Class Reference

Public Member Functions

void * read (int oid)
 
 ReadBuffer (ContainerSchema &contSchema)
 
const Reflex::Type & type ()
 
 ~ReadBuffer ()
 

Private Attributes

std::auto_ptr< IRelationalReaderm_reader
 
DataElement m_topLevelElement
 
SelectOperation m_topLevelQuery
 
const Reflex::Type & m_type
 

Detailed Description

Definition at line 155 of file DatabaseContainer.cc.

Constructor & Destructor Documentation

ora::ReadBuffer::ReadBuffer ( ContainerSchema contSchema)
inlineexplicit

Definition at line 157 of file DatabaseContainer.cc.

References ora::SelectOperation::addWhereId(), ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_reader, m_topLevelElement, m_topLevelQuery, m_type, ora::ContainerSchema::mapping(), ora::RelationalStreamerFactory::newReader(), ora::throwException(), and ora::MappingTree::topElement().

157  :
159  m_type( contSchema.type() ),
160  m_reader(),
161  m_topLevelQuery( contSchema.mapping().topElement().tableName(), contSchema.storageSchema() ){
162 
163  MappingElement& topLevelMapping = contSchema.mapping().topElement();
164  m_topLevelQuery.addWhereId( topLevelMapping.columnNames()[ 0 ] );
165  MappingElement::iterator iMap = topLevelMapping.find( m_type.Name(Reflex::SCOPED) );
166  // the first inner mapping is the good one ...
167  if( iMap == topLevelMapping.end()){
168  throwException("Could not find a mapping element for class \""+
169  m_type.Name(Reflex::SCOPED)+"\"",
170  "ReadBuffer::ReadBuffer");
171  }
172  MappingElement& mapping = iMap->second;
173  RelationalStreamerFactory streamerFactory( contSchema );
174  m_reader.reset( streamerFactory.newReader( m_type, mapping )) ;
176  }
DataElement m_topLevelElement
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
void addWhereId(const std::string &columnName)
const Reflex::Type & m_type
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
std::auto_ptr< IRelationalReader > m_reader
SelectOperation m_topLevelQuery
ora::ReadBuffer::~ReadBuffer ( )
inline

Definition at line 178 of file DatabaseContainer.cc.

178  {
179  }

Member Function Documentation

void* ora::ReadBuffer::read ( int  oid)
inline

Definition at line 181 of file DatabaseContainer.cc.

References ora::SelectOperation::clear(), ora::ClassUtils::constructObject(), ora::SelectOperation::execute(), m_reader, m_topLevelQuery, m_type, ora::SelectOperation::nextCursorRow(), and ora::SelectOperation::whereData().

Referenced by python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and python.Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

181  {
182  coral::AttributeList& dataBuff = m_topLevelQuery.whereData();
183  dataBuff.begin()->data<int>() = oid;
185  m_reader->select( oid );
186  void* destination = 0;
188  destination = ClassUtils::constructObject( m_type );
189  m_reader->read( destination );
190  }
191  m_reader->clear();
193  return destination;
194  }
void * constructObject(const Reflex::Type &typ)
Definition: ClassUtils.cc:118
coral::AttributeList & whereData()
const Reflex::Type & m_type
std::auto_ptr< IRelationalReader > m_reader
SelectOperation m_topLevelQuery
const Reflex::Type& ora::ReadBuffer::type ( )
inline

Member Data Documentation

std::auto_ptr<IRelationalReader> ora::ReadBuffer::m_reader
private

Definition at line 203 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

DataElement ora::ReadBuffer::m_topLevelElement
private

Definition at line 201 of file DatabaseContainer.cc.

Referenced by ReadBuffer().

SelectOperation ora::ReadBuffer::m_topLevelQuery
private

Definition at line 204 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

const Reflex::Type& ora::ReadBuffer::m_type
private

Definition at line 202 of file DatabaseContainer.cc.

Referenced by read(), ReadBuffer(), and type().