1#ifndef PINEFORGE_SOURCE_ROSTER_PASS_WORK_HPP
2#define PINEFORGE_SOURCE_ROSTER_PASS_WORK_HPP
4#if defined(PINEFORGE_ROSTER_PASS_OBSERVER)
9namespace pineforge::source::roster_pass_work {
11 std::uint64_t roster_cohort_visits = 0;
12 std::uint64_t due_passes = 0;
14inline thread_local Counts* observer =
nullptr;
16inline void note(std::uint64_t Counts::*field)
noexcept {
17 if (observer) ++(observer->*field);
22 explicit Scope(Counts& counts) noexcept : previous_(observer) { observer = &counts; }
23 ~Scope() { observer = previous_; }
24 Scope(
const Scope&) =
delete;
25 Scope& operator=(
const Scope&) =
delete;
31#define PF_ROSTER_PASS_WORK(field) \
32 ::pineforge::source::roster_pass_work::note( \
33 &::pineforge::source::roster_pass_work::Counts::field)
35#define PF_ROSTER_PASS_WORK(field) ((void)0)