RunInfoEditor

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
#ifndef CondCore_CondDB_RunInfoEditor_h
#define CondCore_CondDB_RunInfoEditor_h
//
// Package:     CondDB
// Class  :     RunInfoEditor
//
/**\class RunInfoEditor RunInfoEditor.h CondCore/CondDB/interface/RunInfoEditor.h
   Description: service for update access to the runInfo entries.  
*/
//
// Author:      Giacomo Govi
// Created:     March 2017
//

#include "CondCore/CondDB/interface/Time.h"
#include "CondCore/CondDB/interface/Types.h"
//
#include <boost/date_time/posix_time/posix_time.hpp>

namespace cond {

  namespace persistency {

    class SessionImpl;
    class RunInfoEditorData;

    // value semantics...
    class RunInfoEditor {
    public:
      RunInfoEditor();
      // ctor
      explicit RunInfoEditor(const std::shared_ptr<SessionImpl>& session);

      //
      RunInfoEditor(const RunInfoEditor& rhs);

      //
      RunInfoEditor& operator=(const RunInfoEditor& rhs);

      //
      void init();

      //
      cond::Time_t getLastInserted();

      // register an insertion.
      void insert(cond::Time_t runNumber, const boost::posix_time::ptime& start, const boost::posix_time::ptime& end);

      // register a new insertion.
      void insertNew(cond::Time_t runNumber,
                     const boost::posix_time::ptime& start,
                     const boost::posix_time::ptime& end);

      // execute the update/intert queries and reset the buffer
      size_t flush();

    private:
      void checkTransaction(const std::string& ctx);

    private:
      std::shared_ptr<RunInfoEditorData> m_data;
      std::shared_ptr<SessionImpl> m_session;
    };

  }  // namespace persistency
}  // namespace cond

#endif