1 #ifndef FWCore_Framework_Callback_h 2 #define FWCore_Framework_Callback_h 24 #include <type_traits> 42 namespace eventsetup {
43 class EventSetupRecordImpl;
46 template <
typename TRecord>
48 void pre(
const TRecord&) {}
49 void post(
const TRecord&) {}
57 = CallbackSimpleDecorator<TRecord>>
60 Callback(
T* iProd, TFunc iFunc,
unsigned int iID,
const TDecorator& iDec = TDecorator())
63 Callback(
T* iProd, std::shared_ptr<TFunc> iFunc,
unsigned int iID,
const TDecorator& iDec = TDecorator())
82 bool expected =
false;
93 [
this, iRecord, iEventSetupImpl, weakToken,
group](std::exception_ptr
const* iExcept) {
100 [
this,
group, iRecord, iEventSetupImpl, weakToken](std::exception_ptr
const* iExcept) {
105 &((*postMayGetProxies_).front()),
117 [
this,
group, iRecord, iEventSetupImpl, weakToken](std::exception_ptr
const* iExcept) {
125 template <
class DataT>
132 setData<typename type::head_type, typename type::tail_type>(iReturn);
135 template <
class RemainingContainerT,
class DataT,
class ProductsT>
138 if (
nullptr !=
temp) {
141 if constexpr (not std::is_same_v<produce::Null, RemainingContainerT>) {
142 setData<typename RemainingContainerT::head_type, typename RemainingContainerT::tail_type>(iProducts);
160 for (
size_t i = 0;
i !=
n; ++
i) {
178 std::exception_ptr
const* iExcept,
189 producer_->queue().push(*iGroup, [
this, iRecord, iEventSetupImpl, weakToken]() {
191 std::exception_ptr exceptPtr;
196 proxies = &((*postMayGetProxies_).front());
200 rec.setImpl(iRecord,
transitionID(), proxies, iEventSetupImpl, &pc);
205 : record_{iRecord}, context_{iContext} {}
206 ~EndGuard() { record_->activityRegistry()->postESModuleSignal_.emit(record_->key(), context_); }
217 exceptPtr = std::current_exception();
const Callback & operator=(const Callback &)=delete
std::optional< std::vector< ESProxyIndex > > postMayGetProxies_
void exceptionContext(cms::Exception &, ESModuleCallingContext const &)
void prefetchAsync(WaitingTaskHolder iTask, ESProxyIndex iProxyIndex, EventSetupImpl const *, ServiceToken const &, ESParentContext) const
prefetch the data to setup for subsequent calls to getImplementation
void prefetchNeededDataAsync(WaitingTaskHolder task, EventSetupImpl const *iImpl, ESProxyIndex const *proxies, edm::ServiceToken const &token) const
PreESModulePrefetching preESModulePrefetchingSignal_
std::shared_ptr< TFunc > function_
void pre(const TRecord &)
void reset()
Resets access to the resource so that added tasks will wait.
void runProducerAsync(oneapi::tbb::task_group *iGroup, std::exception_ptr const *iExcept, EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl, ServiceToken const &token)
PostESModulePrefetching postESModulePrefetchingSignal_
std::atomic< bool > wasCalledForThisRecord_
constexpr element_type const * get() const
oneapi::tbb::task_group * group() const noexcept
void emit(Args &&... args) const
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
void holdOntoPointer(DataT *iData)
ESModuleCallingContext callingContext_
void moveFromTo(FromT &iFrom, ToT &iTo)
void add(oneapi::tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
FunctorWaitingTask< F > * make_waiting_task(F f)
void setData(ProductsT &iProducts)
unsigned int transitionID() const
void post(const TRecord &)
ServiceToken lock() const
void prefetchAsync(WaitingTaskHolder iTask, EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl, ServiceToken const &token, ESParentContext const &iParent)
EventSetupRecordKey const & key() const
void setState(State state)
edm::propagate_const< T * > producer_
edm::WaitingTaskList taskList_
PreESModule preESModuleSignal_
void setContext(State state, ESParentContext const &parent)
std::array< void *, produce::size< TReturn >::value > proxyData_
bool handleMayGet(EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl)
auto wrap(F iFunc) -> decltype(iFunc())
Callback(T *iProd, TFunc iFunc, unsigned int iID, const TDecorator &iDec=TDecorator())
Callback(T *iProd, std::shared_ptr< TFunc > iFunc, unsigned int iID, const TDecorator &iDec=TDecorator())
eventsetup::EventSetupRecordImpl const * findImpl(const eventsetup::EventSetupRecordKey &) const
void storeReturnedValues(TReturn iReturn)
ActivityRegistry const * activityRegistry() const noexcept
ESProxyIndex const * getTokenIndices() const