CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT > Class Template Reference

#include <CallbackProxy.h>

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

Public Types

using RecordType = RecordT
 
using smart_pointer_traits = produce::smart_pointer_traits< DataT >
 
using ValueType = typename smart_pointer_traits::type
 

Public Member Functions

 CallbackProxy (const CallbackProxy &)=delete
 
 CallbackProxy (std::shared_ptr< CallbackT > &iCallback)
 
const void * getImpl (const EventSetupRecordImpl &iRecord, const DataKey &, EventSetupImpl const *iEventSetupImpl) override
 
void invalidateCache () override
 
const CallbackProxyoperator= (const CallbackProxy &)=delete
 
 ~CallbackProxy () override
 
- Public Member Functions inherited from edm::eventsetup::DataProxy
bool cacheIsValid () const
 
 DataProxy ()
 
 DataProxy (DataProxy const &)=delete
 
void doGet (EventSetupRecordImpl const &, DataKey const &, bool iTransiently, ActivityRegistry const *, EventSetupImpl const *) const
 
void const * get (EventSetupRecordImpl const &, DataKey const &, bool iTransiently, ActivityRegistry const *, EventSetupImpl const *) const
 
virtual void initializeForNewIOV ()
 
void invalidate ()
 
DataProxy const & operator= (DataProxy const &)=delete
 
ComponentDescription const * providerDescription () const
 returns the description of the DataProxyProvider which owns this Proxy More...
 
void resetIfTransient ()
 
void setProviderDescription (ComponentDescription const *iDesc)
 
virtual ~DataProxy ()
 

Private Attributes

edm::propagate_const< std::shared_ptr< CallbackT > > callback_
 
DataT data_ {}
 

Additional Inherited Members

- Protected Member Functions inherited from edm::eventsetup::DataProxy
void clearCacheIsValid ()
 
virtual void invalidateTransientCache ()
 

Detailed Description

template<class CallbackT, class RecordT, class DataT>
class edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >

Definition at line 37 of file CallbackProxy.h.

Member Typedef Documentation

◆ RecordType

template<class CallbackT , class RecordT , class DataT >
using edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::RecordType = RecordT

Definition at line 41 of file CallbackProxy.h.

◆ smart_pointer_traits

template<class CallbackT , class RecordT , class DataT >
using edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::smart_pointer_traits = produce::smart_pointer_traits<DataT>

Definition at line 39 of file CallbackProxy.h.

◆ ValueType

template<class CallbackT , class RecordT , class DataT >
using edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::ValueType = typename smart_pointer_traits::type

Definition at line 40 of file CallbackProxy.h.

Constructor & Destructor Documentation

◆ CallbackProxy() [1/2]

template<class CallbackT , class RecordT , class DataT >
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::CallbackProxy ( std::shared_ptr< CallbackT > &  iCallback)
inline

Definition at line 43 of file CallbackProxy.h.

43  : callback_{iCallback} {
44  //The callback fills the data directly. This is done so that the callback does not have to
45  // hold onto a temporary copy of the result of the callback since the callback is allowed
46  // to return multiple items where only one item is needed by this Proxy
47  iCallback->holdOntoPointer(&data_);
48  }

◆ ~CallbackProxy()

template<class CallbackT , class RecordT , class DataT >
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::~CallbackProxy ( )
inlineoverride

Definition at line 50 of file CallbackProxy.h.

50  {
51  DataT* dummy(nullptr);
52  callback_->holdOntoPointer(dummy);
53  }

References edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::callback_.

◆ CallbackProxy() [2/2]

template<class CallbackT , class RecordT , class DataT >
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::CallbackProxy ( const CallbackProxy< CallbackT, RecordT, DataT > &  )
delete

Member Function Documentation

◆ getImpl()

template<class CallbackT , class RecordT , class DataT >
const void* edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::getImpl ( const EventSetupRecordImpl ,
const DataKey iKey,
EventSetupImpl 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 55 of file CallbackProxy.h.

57  {
58  assert(iRecord.key() == RecordT::keyForClass());
59  RecordType rec;
60  rec.setImpl(&iRecord, callback_->transitionID(), callback_->getTokenIndices(), iEventSetupImpl, true);
61  (*callback_)(rec);
63  }

References cms::cuda::assert(), edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::callback_, edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::data_, edm::eventsetup::produce::smart_pointer_traits< T >::getPointer(), and edm::eventsetup::EventSetupRecordImpl::key().

◆ invalidateCache()

template<class CallbackT , class RecordT , class DataT >
void edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::invalidateCache ( )
inlineoverridevirtual

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 65 of file CallbackProxy.h.

65  {
66  data_ = DataT{};
67  callback_->newRecordComing();
68  }

References edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::callback_, and edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::data_.

◆ operator=()

template<class CallbackT , class RecordT , class DataT >
const CallbackProxy& edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::operator= ( const CallbackProxy< CallbackT, RecordT, DataT > &  )
delete

Member Data Documentation

◆ callback_

template<class CallbackT , class RecordT , class DataT >
edm::propagate_const<std::shared_ptr<CallbackT> > edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::callback_
private

◆ data_

template<class CallbackT , class RecordT , class DataT >
DataT edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::data_ {}
private
edm::eventsetup::CallbackProxy::data_
DataT data_
Definition: CallbackProxy.h:75
cms::cuda::assert
assert(be >=bs)
edm::eventsetup::produce::smart_pointer_traits::getPointer
static auto getPointer(T &iPtr) -> decltype(&*iPtr)
Definition: produce_helpers.h:90
edm::eventsetup::CallbackProxy::RecordType
RecordT RecordType
Definition: CallbackProxy.h:41
dummy
Definition: DummySelector.h:38
edm::eventsetup::CallbackProxy::callback_
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition: CallbackProxy.h:76