Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:20

0001 #ifndef CondCore_CondDB_RunInfoEditor_h
0002 #define CondCore_CondDB_RunInfoEditor_h
0003 //
0004 // Package:     CondDB
0005 // Class  :     RunInfoEditor
0006 //
0007 /**\class RunInfoEditor RunInfoEditor.h CondCore/CondDB/interface/RunInfoEditor.h
0008    Description: service for update access to the runInfo entries.  
0009 */
0010 //
0011 // Author:      Giacomo Govi
0012 // Created:     March 2017
0013 //
0014 
0015 #include "CondCore/CondDB/interface/Time.h"
0016 #include "CondCore/CondDB/interface/Types.h"
0017 //
0018 #include <boost/date_time/posix_time/posix_time.hpp>
0019 
0020 namespace cond {
0021 
0022   namespace persistency {
0023 
0024     class SessionImpl;
0025     class RunInfoEditorData;
0026 
0027     // value semantics...
0028     class RunInfoEditor {
0029     public:
0030       RunInfoEditor();
0031       // ctor
0032       explicit RunInfoEditor(const std::shared_ptr<SessionImpl>& session);
0033 
0034       //
0035       RunInfoEditor(const RunInfoEditor& rhs);
0036 
0037       //
0038       RunInfoEditor& operator=(const RunInfoEditor& rhs);
0039 
0040       //
0041       void init();
0042 
0043       //
0044       cond::Time_t getLastInserted();
0045 
0046       // register an insertion.
0047       void insert(cond::Time_t runNumber, const boost::posix_time::ptime& start, const boost::posix_time::ptime& end);
0048 
0049       // register a new insertion.
0050       void insertNew(cond::Time_t runNumber,
0051                      const boost::posix_time::ptime& start,
0052                      const boost::posix_time::ptime& end);
0053 
0054       // execute the update/intert queries and reset the buffer
0055       size_t flush();
0056 
0057     private:
0058       void checkTransaction(const std::string& ctx);
0059 
0060     private:
0061       std::shared_ptr<RunInfoEditorData> m_data;
0062       std::shared_ptr<SessionImpl> m_session;
0063     };
0064 
0065   }  // namespace persistency
0066 }  // namespace cond
0067 
0068 #endif