test
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 edm::TypeWithDicttype ()
 
 ~ReadBuffer ()
 

Private Attributes

std::auto_ptr< IRelationalReaderm_reader
 
DataElement m_topLevelElement
 
SelectOperation m_topLevelQuery
 
const edm::TypeWithDictm_type
 

Detailed Description

Definition at line 144 of file DatabaseContainer.cc.

Constructor & Destructor Documentation

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

Definition at line 146 of file DatabaseContainer.cc.

References ora::SelectOperation::addWhereId(), ora::MappingElement::columnNames(), edm::TypeWithDict::cppName(), 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().

146  :
148  m_type( contSchema.type() ),
149  m_reader(),
150  m_topLevelQuery( contSchema.mapping().topElement().tableName(), contSchema.storageSchema() ){
151 
152  MappingElement& topLevelMapping = contSchema.mapping().topElement();
153  m_topLevelQuery.addWhereId( topLevelMapping.columnNames()[ 0 ] );
154  MappingElement::iterator iMap = topLevelMapping.find( m_type.cppName() );
155  // the first inner mapping is the good one ...
156  if( iMap == topLevelMapping.end()){
157  throwException("Could not find a mapping element for class \""+
158  m_type.cppName()+"\"",
159  "ReadBuffer::ReadBuffer");
160  }
161  MappingElement& mapping = iMap->second;
162  RelationalStreamerFactory streamerFactory( contSchema );
163  m_reader.reset( streamerFactory.newReader( m_type, mapping )) ;
165  }
DataElement m_topLevelElement
int addWhereId(const std::string &columnName)
std::string cppName() const
std::map< std::string, MappingElement >::iterator iterator
Iterator definition.
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
std::auto_ptr< IRelationalReader > m_reader
const edm::TypeWithDict & m_type
SelectOperation m_topLevelQuery
ora::ReadBuffer::~ReadBuffer ( )
inline

Definition at line 167 of file DatabaseContainer.cc.

167  {
168  }

Member Function Documentation

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

Definition at line 170 of file DatabaseContainer.cc.

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

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches().

170  {
171  coral::AttributeList& dataBuff = m_topLevelQuery.whereData();
172  dataBuff.begin()->data<int>() = oid;
174  m_reader->select( oid );
175  void* destination = 0;
177  destination = ClassUtils::constructObject( m_type );
178  m_reader->read( destination );
179  } else {
180  throwException("Object with item id "+boost::lexical_cast<std::string>(oid)+" has not been found in the database.",
181  "ReadBuffer::read");
182  }
183  m_reader->clear();
185  return destination;
186  }
coral::AttributeList & whereData()
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
void * constructObject(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:205
std::auto_ptr< IRelationalReader > m_reader
const edm::TypeWithDict & m_type
SelectOperation m_topLevelQuery
const edm::TypeWithDict& ora::ReadBuffer::type ( )
inline

Member Data Documentation

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

Definition at line 195 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

DataElement ora::ReadBuffer::m_topLevelElement
private

Definition at line 193 of file DatabaseContainer.cc.

Referenced by ReadBuffer().

SelectOperation ora::ReadBuffer::m_topLevelQuery
private

Definition at line 196 of file DatabaseContainer.cc.

Referenced by read(), and ReadBuffer().

const edm::TypeWithDict& ora::ReadBuffer::m_type
private

Definition at line 194 of file DatabaseContainer.cc.

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