CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SequenceManager.cc
Go to the documentation of this file.
2 #include "OraDatabaseSchema.h"
3 #include "Sequences.h"
4 
5 ora::SequenceManager::SequenceManager( const std::string& tableName,
6  coral::ISchema& schema ):
7  m_table(),
8  m_impl(){
9  m_table.reset( new OraSequenceTable( tableName, schema ) );
10  m_impl.reset( new Sequences( *m_table ) );
11 }
12 
14  m_table( rhs.m_table ),
15  m_impl( rhs.m_impl ){
16 }
17 
19 }
20 
22  if( this != &rhs ){
23  m_table = rhs.m_table;
24  m_impl = rhs.m_impl;
25  }
26  return *this;
27 }
28 
30  return m_table->name();
31 }
32 
33 void ora::SequenceManager::create( const std::string& sequenceName ){
34  if( !m_table->exists() ){
35  m_table->create();
36  }
37  int lastId=0;
38  if(!m_table->getLastId( sequenceName, lastId ) ) m_impl->create( sequenceName );
39 }
40 
41 int ora::SequenceManager::getNextId( const std::string& sequenceName,
42  bool sinchronize ){
43  return m_impl->getNextId( sequenceName, sinchronize );
44 }
45 
46 void ora::SequenceManager::sinchronize( const std::string& sequenceName ){
47  m_impl->sinchronize( sequenceName );
48 }
49 
51  m_impl->sinchronizeAll();
52 }
53 
54 void ora::SequenceManager::erase( const std::string& sequenceName ){
55  m_impl->erase( sequenceName );
56 }
57 
59  m_impl->clear();
60 }
std::string tableName()
void sinchronize(const std::string &sequenceName)
SequenceManager(const std::string &tableName, coral::ISchema &schema)
boost::shared_ptr< Sequences > m_impl
boost::shared_ptr< OraSequenceTable > m_table
int getNextId(const std::string &sequenceName, bool sinchronize=false)
void create(const std::string &sequenceName)
SequenceManager & operator=(const SequenceManager &rhs)
void erase(const std::string &sequenceName)