CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CondCore/ORA/src/Sequences.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_SEQUENCES_H
00002 #define INCLUDE_ORA_SEQUENCES_H
00003 
00004 //
00005 #include <map>
00006 #include <string>
00007 
00008 namespace ora {
00009 
00010   class IDatabaseSchema;
00011   class ISequenceTable;
00012 
00013   class Sequences {
00014     public:
00015     explicit Sequences( IDatabaseSchema& dbSchema );
00016     explicit Sequences( ISequenceTable& table );
00017     virtual ~Sequences();
00018     void create( const std::string& sequenceName );
00019     int getNextId( const std::string& sequenceName, bool sinchronize = false );
00020     void sinchronize( const std::string& sequenceName );
00021     void sinchronizeAll();
00022     void erase( const std::string& sequenceName );
00023     void clear();
00024     private:
00025     std::map<std::string, int> m_lastIds;
00026     ISequenceTable& m_table;
00027   };
00028 
00029   class NamedSequence {
00030     public:
00031     NamedSequence( const std::string& sequenceName, IDatabaseSchema& dbSchema );
00032     virtual ~NamedSequence();
00033     void create();
00034     int getNextId( bool sinchronize = false );
00035     void sinchronize();
00036     void erase();
00037     void clear();
00038     private:
00039     std::string m_name;
00040     Sequences m_sequences;
00041   };
00042     
00043     
00044 }
00045 
00046 #endif
00047   
00048