CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::IteratorBuffer Class Reference

#include <DatabaseContainer.h>

List of all members.

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().

                                                         :
  m_query( schema.mapping().topElement().tableName(), schema.storageSchema() ),
  m_itemId( -1 ),
  m_readBuffer( buffer ){
  const std::string& idCol = schema.mapping().topElement().columnNames()[0];
  m_query.addId( idCol );
  m_query.addOrderId( idCol );
}
ora::IteratorBuffer::~IteratorBuffer ( )

Definition at line 249 of file DatabaseContainer.cc.

                                  {
}

Member Function Documentation

void * ora::IteratorBuffer::getItem ( )

Definition at line 270 of file DatabaseContainer.cc.

References run_regression::ret.

                                {
  void* ret = 0;
  if( m_itemId != -1 ){
    ret =  m_readBuffer.read( m_itemId );
  }
  return ret;
}
void * ora::IteratorBuffer::getItemAsType ( const Reflex::Type &  type)

Definition at line 278 of file DatabaseContainer.cc.

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

                                                                {
  if( !ClassUtils::isType( type(), asType ) ){
    throwException("Provided output object type \""+asType.Name(Reflex::SCOPED)+"\" does not match with the container type \""+
                   type().Name(Reflex::SCOPED)+"\"","IteratorBuffer::getItemAsType");
  } 
  return getItem();
}
int ora::IteratorBuffer::itemId ( )

Definition at line 286 of file DatabaseContainer.cc.

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

Definition at line 256 of file DatabaseContainer.cc.

                            {
  bool prevValid = (m_itemId != -1);
  bool currValid = false;
  m_itemId = -1;
  if( m_query.nextCursorRow() ){
    coral::AttributeList& row = m_query.data();
    m_itemId = row.begin()->data<int>();
    currValid = true;
  }
  
  if( !currValid && prevValid ) m_query.clear();
  return currValid;
}
void ora::IteratorBuffer::reset ( void  )

Definition at line 252 of file DatabaseContainer.cc.

                             {
  m_query.execute();
}
const Reflex::Type & ora::IteratorBuffer::type ( )

Definition at line 290 of file DatabaseContainer.cc.

                                         {
  return m_readBuffer.type();
}

Member Data Documentation

Definition at line 47 of file DatabaseContainer.h.

Definition at line 46 of file DatabaseContainer.h.

Referenced by IteratorBuffer().

Definition at line 48 of file DatabaseContainer.h.