103 const SpartaHandler & event_handler) :
105 event_handler_(event_handler),
106 ev_sched_ptr_(clk->getScheduler()->getGlobalPhasedPayloadEventPtr<sched_phase_T>())
110 local_clk_(rhs.local_clk_),
111 event_handler_(rhs.event_handler_),
112 ev_handler_lifetime_(&event_handler_),
113 ev_sched_ptr_(rhs.ev_sched_ptr_)
117 GlobalEvent(GlobalEvent&& rhs) :
118 local_clk_(rhs.local_clk_),
119 event_handler_(std::move(rhs.event_handler_)),
120 ev_handler_lifetime_(&event_handler_),
121 ev_sched_ptr_(rhs.ev_sched_ptr_)
123 rhs.ev_handler_lifetime_.reset();
127 local_clk_ = rhs.local_clk_;
128 event_handler_ = rhs.event_handler_;
129 ev_handler_lifetime_ = utils::LifeTracker<SpartaHandler>(&event_handler_);
130 ev_sched_ptr_ = rhs.ev_sched_ptr_;
136 local_clk_ = rhs.local_clk_;
137 event_handler_ = std::move(rhs.event_handler_);
138 ev_handler_lifetime_ = utils::LifeTracker<SpartaHandler>(&event_handler_);
139 ev_sched_ptr_ = rhs.ev_sched_ptr_;
141 rhs.ev_handler_lifetime_.reset();
146 void schedule(
const Clock::Cycle & delay,
const Clock * clk) {
148 sparta_assert(ev_sched_ptr_->getSchedulingPhase() == sched_phase_T);
150 ev_sched_ptr_->preparePayload(GlobalEventProxy(ev_handler_lifetime_))->schedule(delay, clk);
153 void schedule(
const Clock::Cycle & delay) {
155 sparta_assert(ev_sched_ptr_->getSchedulingPhase() == sched_phase_T);
157 ev_sched_ptr_->preparePayload(GlobalEventProxy(ev_handler_lifetime_))->schedule(delay, local_clk_);
160 void resetHandler(
const SpartaHandler & event_handler) {
161 event_handler_ = event_handler;
168 friend class GlobalEventProxy;
171 const Clock * local_clk_ =
nullptr;
172 SpartaHandler event_handler_;
173 utils::LifeTracker<SpartaHandler> ev_handler_lifetime_{&event_handler_};
174 PhasedPayloadEvent<GlobalEventProxy> * ev_sched_ptr_;