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::IteratorBuffer Class Reference

#include <DatabaseContainer.h>

Public Member Functions

void * getItem ()
 
void * getItemAsType (const Reflex::Type &type)
 
int itemId ()
 
 IteratorBuffer (ContainerSchema &schema, ReadBuffer &buffer)
 
bool next ()
 
void reset ()
 
const Reflex::Type & type ()
 
 ~IteratorBuffer ()
 

Private Attributes

int m_itemId
 
SelectOperation m_query
 
ReadBufferm_readBuffer
 

Detailed Description

Definition at line 27 of file DatabaseContainer.h.

Constructor & Destructor Documentation

ora::IteratorBuffer::IteratorBuffer ( ContainerSchema schema,
ReadBuffer buffer 
)

Definition at line 239 of file DatabaseContainer.cc.

References ora::SelectOperation::addId(), ora::SelectOperation::addOrderId(), ora::MappingElement::columnNames(), m_query, ora::ContainerSchema::mapping(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::MappingTree::topElement().

240  :
241  m_query( schema.mapping().topElement().tableName(), schema.storageSchema() ),
242  m_itemId( -1 ),
243  m_readBuffer( buffer ){
244  const std::string& idCol = schema.mapping().topElement().columnNames()[0];
245  m_query.addId( idCol );
246  m_query.addOrderId( idCol );
247 }
SelectOperation m_query
int addId(const std::string &columnName)
void addOrderId(const std::string &columnName)
ReadBuffer & m_readBuffer
ora::IteratorBuffer::~IteratorBuffer ( )

Definition at line 249 of file DatabaseContainer.cc.

249  {
250 }

Member Function Documentation

void * ora::IteratorBuffer::getItem ( )

Definition at line 270 of file DatabaseContainer.cc.

References run_regression::ret.

Referenced by ora::DatabaseUtilitySession::importContainer().

270  {
271  void* ret = 0;
272  if( m_itemId != -1 ){
273  ret = m_readBuffer.read( m_itemId );
274  }
275  return ret;
276 }
void * read(int oid)
ReadBuffer & m_readBuffer
void * ora::IteratorBuffer::getItemAsType ( const Reflex::Type &  type)

Definition at line 278 of file DatabaseContainer.cc.

References ora::ClassUtils::isType(), and ora::throwException().

278  {
279  if( !ClassUtils::isType( type(), asType ) ){
280  throwException("Provided output object type \""+asType.Name(Reflex::SCOPED)+"\" does not match with the container type \""+
281  type().Name(Reflex::SCOPED)+"\"","IteratorBuffer::getItemAsType");
282  }
283  return getItem();
284 }
const Reflex::Type & type()
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
bool isType(const Reflex::Type &type, const Reflex::Type &baseType)
Definition: ClassUtils.cc:45
int ora::IteratorBuffer::itemId ( )

Definition at line 286 of file DatabaseContainer.cc.

286  {
287  return m_itemId;
288 }
bool ora::IteratorBuffer::next ( void  )

Definition at line 256 of file DatabaseContainer.cc.

Referenced by ora::DatabaseUtilitySession::importContainer().

256  {
257  bool prevValid = (m_itemId != -1);
258  bool currValid = false;
259  m_itemId = -1;
260  if( m_query.nextCursorRow() ){
261  coral::AttributeList& row = m_query.data();
262  m_itemId = row.begin()->data<int>();
263  currValid = true;
264  }
265 
266  if( !currValid && prevValid ) m_query.clear();
267  return currValid;
268 }
SelectOperation m_query
coral::AttributeList & data()
void ora::IteratorBuffer::reset ( void  )
const Reflex::Type & ora::IteratorBuffer::type ( )

Member Data Documentation

int ora::IteratorBuffer::m_itemId
private

Definition at line 47 of file DatabaseContainer.h.

SelectOperation ora::IteratorBuffer::m_query
private

Definition at line 46 of file DatabaseContainer.h.

Referenced by IteratorBuffer().

ReadBuffer& ora::IteratorBuffer::m_readBuffer
private

Definition at line 48 of file DatabaseContainer.h.