CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
cond::persistency::PayloadProxy< DataT > Class Template Reference

#include <PayloadProxy.h>

Inheritance diagram for cond::persistency::PayloadProxy< DataT >:
cond::persistency::BasePayloadProxy

Public Member Functions

void initKeyList (PayloadProxy const &)
 
void make () override
 
const DataT & operator() () const
 
 PayloadProxy (Iov_t const *mostRecentCurrentIov, Session const *mostRecentSession, std::shared_ptr< std::vector< Iov_t >> const *mostRecentRequests, const char *source=nullptr)
 
 ~PayloadProxy () override
 
- Public Member Functions inherited from cond::persistency::BasePayloadProxy
 BasePayloadProxy (Iov_t const *mostRecentCurrentIov, Session const *mostRecentSession, std::shared_ptr< std::vector< Iov_t >> const *mostRecentRequests)
 
void initializeForNewIOV ()
 
bool isValid () const
 
virtual void loadMore (CondGetter const &)
 
virtual ~BasePayloadProxy ()
 

Protected Member Functions

void loadPayload () override
 

Private Attributes

Hash m_currentPayloadId
 
std::unique_ptr< DataT > m_data
 

Additional Inherited Members

- Protected Attributes inherited from cond::persistency::BasePayloadProxy
Iov_t m_iovAtInitialization
 
Iov_t const * m_mostRecentCurrentIov
 
std::shared_ptr< std::vector< Iov_t > > const * m_mostRecentRequests
 
Session const * m_mostRecentSession
 
std::shared_ptr< std::vector< Iov_t > > m_requests
 
Session m_session
 

Detailed Description

template<typename DataT>
class cond::persistency::PayloadProxy< DataT >

Definition at line 61 of file PayloadProxy.h.

Constructor & Destructor Documentation

◆ PayloadProxy()

template<typename DataT>
cond::persistency::PayloadProxy< DataT >::PayloadProxy ( Iov_t const *  mostRecentCurrentIov,
Session const *  mostRecentSession,
std::shared_ptr< std::vector< Iov_t >> const *  mostRecentRequests,
const char *  source = nullptr 
)
inlineexplicit

Definition at line 63 of file PayloadProxy.h.

67  : BasePayloadProxy(mostRecentCurrentIov, mostRecentSession, mostRecentRequests) {}

◆ ~PayloadProxy()

template<typename DataT>
cond::persistency::PayloadProxy< DataT >::~PayloadProxy ( )
inlineoverride

Definition at line 69 of file PayloadProxy.h.

69 {}

Member Function Documentation

◆ initKeyList()

template<typename DataT>
void cond::persistency::PayloadProxy< DataT >::initKeyList ( PayloadProxy< DataT > const &  )
inline

Definition at line 71 of file PayloadProxy.h.

71 {}

◆ loadPayload()

template<typename DataT>
void cond::persistency::PayloadProxy< DataT >::loadPayload ( )
inlineoverrideprotectedvirtual

Implements cond::persistency::BasePayloadProxy.

Definition at line 92 of file PayloadProxy.h.

92  {
93  if (m_iovAtInitialization.payloadId.empty()) {
94  throwException("Can't load payload: no valid IOV found.", "PayloadProxy::loadPayload");
95  }
99  }

Referenced by cond::persistency::PayloadProxy< std::vector< cond::Time_t > >::make().

◆ make()

template<typename DataT>
void cond::persistency::PayloadProxy< DataT >::make ( )
inlineoverridevirtual

Implements cond::persistency::BasePayloadProxy.

Definition at line 81 of file PayloadProxy.h.

81  {
82  if (isValid()) {
84  return;
85  m_session.transaction().start(true);
86  loadPayload();
88  }
89  }

◆ operator()()

template<typename DataT>
const DataT& cond::persistency::PayloadProxy< DataT >::operator() ( ) const
inline

Definition at line 74 of file PayloadProxy.h.

74  {
75  if (!m_data) {
76  throwException("The Payload has not been loaded.", "PayloadProxy::operator()");
77  }
78  return (*m_data);
79  }

Member Data Documentation

◆ m_currentPayloadId

template<typename DataT>
Hash cond::persistency::PayloadProxy< DataT >::m_currentPayloadId
private

◆ m_data

template<typename DataT>
std::unique_ptr<DataT> cond::persistency::PayloadProxy< DataT >::m_data
private
cond::persistency::PayloadProxy::m_currentPayloadId
Hash m_currentPayloadId
Definition: PayloadProxy.h:103
cond::persistency::BasePayloadProxy::m_session
Session m_session
Definition: PayloadProxy.h:49
cond::persistency::Session::fetchPayload
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
cond::persistency::BasePayloadProxy::m_iovAtInitialization
Iov_t m_iovAtInitialization
Definition: PayloadProxy.h:48
cond::persistency::PayloadProxy::loadPayload
void loadPayload() override
Definition: PayloadProxy.h:92
cond::Iov_t::payloadId
Hash payloadId
Definition: Types.h:55
cond::persistency::Transaction::commit
void commit()
Definition: Session.cc:23
cond::persistency::BasePayloadProxy::m_requests
std::shared_ptr< std::vector< Iov_t > > m_requests
Definition: PayloadProxy.h:50
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::PayloadProxy::m_data
std::unique_ptr< DataT > m_data
Definition: PayloadProxy.h:102
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
cond::persistency::BasePayloadProxy::isValid
bool isValid() const
Definition: PayloadProxy.cc:16
cond::persistency::BasePayloadProxy::BasePayloadProxy
BasePayloadProxy(Iov_t const *mostRecentCurrentIov, Session const *mostRecentSession, std::shared_ptr< std::vector< Iov_t >> const *mostRecentRequests)
Definition: PayloadProxy.cc:7