CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
cond::persistency::PayloadReader Class Reference

#include <PayloadReader.h>

Public Member Functions

void close ()
 
ConnectionPoolconnection ()
 
template<typename T >
std::shared_ptr< Tfetch (const cond::Hash &payloadHash)
 
void open (const std::string &connectionString)
 
void open ()
 
PayloadReaderoperator= (const PayloadReader &rhs)
 
 PayloadReader ()
 
 PayloadReader (const PayloadReader &rhs)
 
virtual ~PayloadReader ()
 

Static Public Attributes

static constexpr const char *const PRODUCTION_DB = "oracle://cms_orcon_adg/CMS_CONDITIONS"
 

Private Attributes

std::shared_ptr< ConnectionPoolm_connection
 
Session m_session
 

Detailed Description

Definition at line 23 of file PayloadReader.h.

Constructor & Destructor Documentation

◆ PayloadReader() [1/2]

PayloadReader::PayloadReader ( )

Definition at line 7 of file PayloadReader.cc.

References m_connection.

7 { m_connection.reset(new ConnectionPool); }
std::shared_ptr< ConnectionPool > m_connection
Definition: PayloadReader.h:57

◆ PayloadReader() [2/2]

PayloadReader::PayloadReader ( const PayloadReader rhs)

Definition at line 9 of file PayloadReader.cc.

9 : m_connection(rhs.m_connection), m_session(rhs.m_session) {}
std::shared_ptr< ConnectionPool > m_connection
Definition: PayloadReader.h:57

◆ ~PayloadReader()

PayloadReader::~PayloadReader ( )
virtual

Definition at line 11 of file PayloadReader.cc.

11 {}

Member Function Documentation

◆ close()

void PayloadReader::close ( void  )

◆ connection()

ConnectionPool & PayloadReader::connection ( )

Definition at line 19 of file PayloadReader.cc.

References m_connection.

19 { return *m_connection; }
std::shared_ptr< ConnectionPool > m_connection
Definition: PayloadReader.h:57

◆ fetch()

template<typename T >
std::shared_ptr< T > PayloadReader::fetch ( const cond::Hash payloadHash)
inline

Definition at line 62 of file PayloadReader.h.

References cond::persistency::Transaction::commit(), cond::persistency::Session::connectionString(), cond::persistency::Session::fetchPayload(), m_session, open(), PRODUCTION_DB, runTheMatrix::ret, cond::persistency::Transaction::start(), and cond::persistency::Session::transaction().

62  {
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  }
ret
prodAgent to be discontinued
void start(bool readOnly=true)
Definition: Session.cc:18
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
Transaction & transaction()
Definition: Session.cc:52
static constexpr const char *const PRODUCTION_DB
Definition: PayloadReader.h:25
std::string connectionString()
Definition: Session.cc:216
long double T

◆ open() [1/2]

void PayloadReader::open ( const std::string &  connectionString)

◆ open() [2/2]

void PayloadReader::open ( )

Definition at line 25 of file PayloadReader.cc.

References PRODUCTION_DB.

Referenced by fetch().

25 { open(PRODUCTION_DB); }
static constexpr const char *const PRODUCTION_DB
Definition: PayloadReader.h:25

◆ operator=()

PayloadReader & PayloadReader::operator= ( const PayloadReader rhs)

Definition at line 13 of file PayloadReader.cc.

References m_connection, and m_session.

13  {
14  m_connection = rhs.m_connection;
15  m_session = rhs.m_session;
16  return *this;
17  }
std::shared_ptr< ConnectionPool > m_connection
Definition: PayloadReader.h:57

Member Data Documentation

◆ m_connection

std::shared_ptr<ConnectionPool> cond::persistency::PayloadReader::m_connection
private

Definition at line 57 of file PayloadReader.h.

Referenced by connection(), open(), operator=(), and PayloadReader().

◆ m_session

Session cond::persistency::PayloadReader::m_session
private

Definition at line 58 of file PayloadReader.h.

Referenced by close(), fetch(), open(), and operator=().

◆ PRODUCTION_DB

constexpr const char* const cond::persistency::PayloadReader::PRODUCTION_DB = "oracle://cms_orcon_adg/CMS_CONDITIONS"
static

Definition at line 25 of file PayloadReader.h.

Referenced by fetch(), and open().