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 142 of file DatabaseContainer.cc.

Constructor & Destructor Documentation

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

Definition at line 144 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().

144  :
146  m_type( contSchema.type() ),
147  m_reader(),
148  m_topLevelQuery( contSchema.mapping().topElement().tableName(), contSchema.storageSchema() ){
149 
150  MappingElement& topLevelMapping = contSchema.mapping().topElement();
151  m_topLevelQuery.addWhereId( topLevelMapping.columnNames()[ 0 ] );
152  MappingElement::iterator iMap = topLevelMapping.find( m_type.Name(Reflex::SCOPED) );
153  // the first inner mapping is the good one ...
154  if( iMap == topLevelMapping.end()){
155  throwException("Could not find a mapping element for class \""+
156  m_type.Name(Reflex::SCOPED)+"\"",
157  "ReadBuffer::ReadBuffer");
158  }
159  MappingElement& mapping = iMap->second;
160  RelationalStreamerFactory streamerFactory( contSchema );
161  m_reader.reset( streamerFactory.newReader( m_type, mapping )) ;
163  }
DataElement m_topLevelElement
int addWhereId(const std::string &columnName)
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
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 165 of file DatabaseContainer.cc.

165  {
166  }

Member Function Documentation

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

Definition at line 168 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 Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

168  {
169  coral::AttributeList& dataBuff = m_topLevelQuery.whereData();
170  dataBuff.begin()->data<int>() = oid;
172  m_reader->select( oid );
173  void* destination = 0;
175  destination = ClassUtils::constructObject( m_type );
176  m_reader->read( destination );
177  }
178  m_reader->clear();
180  return destination;
181  }
void * constructObject(const Reflex::Type &typ)
Definition: ClassUtils.cc:127
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 190 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

DataElement ora::ReadBuffer::m_topLevelElement
private

Definition at line 188 of file DatabaseContainer.cc.

Referenced by ReadBuffer().

SelectOperation ora::ReadBuffer::m_topLevelQuery
private

Definition at line 191 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

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

Definition at line 189 of file DatabaseContainer.cc.

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