CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::RelationalBuffer Class Reference

#include <RelationalBuffer.h>

List of all members.

Public Member Functions

RelationalBufferaddVolatileBuffer ()
void clear ()
bool flush ()
BulkInsertOperationnewBulkInsert (const std::string &tableName)
DeleteOperationnewDelete (const std::string &tableName, bool addToResult=false)
InsertOperationnewInsert (const std::string &tableName)
MultiRecordInsertOperationnewMultiRecordInsert (const std::string &tableName)
UpdateOperationnewUpdate (const std::string &tableName, bool addToResult=false)
 RelationalBuffer (coral::ISchema &schema)
void storeBlob (boost::shared_ptr< coral::Blob > blob)
virtual ~RelationalBuffer ()

Private Attributes

std::vector< boost::shared_ptr
< coral::Blob > > 
m_blobBuffer
std::vector< std::pair
< IRelationalOperation *, bool > > 
m_operations
coral::ISchema & m_schema
std::vector< RelationalBuffer * > m_volatileBuffers

Detailed Description

Definition at line 25 of file RelationalBuffer.h.


Constructor & Destructor Documentation

ora::RelationalBuffer::RelationalBuffer ( coral::ISchema &  schema) [explicit]

Definition at line 5 of file RelationalBuffer.cc.

ora::RelationalBuffer::~RelationalBuffer ( ) [virtual]

Definition at line 12 of file RelationalBuffer.cc.

References hitfit::clear().

                                      {
  clear();
}

Member Function Documentation

ora::RelationalBuffer & ora::RelationalBuffer::addVolatileBuffer ( )

Definition at line 49 of file RelationalBuffer.cc.

                                                           {
  RelationalBuffer* newBuffer = new RelationalBuffer( m_schema );
  m_volatileBuffers.push_back( newBuffer );
  return *newBuffer;
}
void ora::RelationalBuffer::clear ( void  )

Definition at line 59 of file RelationalBuffer.cc.

                               {
  for( std::vector< std::pair<IRelationalOperation*,bool> >::const_iterator iOp = m_operations.begin();
       iOp != m_operations.end(); ++iOp ){
    delete iOp->first;
  }
  m_operations.clear();
  for( std::vector<RelationalBuffer*>::const_iterator iV = m_volatileBuffers.begin() ;
       iV != m_volatileBuffers.end(); ++iV ){
    delete *iV;
  }
  m_volatileBuffers.clear();
  m_blobBuffer.clear();
}
bool ora::RelationalBuffer::flush ( )

Definition at line 73 of file RelationalBuffer.cc.

References cmsIgProf_Analysis::execute(), convertSQLiteXML::ok, reset(), and runTheMatrix::ret.

Referenced by ora::WriteBuffer::flush(), ora::DeleteBuffer::flush(), and ora::UpdateBuffer::flush().

                               {
  bool ret = true;
  bool go = true;
  std::vector< std::pair<IRelationalOperation*,bool> >::const_iterator iOp = m_operations.begin();
  if( iOp != m_operations.end() ){
    bool ok = (iOp->first)->execute();
    go = ok || !(iOp->first)->isRequired();
    ret = ret && (ok || !iOp->second);
    iOp++;
  }
  for( ; iOp != m_operations.end(); ++iOp ){
    if( go ){
      bool ok = (iOp->first)->execute();
      go = ok || !(iOp->first)->isRequired();
      ret = ret && (ok || !iOp->second);
    } else {
      (iOp->first)->reset();
    }    
  }
  for( std::vector<RelationalBuffer*>::iterator iV = m_volatileBuffers.begin() ;
       iV != m_volatileBuffers.end(); ++iV ){
    (*iV)->flush();
    delete *iV;
  }
  m_volatileBuffers.clear();
  m_blobBuffer.clear();
  return ret;
}
ora::BulkInsertOperation & ora::RelationalBuffer::newBulkInsert ( const std::string &  tableName)

Definition at line 22 of file RelationalBuffer.cc.

                                                                                      {
  BulkInsertOperation* newOperation = new BulkInsertOperation( tableName, m_schema );
  m_operations.push_back( std::make_pair(newOperation,false) );
  return *newOperation;  
}
ora::DeleteOperation & ora::RelationalBuffer::newDelete ( const std::string &  tableName,
bool  addToResult = false 
)

Definition at line 41 of file RelationalBuffer.cc.

Referenced by ora::RelationalDeleter::build(), and ora::deleteArrayElements().

                                                                          {
  DeleteOperation* newOperation = new DeleteOperation( tableName, m_schema );
  m_operations.push_back( std::make_pair(newOperation,addToResult) );
  return *newOperation;  
}
ora::InsertOperation & ora::RelationalBuffer::newInsert ( const std::string &  tableName)

Definition at line 16 of file RelationalBuffer.cc.

Referenced by ora::DependentClassWriter::build(), and ora::WriteBuffer::WriteBuffer().

                                                                              {
  InsertOperation* newOperation = new InsertOperation( tableName, m_schema );
  m_operations.push_back( std::make_pair(newOperation,false) );
  return *newOperation;
}
ora::MultiRecordInsertOperation & ora::RelationalBuffer::newMultiRecordInsert ( const std::string &  tableName)

Definition at line 28 of file RelationalBuffer.cc.

Referenced by ora::STLContainerWriter::build(), and ora::CArrayWriter::build().

                                                                                                    {
  MultiRecordInsertOperation* newOperation = new MultiRecordInsertOperation( tableName, m_schema );
  m_operations.push_back( std::make_pair(newOperation,false) );
  return *newOperation;  
}
ora::UpdateOperation & ora::RelationalBuffer::newUpdate ( const std::string &  tableName,
bool  addToResult = false 
)

Definition at line 34 of file RelationalBuffer.cc.

Referenced by ora::UpdateBuffer::UpdateBuffer().

                                                                          {
  UpdateOperation* newOperation = new UpdateOperation( tableName, m_schema );
  m_operations.push_back( std::make_pair(newOperation,addToResult) );
  return *newOperation;  
}
void ora::RelationalBuffer::storeBlob ( boost::shared_ptr< coral::Blob >  blob)

Definition at line 55 of file RelationalBuffer.cc.

                                                                    {
  m_blobBuffer.push_back( blob );
}

Member Data Documentation

std::vector< boost::shared_ptr<coral::Blob> > ora::RelationalBuffer::m_blobBuffer [private]

Definition at line 51 of file RelationalBuffer.h.

std::vector< std::pair<IRelationalOperation*, bool> > ora::RelationalBuffer::m_operations [private]

Definition at line 49 of file RelationalBuffer.h.

coral::ISchema& ora::RelationalBuffer::m_schema [private]

Definition at line 48 of file RelationalBuffer.h.

Definition at line 50 of file RelationalBuffer.h.