#include <Sequences.h>
Public Member Functions | |
void | clear () |
void | erase (const std::string &sequenceName) |
int | getNextId (const std::string &sequenceName, bool sinchronize=false) |
Sequences (IDatabaseSchema &dbSchema) | |
void | sinchronize (const std::string &sequenceName) |
void | sinchronizeAll () |
virtual | ~Sequences () |
Private Attributes | |
std::map< std::string, int > | m_lastIds |
IDatabaseSchema & | m_schema |
Definition at line 12 of file Sequences.h.
ora::Sequences::Sequences | ( | ora::IDatabaseSchema & | schema | ) | [explicit] |
Definition at line 4 of file Sequences.cc.
ora::Sequences::~Sequences | ( | ) | [virtual] |
Definition at line 9 of file Sequences.cc.
{ }
void ora::Sequences::clear | ( | void | ) |
Definition at line 57 of file Sequences.cc.
{ m_lastIds.clear(); }
void ora::Sequences::erase | ( | const std::string & | sequenceName | ) |
Definition at line 53 of file Sequences.cc.
{ m_schema.sequenceTable().erase( sequenceName ); }
int ora::Sequences::getNextId | ( | const std::string & | sequenceName, |
bool | sinchronize = false |
||
) |
Definition at line 12 of file Sequences.cc.
References newFWLiteAna::found.
{ int next = 0; std::map<std::string,int>::iterator iS = m_lastIds.find( sequenceName ); if( iS == m_lastIds.end() ){ bool found = m_schema.sequenceTable().getLastId( sequenceName, next ); if( ! found ) { m_schema.sequenceTable().add( sequenceName ); } else { next += 1; } m_lastIds.insert( std::make_pair( sequenceName, next )); } else { next = ++iS->second; } if( sinchronize){ m_schema.sequenceTable().sinchronize( sequenceName, next ); } return next; }
void ora::Sequences::sinchronize | ( | const std::string & | sequenceName | ) |
Definition at line 33 of file Sequences.cc.
References edm::second().
{ std::map<std::string,int>::iterator iS = m_lastIds.find( sequenceName ); if( iS != m_lastIds.end() ){ int lastOnDb = 0; m_schema.sequenceTable().getLastId( sequenceName, lastOnDb ); if( lastOnDb < iS->second ) m_schema.sequenceTable().sinchronize( sequenceName, iS->second ); m_lastIds.erase( sequenceName ); } }
void ora::Sequences::sinchronizeAll | ( | ) |
Definition at line 43 of file Sequences.cc.
References edm::second().
std::map<std::string, int> ora::Sequences::m_lastIds [private] |
Definition at line 22 of file Sequences.h.
IDatabaseSchema& ora::Sequences::m_schema [private] |
Definition at line 23 of file Sequences.h.