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 record_type = RecordT
 
using smart_pointer_traits = produce::smart_pointer_traits< DataT >
 
using value_type = typename smart_pointer_traits::type
 

Public Member Functions

 CallbackProxy (std::shared_ptr< CallbackT > &iCallback)
 
 CallbackProxy (const CallbackProxy &)=delete
 
const void * getImpl (const EventSetupRecordImpl &iRecord, const DataKey &) override
 
void invalidateCache () override
 
const CallbackProxyoperator= (const CallbackProxy &)=delete
 
 ~CallbackProxy () override
 
- Public Member Functions inherited from edm::eventsetup::DataProxy
bool cacheIsValid () const
 
 DataProxy ()
 
void doGet (EventSetupRecordImpl const &iRecord, DataKey const &iKey, bool iTransiently, ActivityRegistry const *) const
 
void const * get (EventSetupRecordImpl const &, DataKey const &iKey, bool iTransiently, ActivityRegistry const *) const
 
void invalidate ()
 
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 const * getImpl (EventSetupRecordImpl const &, DataKey const &iKey)=0
 
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

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

Definition at line 41 of file CallbackProxy.h.

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.

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

Definition at line 40 of file CallbackProxy.h.

Constructor & Destructor Documentation

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.

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

Referenced by edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::invalidateCache().

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  }
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition: CallbackProxy.h:74
template<class CallbackT , class RecordT , class DataT >
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::~CallbackProxy ( )
inlineoverride

Definition at line 50 of file CallbackProxy.h.

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

50  {
51  DataT* dummy(nullptr);
52  callback_->holdOntoPointer(dummy);
53  }
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition: CallbackProxy.h:74
template<class CallbackT , class RecordT , class DataT >
edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::CallbackProxy ( const CallbackProxy< CallbackT, RecordT, DataT > &  )
delete

Member Function Documentation

template<class CallbackT , class RecordT , class DataT >
const void* edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::getImpl ( const EventSetupRecordImpl iRecord,
const DataKey  
)
inlineoverride

Definition at line 55 of file CallbackProxy.h.

References 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().

55  {
56  assert(iRecord.key() == RecordT::keyForClass());
57  record_type rec;
58  rec.setImpl(&iRecord, callback_->transitionID(), callback_->getTokenIndices());
59  (*callback_)(rec);
61  }
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition: CallbackProxy.h:74
static auto getPointer(T &iPtr) -> decltype(&*iPtr)
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 63 of file CallbackProxy.h.

References edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::callback_, edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::CallbackProxy(), edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::data_, and edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >::operator=().

63  {
64  data_ = DataT{};
65  callback_->newRecordComing();
66  }
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition: CallbackProxy.h:74
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

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