#include <DataProxy.h>
Public Member Functions | |
bool | cacheIsValid () const |
DataProxy () | |
void | doGet (EventSetupRecord const &iRecord, DataKey const &iKey, bool iTransiently) const |
void const * | get (EventSetupRecord const &, DataKey const &iKey, bool iTransiently) const |
void | invalidate () |
ComponentDescription const * | providerDescription () const |
returns the description of the DataProxyProvider which owns this Proxy | |
void | resetIfTransient () |
void | setProviderDescription (ComponentDescription const *iDesc) |
virtual | ~DataProxy () |
Protected Member Functions | |
void | clearCacheIsValid () |
virtual void const * | getImpl (EventSetupRecord const &, DataKey const &iKey)=0 |
virtual void | invalidateCache ()=0 |
virtual void | invalidateTransientCache () |
Private Member Functions | |
DataProxy (DataProxy const &) | |
DataProxy const & | operator= (DataProxy const &) |
void | setCacheIsValidAndAccessType (bool iTransientAccessOnly) const |
Private Attributes | |
void const * | cache_ |
bool | cacheIsValid_ |
ComponentDescription const * | description_ |
bool | nonTransientAccessRequested_ |
Definition at line 33 of file DataProxy.h.
Definition at line 40 of file DataProxy.cc.
: cache_(0), cacheIsValid_(false), nonTransientAccessRequested_(false), description_(dummyDescription()) { }
Definition at line 53 of file DataProxy.cc.
{ }
edm::eventsetup::DataProxy::DataProxy | ( | DataProxy const & | ) | [private] |
bool edm::eventsetup::DataProxy::cacheIsValid | ( | ) | const [inline] |
Definition at line 40 of file DataProxy.h.
References cacheIsValid_.
Referenced by get(), and edm::eventsetup::EventSetupRecord::wasGotten().
{ return cacheIsValid_; }
void DataProxy< RecordT, DataT >::clearCacheIsValid | ( | ) | [protected] |
Definition at line 80 of file DataProxy.cc.
References cache_, cacheIsValid_, and nonTransientAccessRequested_.
Referenced by invalidate(), and resetIfTransient().
{ cacheIsValid_ = false; nonTransientAccessRequested_ = false; cache_ = 0; }
void DataProxy< RecordT, DataT >::doGet | ( | EventSetupRecord const & | iRecord, |
DataKey const & | iKey, | ||
bool | iTransiently | ||
) | const |
Definition at line 126 of file DataProxy.cc.
Referenced by edm::eventsetup::EventSetupRecord::doGet().
{
get(iRecord, iKey, iTransiently);
}
const void * DataProxy< RecordT, DataT >::get | ( | EventSetupRecord const & | iRecord, |
DataKey const & | iKey, | ||
bool | iTransiently | ||
) | const |
Definition at line 110 of file DataProxy.cc.
References cache_, cacheIsValid(), getImpl(), and setCacheIsValidAndAccessType().
Referenced by edm::eventsetup::EventSetupRecord::getFromProxy().
{ if(!cacheIsValid()) { cache_ = const_cast<DataProxy*>(this)->getImpl(iRecord, iKey); } //It is safe to always set cache to valid. //We need to set the AccessType for each request so this can't be called in the if block above. //This also must be before the cache_ check since we want to setCacheIsValid before a possible // exception throw. If we don't, 'getImpl' will be called again on a second request for the data. setCacheIsValidAndAccessType(iTransiently); if(0 == cache_) { throwMakeException(iRecord, iKey); } return cache_; }
virtual void const* edm::eventsetup::DataProxy::getImpl | ( | EventSetupRecord const & | , |
DataKey const & | iKey | ||
) | [protected, pure virtual] |
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.
Implemented in edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >, and edm::eventsetup::DataProxyTemplate< RecordT, DataT >.
Referenced by get().
void edm::eventsetup::DataProxy::invalidate | ( | ) | [inline] |
Definition at line 52 of file DataProxy.h.
References clearCacheIsValid(), and invalidateCache().
{ clearCacheIsValid(); invalidateCache(); }
virtual void edm::eventsetup::DataProxy::invalidateCache | ( | ) | [protected, pure virtual] |
indicates that the Proxy should invalidate any cached information as that information has 'expired' (i.e. we have moved to a new IOV)
Implemented in DataProxy< RecordT, DataT >, and edm::eventsetup::CallbackProxy< CallbackT, RecordT, DataT >.
Referenced by invalidate(), and invalidateTransientCache().
void DataProxy< RecordT, DataT >::invalidateTransientCache | ( | ) | [protected, virtual] |
indicates that the Proxy should invalidate any cached information as that information was accessed transiently and therefore is not intended to be kept over the entire IOV. Default is to call invalidateCache().
Reimplemented in DataProxy< RecordT, DataT >.
Definition at line 95 of file DataProxy.cc.
References invalidateCache().
Referenced by resetIfTransient().
{ invalidateCache(); }
ComponentDescription const* edm::eventsetup::DataProxy::providerDescription | ( | ) | const [inline] |
returns the description of the DataProxyProvider which owns this Proxy
Definition at line 46 of file DataProxy.h.
References description_.
Referenced by edm::eventsetup::EventSetupRecord::add(), edm::eventsetup::EventSetupRecord::doGet(), edm::eventsetup::EventSetupRecord::getFromProxy(), and edm::eventsetup::EventSetupRecord::providerDescription().
{ return description_; }
void DataProxy< RecordT, DataT >::resetIfTransient | ( | ) |
Definition at line 87 of file DataProxy.cc.
References clearCacheIsValid(), invalidateTransientCache(), and nonTransientAccessRequested_.
{ if (!nonTransientAccessRequested_) { clearCacheIsValid(); invalidateTransientCache(); } }
void DataProxy< RecordT, DataT >::setCacheIsValidAndAccessType | ( | bool | iTransientAccessOnly | ) | const [private] |
Definition at line 73 of file DataProxy.cc.
References cacheIsValid_, and nonTransientAccessRequested_.
Referenced by get().
{ cacheIsValid_ = true; if(!iTransientAccessOnly) { nonTransientAccessRequested_ = true; } }
void edm::eventsetup::DataProxy::setProviderDescription | ( | ComponentDescription const * | iDesc | ) | [inline] |
void const* edm::eventsetup::DataProxy::cache_ [mutable, private] |
Definition at line 91 of file DataProxy.h.
Referenced by clearCacheIsValid(), and get().
bool edm::eventsetup::DataProxy::cacheIsValid_ [mutable, private] |
Definition at line 92 of file DataProxy.h.
Referenced by cacheIsValid(), clearCacheIsValid(), and setCacheIsValidAndAccessType().
ComponentDescription const* edm::eventsetup::DataProxy::description_ [private] |
Definition at line 94 of file DataProxy.h.
Referenced by providerDescription(), and setProviderDescription().
bool edm::eventsetup::DataProxy::nonTransientAccessRequested_ [mutable, private] |
Definition at line 93 of file DataProxy.h.
Referenced by clearCacheIsValid(), resetIfTransient(), and setCacheIsValidAndAccessType().