7 m_table( schema.sequenceTable()){
19 m_table.add( sequenceName );
24 std::map<std::string,int>::iterator iS = m_lastIds.find( sequenceName );
25 if( iS == m_lastIds.end() ){
26 bool found = m_table.getLastId( sequenceName, next );
28 throwException(
"Sequence \""+sequenceName+
"\" does not exists.",
"Sequences::getNextId");
32 m_lastIds.insert( std::make_pair( sequenceName, next ));
38 m_table.sinchronize( sequenceName, next );
44 std::map<std::string,int>::iterator iS = m_lastIds.find( sequenceName );
45 if( iS != m_lastIds.end() ){
47 m_table.getLastId( sequenceName, lastOnDb );
48 if( lastOnDb < iS->
second ) m_table.sinchronize( sequenceName, iS->second );
49 m_lastIds.erase( sequenceName );
54 for( std::map<std::string,int>::iterator iS = m_lastIds.begin();
55 iS != m_lastIds.end(); iS++ ){
57 m_table.getLastId( iS->first, lastOnDb );
58 if( lastOnDb < iS->
second ) m_table.sinchronize( iS->first, iS->second );
64 m_table.erase( sequenceName );
72 m_name( sequenceName ),
73 m_sequences( dbSchema ){
80 m_sequences.create( m_name );
84 return m_sequences.getNextId( m_name, sinchronize );
88 m_sequences.sinchronize( m_name );
92 m_sequences.erase( m_name );
Sequences(IDatabaseSchema &dbSchema)
NamedSequence(const std::string &sequenceName, IDatabaseSchema &dbSchema)
void erase(const std::string &sequenceName)
int getNextId(bool sinchronize=false)
U second(std::pair< T, U > const &p)
void sinchronize(const std::string &sequenceName)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
int getNextId(const std::string &sequenceName, bool sinchronize=false)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
void create(const std::string &sequenceName)