CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
edm::eventsetup::DataProxyTemplate< RecordT, DataT > Class Template Referenceabstract

#include <DataProxyTemplate.h>

Inheritance diagram for edm::eventsetup::DataProxyTemplate< RecordT, DataT >:
edm::eventsetup::DataProxy

Public Types

typedef RecordT record_type
 
typedef DataT value_type
 

Public Member Functions

 DataProxyTemplate ()
 
void prefetchAsyncImpl (WaitingTaskHolder iTask, const EventSetupRecordImpl &iRecord, const DataKey &iKey, EventSetupImpl const *iEventSetupImpl, edm::ServiceToken const &iToken, edm::ESParentContext const &iParent) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxy
bool cacheIsValid () const
 
 DataProxy ()
 
 DataProxy (DataProxy const &)=delete
 
void const * get (EventSetupRecordImpl const &, DataKey const &, bool iTransiently, ActivityRegistry const *, EventSetupImpl const *, ESParentContext const &) const
 
void const * getAfterPrefetch (const EventSetupRecordImpl &iRecord, const DataKey &iKey, bool iTransiently) const
 
virtual void initializeForNewIOV ()
 
void invalidate ()
 
DataProxy const & operator= (DataProxy const &)=delete
 
void prefetchAsync (WaitingTaskHolder, EventSetupRecordImpl const &, DataKey const &, EventSetupImpl const *, ServiceToken const &, ESParentContext const &) const
 
ComponentDescription const * providerDescription () const
 returns the description of the DataProxyProvider which owns this Proxy More...
 
void resetIfTransient ()
 
void setProviderDescription (ComponentDescription const *iDesc)
 
virtual ~DataProxy ()
 

Protected Member Functions

void invalidateCache () override
 
virtual const DataT * make (const RecordT &, const DataKey &)=0
 
- Protected Member Functions inherited from edm::eventsetup::DataProxy
void clearCacheIsValid ()
 
virtual void const * getAfterPrefetchImpl () const =0
 
virtual void invalidateTransientCache ()
 

Private Attributes

std::atomic< bool > prefetching_ {false}
 
WaitingTaskList taskList_
 

Detailed Description

template<class RecordT, class DataT>
class edm::eventsetup::DataProxyTemplate< RecordT, DataT >

Definition at line 53 of file DataProxyTemplate.h.

Member Typedef Documentation

◆ record_type

template<class RecordT , class DataT >
typedef RecordT edm::eventsetup::DataProxyTemplate< RecordT, DataT >::record_type

Definition at line 56 of file DataProxyTemplate.h.

◆ value_type

template<class RecordT , class DataT >
typedef DataT edm::eventsetup::DataProxyTemplate< RecordT, DataT >::value_type

Definition at line 55 of file DataProxyTemplate.h.

Constructor & Destructor Documentation

◆ DataProxyTemplate()

template<class RecordT , class DataT >
edm::eventsetup::DataProxyTemplate< RecordT, DataT >::DataProxyTemplate ( )
inline

Definition at line 58 of file DataProxyTemplate.h.

58 {}

Member Function Documentation

◆ invalidateCache()

template<class RecordT , class DataT >
void edm::eventsetup::DataProxyTemplate< RecordT, DataT >::invalidateCache ( )
inlineoverrideprotectedvirtual

indicates that the Proxy should invalidate any cached information as that information has 'expired' (i.e. we have moved to a new IOV)

Implements edm::eventsetup::DataProxy.

Definition at line 88 of file DataProxyTemplate.h.

References edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetching_, edm::WaitingTaskList::reset(), and edm::eventsetup::DataProxyTemplate< RecordT, DataT >::taskList_.

88  {
89  taskList_.reset();
90  prefetching_ = false;
91  }
void reset()
Resets access to the resource so that added tasks will wait.

◆ make()

template<class RecordT , class DataT >
virtual const DataT* edm::eventsetup::DataProxyTemplate< RecordT, DataT >::make ( const RecordT &  ,
const DataKey  
)
protectedpure virtual

◆ prefetchAsyncImpl()

template<class RecordT , class DataT >
void edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetchAsyncImpl ( WaitingTaskHolder  ,
const EventSetupRecordImpl ,
const DataKey iKey,
EventSetupImpl const *  ,
edm::ServiceToken const &  ,
edm::ESParentContext const &   
)
inlineoverridevirtual

This is the function which does the real work of getting the data if it is not already cached. The returning 'void const*' must point to an instance of the class type corresponding to the type designated in iKey. So if iKey refers to a base class interface the pointer must be a pointer to that base class interface and not a pointer to an inheriting class instance.

Implements edm::eventsetup::DataProxy.

Definition at line 60 of file DataProxyTemplate.h.

References edm::WaitingTaskList::add(), cms::cuda::assert(), edm::WaitingTaskList::doneWaiting(), edm::WaitingTaskHolder::group(), edm::eventsetup::EventSetupRecordImpl::key(), edm::eventsetup::DataProxyTemplate< RecordT, DataT >::make(), SiStripPI::max, edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetching_, and edm::eventsetup::DataProxyTemplate< RecordT, DataT >::taskList_.

65  {
66  assert(iRecord.key() == RecordT::keyForClass());
67  bool expected = false;
68  bool doPrefetch = prefetching_.compare_exchange_strong(expected, true);
69  taskList_.add(iTask);
70 
71  if (doPrefetch) {
72  iTask.group()->run([this, &iRecord, iKey, iEventSetupImpl, iToken, iParent]() {
73  try {
74  RecordT rec;
75  rec.setImpl(&iRecord, std::numeric_limits<unsigned int>::max(), nullptr, iEventSetupImpl, &iParent);
76  ServiceRegistry::Operate operate(iToken);
77  this->make(rec, iKey);
78  } catch (...) {
79  this->taskList_.doneWaiting(std::current_exception());
80  return;
81  }
82  this->taskList_.doneWaiting(std::exception_ptr{});
83  });
84  }
85  }
assert(be >=bs)
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
void add(oneapi::tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
virtual const DataT * make(const RecordT &, const DataKey &)=0

Member Data Documentation

◆ prefetching_

template<class RecordT , class DataT >
std::atomic<bool> edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetching_ {false}
private

◆ taskList_

template<class RecordT , class DataT >
WaitingTaskList edm::eventsetup::DataProxyTemplate< RecordT, DataT >::taskList_
private