CMS 3D CMS Logo

List of all members | Public Member Functions
l1t::WriterProxyT< Record, Type > Class Template Reference

#include <WriterProxy.h>

Inheritance diagram for l1t::WriterProxyT< Record, Type >:
l1t::WriterProxy

Public Member Functions

std::string save (const edm::EventSetup &setup) const override
 
 ~WriterProxyT () override
 
- Public Member Functions inherited from l1t::WriterProxy
virtual ~WriterProxy ()
 

Detailed Description

template<class Record, class Type>
class l1t::WriterProxyT< Record, Type >

Definition at line 44 of file WriterProxy.h.

Constructor & Destructor Documentation

◆ ~WriterProxyT()

template<class Record , class Type >
l1t::WriterProxyT< Record, Type >::~WriterProxyT ( )
inlineoverride

Definition at line 46 of file WriterProxy.h.

46 {}

Member Function Documentation

◆ save()

template<class Record , class Type >
std::string l1t::WriterProxyT< Record, Type >::save ( const edm::EventSetup setup) const
inlineoverridevirtual

tr.start(false);

tr.commit();

Implements l1t::WriterProxy.

Definition at line 49 of file WriterProxy.h.

49  {
50  // load record and type from EventSetup and save them in db
52 
53  try {
54  setup.get<Record>().get(handle);
55  } catch (l1t::DataAlreadyPresentException& ex) {
56  return std::string();
57  }
58 
59  // If handle is invalid, then data is already in DB
60 
62  if (!poolDb.isAvailable()) {
63  throw cond::Exception("DataWriter: PoolDBOutputService not available.");
64  }
65  poolDb->forceInit();
66  cond::persistency::Session session = poolDb->session();
68  // if throw transaction will unroll
70 
71  std::shared_ptr<Type> pointer = std::make_shared<Type>(*(handle.product()));
72  std::string payloadToken = session.storePayload(*pointer);
74  tr.close();
75  return payloadToken;
76  }

References cond::service::PoolDBOutputService::forceInit(), get, patZpeak::handle, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::session(), singleTopDQM_cfi::setup, cond::persistency::Session::storePayload(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::persistency::Session::transaction().

Referenced by SpecificationBuilder_cfi.Specification::saveAll().

cond::persistency::TransactionScope
Definition: Session.h:231
patZpeak.handle
handle
Definition: patZpeak.py:23
l1t::DataAlreadyPresentException
Definition: Exception.h:32
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
cond::service::PoolDBOutputService::session
cond::persistency::Session session() const
Definition: PoolDBOutputService.cc:94
edm::ESHandle
Definition: DTSurvey.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::Session
Definition: Session.h:63
edm::Service< cond::service::PoolDBOutputService >
cond::Exception
persistency::Exception Exception
Definition: Exception.h:25
get
#define get
cond::persistency::Session::storePayload
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
Definition: Session.h:186
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
Record
cond::service::PoolDBOutputService::forceInit
void forceInit()
Definition: PoolDBOutputService.cc:173