CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CondCore/ORA/src/SequenceManager.cc

Go to the documentation of this file.
00001 #include "CondCore/ORA/interface/SequenceManager.h"
00002 #include "OraDatabaseSchema.h"
00003 #include "Sequences.h"
00004 
00005 ora::SequenceManager::SequenceManager( const std::string& tableName, 
00006                                        coral::ISchema& schema ):
00007   m_table(),
00008   m_impl(){
00009   m_table.reset( new OraSequenceTable( tableName, schema ) );
00010   m_impl.reset( new Sequences( *m_table ) );
00011 }
00012 
00013 ora::SequenceManager::SequenceManager( const SequenceManager& rhs ):
00014   m_table( rhs.m_table ),
00015   m_impl( rhs.m_impl ){
00016 }
00017     
00018 ora::SequenceManager::~SequenceManager(){
00019 }
00020 
00021 ora::SequenceManager& ora::SequenceManager::operator=( const SequenceManager& rhs ){
00022   if( this != &rhs ){
00023     m_table = rhs.m_table;
00024     m_impl = rhs.m_impl;
00025   }
00026   return *this;
00027 }
00028 
00029 std::string ora::SequenceManager::tableName(){
00030   return m_table->name();
00031 }
00032 
00033 void ora::SequenceManager::create( const std::string& sequenceName ){
00034   if( !m_table->exists() ){
00035     m_table->create();
00036   }
00037   int lastId=0;
00038   if(!m_table->getLastId( sequenceName, lastId ) ) m_impl->create( sequenceName );
00039 }
00040 
00041 int ora::SequenceManager::getNextId( const std::string& sequenceName, 
00042                                      bool sinchronize ){
00043   return m_impl->getNextId( sequenceName, sinchronize );
00044 }
00045 
00046 void ora::SequenceManager::sinchronize( const std::string& sequenceName ){
00047   m_impl->sinchronize( sequenceName );
00048 }
00049 
00050 void ora::SequenceManager::sinchronizeAll(){
00051   m_impl->sinchronizeAll();
00052 }
00053 
00054 void ora::SequenceManager::erase( const std::string& sequenceName ){
00055   m_impl->erase( sequenceName );
00056 }
00057 
00058 void ora::SequenceManager::clear(){
00059   m_impl->clear();
00060 }