CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Detailed Description

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

Definition at line 48 of file WriterProxy.h.

Constructor & Destructor Documentation

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

Definition at line 51 of file WriterProxy.h.

51 {}

Member Function Documentation

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

Implements l1t::WriterProxy.

Definition at line 54 of file WriterProxy.h.

References cond::classNameForTypeId(), cond::DbScopedTransaction::commit(), edm::hlt::Exception, edm::EventSetup::get(), patZpeak::handle, edm::Service< T >::isAvailable(), edm::ESHandle< class >::product(), python.CommonUtils::session, cond::service::PoolDBOutputService::session(), cond::DbScopedTransaction::start(), and cond::DbSession::storeObject().

Referenced by Vispa.Main.TabController.TabController::allowClose(), and Vispa.Main.TabController.TabController::checkModificationTimestamp().

55  {
56  // load record and type from EventSetup and save them in db
58 
59  try
60  {
61  setup.get<Record> ().get (handle);
62  }
64  {
65  return std::string() ;
66  }
67 
68  // If handle is invalid, then data is already in DB
69 
71  if (!poolDb.isAvailable())
72  {
73  throw cond::Exception( "DataWriter: PoolDBOutputService not available."
74  ) ;
75  }
76  cond::DbSession session = poolDb->session();
77  cond::DbScopedTransaction tr(session);
78  // if throw transaction will unroll
79  tr.start(false);
80 
81  boost::shared_ptr<Type> pointer(new Type (*(handle.product ())));
82  std::string payloadToken = session.storeObject( pointer.get(),
84  );
85  tr.commit();
86  return payloadToken ;
87  }
std::string classNameForTypeId(const std::type_info &typeInfo)
bool isAvailable() const
Definition: Service.h:47
tuple handle
Definition: patZpeak.py:22
std::string storeObject(const T *object, const std::string &containerName)
Definition: DbSession.h:131
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62