CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::Sequences Class Reference

#include <Sequences.h>

List of all members.

Public Member Functions

void clear ()
void create (const std::string &sequenceName)
void erase (const std::string &sequenceName)
int getNextId (const std::string &sequenceName, bool sinchronize=false)
 Sequences (ISequenceTable &table)
 Sequences (IDatabaseSchema &dbSchema)
void sinchronize (const std::string &sequenceName)
void sinchronizeAll ()
virtual ~Sequences ()

Private Attributes

std::map< std::string, int > m_lastIds
ISequenceTablem_table

Detailed Description

Definition at line 13 of file Sequences.h.


Constructor & Destructor Documentation

ora::Sequences::Sequences ( ora::IDatabaseSchema schema) [explicit]

Definition at line 5 of file Sequences.cc.

                                                   :
  m_lastIds(),
  m_table( schema.sequenceTable()){
}
ora::Sequences::Sequences ( ora::ISequenceTable table) [explicit]

Definition at line 10 of file Sequences.cc.

                                                 :
  m_lastIds(),
  m_table( table ){
}
ora::Sequences::~Sequences ( ) [virtual]

Definition at line 15 of file Sequences.cc.

                        {
}

Member Function Documentation

void ora::Sequences::clear ( void  )

Definition at line 67 of file Sequences.cc.

                        {
  m_lastIds.clear();
}
void ora::Sequences::create ( const std::string &  sequenceName)

Definition at line 18 of file Sequences.cc.

References SurfaceDeformation::add().

                                                        {
  m_table.add( sequenceName );
}
void ora::Sequences::erase ( const std::string &  sequenceName)

Definition at line 63 of file Sequences.cc.

                                                       {
  m_table.erase( sequenceName );
}
int ora::Sequences::getNextId ( const std::string &  sequenceName,
bool  sinchronize = false 
)

Definition at line 22 of file Sequences.cc.

References newFWLiteAna::found, and ora::throwException().

                                                                            {
  int next = 0;
  std::map<std::string,int>::iterator iS = m_lastIds.find( sequenceName );
  if( iS == m_lastIds.end() ){
    bool found = m_table.getLastId( sequenceName, next );
    if( ! found ) {
      throwException("Sequence \""+sequenceName+"\" does not exists.","Sequences::getNextId");
    } else {
      next += 1;
    }
    m_lastIds.insert( std::make_pair( sequenceName, next ));
  } else {
    next = ++iS->second;
  }

  if( sinchronize){
    m_table.sinchronize( sequenceName, next );
  }  
  return next;
}
void ora::Sequences::sinchronize ( const std::string &  sequenceName)

Definition at line 43 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_table.getLastId( sequenceName, lastOnDb );
    if( lastOnDb < iS->second ) m_table.sinchronize( sequenceName, iS->second );
    m_lastIds.erase( sequenceName );
  }
}
void ora::Sequences::sinchronizeAll ( )

Definition at line 53 of file Sequences.cc.

References hitfit::clear(), and edm::second().

                                 {
  for( std::map<std::string,int>::iterator iS = m_lastIds.begin();
       iS != m_lastIds.end(); iS++ ){
    int lastOnDb = 0;
    m_table.getLastId( iS->first, lastOnDb );
    if( lastOnDb < iS->second ) m_table.sinchronize( iS->first, iS->second );    
  }
  clear();
}

Member Data Documentation

std::map<std::string, int> ora::Sequences::m_lastIds [private]

Definition at line 25 of file Sequences.h.

Definition at line 26 of file Sequences.h.