CMS 3D CMS Logo

PayloadReader.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_PayloadReader_h
2 #define CondCore_CondDB_PayloadReader_h
3 //
4 // Package: CondDB
5 // Class : PayloadReader
6 //
10 //
11 // Author: Giacomo Govi
12 // Created: Jul 2015
13 //
14 
16 
17 #include <memory>
18 
19 namespace cond {
20 
21  namespace persistency {
22 
23  class PayloadReader {
24  public:
25  static constexpr const char* const PRODUCTION_DB = "oracle://cms_orcon_adg/CMS_CONDITIONS";
26 
27  public:
28  // default constructor
29  PayloadReader();
30 
31  //
32  PayloadReader(const PayloadReader& rhs);
33 
34  //
35  virtual ~PayloadReader();
36 
37  //
39 
40  //
42 
43  //
44  void open(const std::string& connectionString);
45 
46  //
47  void open();
48 
49  //
50  void close();
51 
52  //
53  template <typename T>
54  std::shared_ptr<T> fetch(const cond::Hash& payloadHash);
55 
56  private:
57  std::shared_ptr<ConnectionPool> m_connection;
59  };
60 
61  template <typename T>
62  inline std::shared_ptr<T> PayloadReader::fetch(const cond::Hash& payloadHash) {
63  std::shared_ptr<T> ret;
64  if (m_session.connectionString().empty())
66  m_session.transaction().start(true);
67  ret = m_session.fetchPayload<T>(payloadHash);
69  return ret;
70  }
71 
72  } // namespace persistency
73 } // namespace cond
74 #endif // CondCore_CondDB_PayloadReader_h
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
ConnectionPool.h
cond::Hash
std::string Hash
Definition: Types.h:43
cond::persistency::Session::fetchPayload
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
cond::persistency::PayloadReader
Definition: PayloadReader.h:23
cond::persistency::PayloadReader::connection
ConnectionPool & connection()
Definition: PayloadReader.cc:19
cond::persistency::ConnectionPool
Definition: ConnectionPool.h:31
cond::persistency::PayloadReader::fetch
std::shared_ptr< T > fetch(const cond::Hash &payloadHash)
Definition: PayloadReader.h:62
cond::persistency::PayloadReader::operator=
PayloadReader & operator=(const PayloadReader &rhs)
Definition: PayloadReader.cc:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
cond::persistency::Session
Definition: Session.h:63
cond::persistency::Session::connectionString
std::string connectionString()
Definition: Session.cc:216
cond::persistency::Transaction::commit
void commit()
Definition: Session.cc:23
cond::persistency::PayloadReader::~PayloadReader
virtual ~PayloadReader()
Definition: PayloadReader.cc:11
cond::persistency::PayloadReader::close
void close()
Definition: PayloadReader.cc:27
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
cond::persistency::PayloadReader::PRODUCTION_DB
static constexpr const char *const PRODUCTION_DB
Definition: PayloadReader.h:25
T
long double T
Definition: Basic3DVectorLD.h:48
cond::persistency::PayloadReader::PayloadReader
PayloadReader()
Definition: PayloadReader.cc:7
cond::persistency::PayloadReader::m_connection
std::shared_ptr< ConnectionPool > m_connection
Definition: PayloadReader.h:57
cond::persistency::PayloadReader::open
void open()
Definition: PayloadReader.cc:25
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
cond::persistency::PayloadReader::m_session
Session m_session
Definition: PayloadReader.h:58