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 edm::TypeWithDict &type)
 
int itemId ()
 
 IteratorBuffer (ContainerSchema &schema, ReadBuffer &buffer)
 
bool next ()
 
void reset ()
 
const edm::TypeWithDicttype ()
 
 ~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 244 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().

245  :
246  m_query( schema.mapping().topElement().tableName(), schema.storageSchema() ),
247  m_itemId( -1 ),
248  m_readBuffer( buffer ){
249  const std::string& idCol = schema.mapping().topElement().columnNames()[0];
250  m_query.addId( idCol );
251  m_query.addOrderId( idCol );
252 }
tuple schema
Definition: dataDML.py:2334
SelectOperation m_query
int addId(const std::string &columnName)
void addOrderId(const std::string &columnName)
ReadBuffer & m_readBuffer
ora::IteratorBuffer::~IteratorBuffer ( )

Definition at line 254 of file DatabaseContainer.cc.

254  {
255 }

Member Function Documentation

void * ora::IteratorBuffer::getItem ( )

Definition at line 275 of file DatabaseContainer.cc.

References runTheMatrix::ret.

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

275  {
276  void* ret = 0;
277  if( m_itemId != -1 ){
278  ret = m_readBuffer.read( m_itemId );
279  }
280  return ret;
281 }
tuple ret
prodAgent to be discontinued
void * read(int oid)
ReadBuffer & m_readBuffer
void * ora::IteratorBuffer::getItemAsType ( const edm::TypeWithDict type)

Definition at line 283 of file DatabaseContainer.cc.

References edm::TypeWithDict::cppName(), ora::ClassUtils::isType(), and ora::throwException().

283  {
284  if( !ClassUtils::isType( type(), asType ) ){
285  throwException("Provided output object type \""+asType.cppName()+"\" does not match with the container type \""+type().cppName(),
286  "ora::IteratorBuffer::getItemsAsType" );
287  }
288  return getItem();
289 }
const edm::TypeWithDict & type()
bool isType(const edm::TypeWithDict &type, const edm::TypeWithDict &baseType)
Definition: ClassUtils.cc:50
std::string cppName() const
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
int ora::IteratorBuffer::itemId ( )

Definition at line 291 of file DatabaseContainer.cc.

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

Definition at line 261 of file DatabaseContainer.cc.

Referenced by BeautifulSoup.PageElement::_invert(), and ora::DatabaseUtilitySession::importContainer().

261  {
262  bool prevValid = (m_itemId != -1);
263  bool currValid = false;
264  m_itemId = -1;
265  if( m_query.nextCursorRow() ){
266  coral::AttributeList& row = m_query.data();
267  m_itemId = row.begin()->data<int>();
268  currValid = true;
269  }
270 
271  if( !currValid && prevValid ) m_query.clear();
272  return currValid;
273 }
SelectOperation m_query
coral::AttributeList & data()
void ora::IteratorBuffer::reset ( void  )
const edm::TypeWithDict & 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.