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
31
#include "
FWCore/Framework/interface/produce_helpers.h
"
32
#include "
FWCore/Utilities/interface/propagate_const.h
"
33
34
// forward declarations
35
namespace
edm::eventsetup
{
36
37
template
<
class
CallbackT,
class
RecordT,
class
DataT>
38
class
CallbackProxy
final :
public
DataProxy
{
39
public
:
40
using
smart_pointer_traits
=
produce::smart_pointer_traits<DataT>
;
41
using
ValueType
=
typename
smart_pointer_traits::type
;
42
using
RecordType
= RecordT;
43
44
CallbackProxy
(std::shared_ptr<CallbackT>& iCallback) :
callback_
{iCallback} {
45
//The callback fills the data directly. This is done so that the callback does not have to
46
// hold onto a temporary copy of the result of the callback since the callback is allowed
47
// to return multiple items where only one item is needed by this Proxy
48
iCallback->holdOntoPointer(&
data_
);
49
}
50
51
~CallbackProxy
() final {
52
DataT*
dummy
(
nullptr
);
53
callback_
->holdOntoPointer(
dummy
);
54
}
55
56
void
prefetchAsyncImpl
(
WaitingTask
* iWaitTask,
57
const
EventSetupRecordImpl
& iRecord,
58
const
DataKey
&,
59
EventSetupImpl
const
* iEventSetupImpl,
60
ServiceToken
const
& iToken)
final
{
61
assert
(iRecord.key() == RecordT::keyForClass());
62
callback_
->prefetchAsync(iWaitTask, &iRecord, iEventSetupImpl, iToken);
63
}
64
65
void
const
*
getAfterPrefetchImpl
()
const
final {
return
smart_pointer_traits::getPointer
(
data_
); }
66
67
void
invalidateCache
()
override
{
68
data_
= DataT{};
69
callback_
->newRecordComing();
70
}
71
72
// Delete copy operations
73
CallbackProxy
(
const
CallbackProxy
&) =
delete
;
74
const
CallbackProxy
&
operator=
(
const
CallbackProxy
&) =
delete
;
75
76
private
:
77
DataT
data_
{};
78
edm::propagate_const<std::shared_ptr<CallbackT>
>
callback_
;
79
};
80
81
}
// namespace edm::eventsetup
82
83
#endif
edm::eventsetup::produce::smart_pointer_traits
Definition:
produce_helpers.h:88
propagate_const.h
edm::EventSetupImpl
Definition:
EventSetupImpl.h:48
edm::eventsetup::CallbackProxy::data_
DataT data_
Definition:
CallbackProxy.h:77
cms::cuda::assert
assert(be >=bs)
edm::eventsetup::CallbackProxy::prefetchAsyncImpl
void prefetchAsyncImpl(WaitingTask *iWaitTask, const EventSetupRecordImpl &iRecord, const DataKey &, EventSetupImpl const *iEventSetupImpl, ServiceToken const &iToken) final
Definition:
CallbackProxy.h:56
edm::eventsetup::DataKey
Definition:
DataKey.h:29
edm::eventsetup::CallbackProxy::invalidateCache
void invalidateCache() override
Definition:
CallbackProxy.h:67
watchdog.const
const
Definition:
watchdog.py:83
DataProxy.h
EventSetupRecord.h
edm::ServiceToken
Definition:
ServiceToken.h:40
edm::propagate_const
Definition:
propagate_const.h:32
edm::eventsetup::CallbackProxy::ValueType
typename smart_pointer_traits::type ValueType
Definition:
CallbackProxy.h:41
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:65
edm::eventsetup::EventSetupRecordImpl
Definition:
EventSetupRecordImpl.h:76
edm::eventsetup::CallbackProxy::CallbackProxy
CallbackProxy(std::shared_ptr< CallbackT > &iCallback)
Definition:
CallbackProxy.h:44
edm::eventsetup::CallbackProxy::~CallbackProxy
~CallbackProxy() final
Definition:
CallbackProxy.h:51
edm::eventsetup::CallbackProxy::RecordType
RecordT RecordType
Definition:
CallbackProxy.h:42
edm::eventsetup::DataProxy
Definition:
DataProxy.h:41
produce_helpers.h
edm::WaitingTask
Definition:
WaitingTask.h:36
edm::eventsetup::CallbackProxy
Definition:
CallbackProxy.h:38
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:78
Generated for CMSSW Reference Manual by
1.8.16