20 ManualRuntime() =
default;
26 explicit ManualRuntime(Clock::time_point init);
34 void trigger(Clock::time_point tp);
42 void trigger(Clock::duration d);
50 void reset(Clock::time_point tp);
57 Clock::time_point
next()
const;
60 void schedule(Clock::time_point,
const Callback&,
const void* =
nullptr)
override;
61 void schedule(Clock::duration,
const Callback&,
const void* =
nullptr)
override;
62 void cancel(
const void* scope)
override;
63 Clock::time_point
now()
const override;
66 struct ScheduledCallback
68 ScheduledCallback(Clock::time_point tp,
const Callback& cb,
const void* scope) :
69 deadline(tp), callback(cb), scope(scope) {}
71 ScheduledCallback(
const ScheduledCallback&) =
delete;
72 ScheduledCallback& operator=(
const ScheduledCallback&) =
delete;
74 ScheduledCallback(ScheduledCallback&&) =
default;
75 ScheduledCallback& operator=(ScheduledCallback&&) =
default;
77 Clock::time_point deadline;
83 using time_index = boost::multi_index::ordered_non_unique<
84 boost::multi_index::tag<by_deadline>,
85 boost::multi_index::member<ScheduledCallback, Clock::time_point, &ScheduledCallback::deadline>>;
87 using scope_index = boost::multi_index::hashed_non_unique<
88 boost::multi_index::tag<by_scope>,
89 boost::multi_index::member<ScheduledCallback, const void*, &ScheduledCallback::scope>>;
91 boost::multi_index::indexed_by<time_index, scope_index>>;
95 Clock::time_point m_now;