1 #ifndef FWCore_Framework_Callback_h 2 #define FWCore_Framework_Callback_h 23 #include <type_traits> 41 namespace eventsetup {
42 class EventSetupRecordImpl;
45 template <
typename TRecord>
47 void pre(
const TRecord&) {}
48 void post(
const TRecord&) {}
55 = CallbackSimpleDecorator<TRecord>>
79 bool expected =
false;
90 [
this, iRecord, iEventSetupImpl, weakToken,
group](std::exception_ptr
const* iExcept) {
97 [
this,
group, iRecord, iEventSetupImpl, weakToken](std::exception_ptr
const* iExcept) {
102 &((*postMayGetProxies_).front()),
114 [
this,
group, iRecord, iEventSetupImpl, weakToken](std::exception_ptr
const* iExcept) {
122 template <
class DataT>
129 setData<typename type::head_type, typename type::tail_type>(iReturn);
132 template <
class RemainingContainerT,
class DataT,
class ProductsT>
135 if (
nullptr !=
temp) {
138 if constexpr (not std::is_same_v<produce::Null, RemainingContainerT>) {
139 setData<typename RemainingContainerT::head_type, typename RemainingContainerT::tail_type>(iProducts);
157 for (
size_t i = 0;
i !=
n; ++
i) {
175 std::exception_ptr
const* iExcept,
186 producer_->queue().push(*iGroup, [
this, iRecord, iEventSetupImpl, weakToken]() {
188 std::exception_ptr exceptPtr;
193 proxies = &((*postMayGetProxies_).front());
197 rec.setImpl(iRecord,
transitionID(), proxies, iEventSetupImpl, &pc);
202 : record_{iRecord}, context_{iContext} {}
203 ~EndGuard() { record_->activityRegistry()->postESModuleSignal_.emit(record_->key(), context_); }
214 exceptPtr = std::current_exception();
void storeReturnedValues(TReturn iReturn)
void prefetchNeededDataAsync(WaitingTaskHolder task, EventSetupImpl const *iImpl, ESProxyIndex const *proxies, edm::ServiceToken const &token) const
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
PreESModulePrefetching preESModulePrefetchingSignal_
ESModuleCallingContext callingContext_
void holdOntoPointer(DataT *iData)
void prefetchAsync(WaitingTaskHolder iTask, EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl, ServiceToken const &token, ESParentContext const &iParent)
std::array< void *, produce::size< TReturn >::value > proxyData_
bool handleMayGet(EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl)
void pre(const TRecord &)
void reset()
Resets access to the resource so that added tasks will wait.
Callback(T *iProd, method_type iMethod, unsigned int iID, const TDecorator &iDec=TDecorator())
PostESModulePrefetching postESModulePrefetchingSignal_
constexpr element_type const * get() const
TReturn(T ::*)(const TRecord &) method_type
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.
unsigned int transitionID() const
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)
ESProxyIndex const * getTokenIndices() const
std::atomic< bool > wasCalledForThisRecord_
void post(const TRecord &)
ServiceToken lock() const
edm::WaitingTaskList taskList_
void runProducerAsync(oneapi::tbb::task_group *iGroup, std::exception_ptr const *iExcept, EventSetupRecordImpl const *iRecord, EventSetupImpl const *iEventSetupImpl, ServiceToken const &token)
EventSetupRecordKey const & key() const
void setState(State state)
PreESModule preESModuleSignal_
void setContext(State state, ESParentContext const &parent)
std::optional< std::vector< ESProxyIndex > > postMayGetProxies_
void setData(ProductsT &iProducts)
const Callback & operator=(const Callback &)=delete
auto wrap(F iFunc) -> decltype(iFunc())
edm::propagate_const< T * > producer_
eventsetup::EventSetupRecordImpl const * findImpl(const eventsetup::EventSetupRecordKey &) const
ActivityRegistry const * activityRegistry() const noexcept