FWCore
Framework
interface
CallbackProxy.h
Go to the documentation of this file.
1
#ifndef Framework_CallbackProxy_h
2
#define Framework_CallbackProxy_h
3
// -*- C++ -*-
4
//
5
// Package: Framework
6
// Class : CallbackProxy
7
//
17
//
18
// Author: Chris Jones
19
// Created: Fri Apr 8 11:50:21 CDT 2005
20
//
21
22
// system include files
23
#include <cassert>
24
#include <memory>
25
26
// user include files
27
#include "
FWCore/Framework/interface/DataProxy.h
"
28
#include "
FWCore/Framework/interface/EventSetupRecord.h
"
29
#include "
FWCore/Concurrency/interface/WaitingTaskList.h
"
30
#include "
FWCore/Concurrency/interface/WaitingTaskHolder.h
"
31
32
#include "
FWCore/Framework/interface/produce_helpers.h
"
33
#include "
FWCore/Utilities/interface/propagate_const.h
"
34
35
// forward declarations
36
namespace
edm::eventsetup
{
37
38
template
<
class
CallbackT,
class
RecordT,
class
DataT>
39
class
CallbackProxy
final :
public
DataProxy
{
40
public
:
41
using
smart_pointer_traits
=
produce::smart_pointer_traits<DataT>
;
42
using
ValueType
=
typename
smart_pointer_traits::type
;
43
using
RecordType
= RecordT;
44
45
CallbackProxy
(std::shared_ptr<CallbackT>& iCallback) :
callback_
{iCallback} {
46
//The callback fills the data directly. This is done so that the callback does not have to
47
// hold onto a temporary copy of the result of the callback since the callback is allowed
48
// to return multiple items where only one item is needed by this Proxy
49
iCallback->holdOntoPointer(&
data_
);
50
}
51
52
~CallbackProxy
() final {
53
DataT*
dummy
(
nullptr
);
54
callback_
->holdOntoPointer(
dummy
);
55
}
56
57
void
prefetchAsyncImpl
(
WaitingTaskHolder
iWaitTask,
58
const
EventSetupRecordImpl
& iRecord,
59
const
DataKey
&,
60
EventSetupImpl
const
* iEventSetupImpl,
61
ServiceToken
const
& iToken,
62
edm::ESParentContext
const
& iParent)
final
{
63
assert
(iRecord.key() == RecordT::keyForClass());
64
callback_
->prefetchAsync(iWaitTask, &iRecord, iEventSetupImpl, iToken, iParent);
65
}
66
67
void
const
*
getAfterPrefetchImpl
()
const
final {
return
smart_pointer_traits::getPointer
(
data_
); }
68
69
void
invalidateCache
()
override
{
70
data_
= DataT{};
71
callback_
->newRecordComing();
72
}
73
74
// Delete copy operations
75
CallbackProxy
(
const
CallbackProxy
&) =
delete
;
76
const
CallbackProxy
&
operator=
(
const
CallbackProxy
&) =
delete
;
77
78
private
:
79
DataT
data_
{};
80
edm::propagate_const<std::shared_ptr<CallbackT>
>
callback_
;
81
};
82
83
}
// namespace edm::eventsetup
84
85
#endif
edm::eventsetup::produce::smart_pointer_traits
Definition:
produce_helpers.h:88
propagate_const.h
edm::EventSetupImpl
Definition:
EventSetupImpl.h:49
WaitingTaskHolder.h
edm::eventsetup::CallbackProxy::data_
DataT data_
Definition:
CallbackProxy.h:79
cms::cuda::assert
assert(be >=bs)
edm::eventsetup::DataKey
Definition:
DataKey.h:29
edm::eventsetup::CallbackProxy::invalidateCache
void invalidateCache() override
Definition:
CallbackProxy.h:69
watchdog.const
const
Definition:
watchdog.py:83
DataProxy.h
EventSetupRecord.h
edm::ServiceToken
Definition:
ServiceToken.h:42
edm::propagate_const
Definition:
propagate_const.h:32
edm::eventsetup::CallbackProxy::ValueType
typename smart_pointer_traits::type ValueType
Definition:
CallbackProxy.h:42
edm::eventsetup::produce::smart_pointer_traits::getPointer
static auto getPointer(T const &iPtr) -> decltype(&*iPtr)
Definition:
produce_helpers.h:90
edm::eventsetup::CallbackProxy::operator=
const CallbackProxy & operator=(const CallbackProxy &)=delete
edm::eventsetup::CallbackProxy::getAfterPrefetchImpl
void const * getAfterPrefetchImpl() const final
Definition:
CallbackProxy.h:67
edm::eventsetup::EventSetupRecordImpl
Definition:
EventSetupRecordImpl.h:77
edm::eventsetup::CallbackProxy::CallbackProxy
CallbackProxy(std::shared_ptr< CallbackT > &iCallback)
Definition:
CallbackProxy.h:45
edm::WaitingTaskHolder
Definition:
WaitingTaskHolder.h:32
edm::eventsetup::CallbackProxy::~CallbackProxy
~CallbackProxy() final
Definition:
CallbackProxy.h:52
edm::eventsetup::CallbackProxy::RecordType
RecordT RecordType
Definition:
CallbackProxy.h:43
edm::ESParentContext
Definition:
ESParentContext.h:21
edm::eventsetup::CallbackProxy::prefetchAsyncImpl
void prefetchAsyncImpl(WaitingTaskHolder iWaitTask, const EventSetupRecordImpl &iRecord, const DataKey &, EventSetupImpl const *iEventSetupImpl, ServiceToken const &iToken, edm::ESParentContext const &iParent) final
Definition:
CallbackProxy.h:57
edm::eventsetup::DataProxy
Definition:
DataProxy.h:42
produce_helpers.h
edm::eventsetup::CallbackProxy
Definition:
CallbackProxy.h:39
WaitingTaskList.h
edm::eventsetup::produce::smart_pointer_traits::type
typename T::element_type type
Definition:
produce_helpers.h:89
dummy
Definition:
DummySelector.h:38
edm::eventsetup
Definition:
ES_DDDetector.cc:16
edm::eventsetup::CallbackProxy::callback_
edm::propagate_const< std::shared_ptr< CallbackT > > callback_
Definition:
CallbackProxy.h:80
Generated for CMSSW Reference Manual by
1.8.16