:cpp:func:`CommImpl::on_completion <simgrid::s4u::Comm::on_completion_cb>`
- :cpp:func:`Disk::on_creation <simgrid::s4u::Disk::on_creation_cb>`
:cpp:func:`Disk::on_destruction <simgrid::s4u::Disk::on_destruction_cb>`
+ :cpp:func:`Disk::on_this_destruction <simgrid::s4u::Disk::on_this_destruction_cb>`
:cpp:func:`Disk::on_state_change <simgrid::s4u::Disk::on_state_change_cb>`
+ :cpp:func:`Disk::on_this_state_change <simgrid::s4u::Disk::on_this_state_change_cb>`
- :cpp:func:`Engine::on_platform_creation <simgrid::s4u::Engine::on_platform_creation_cb>`
:cpp:func:`Engine::on_platform_created <simgrid::s4u::Engine::on_platform_created_cb>`
:cpp:func:`Engine::on_time_advance <simgrid::s4u::Engine::on_time_advance_cb>`
.. doxygenfunction:: simgrid::s4u::Disk::on_creation_cb
.. doxygenfunction:: simgrid::s4u::Disk::on_destruction_cb
+ .. doxygenfunction:: simgrid::s4u::Disk::on_this_destruction_cb
.. doxygenfunction:: simgrid::s4u::Disk::on_state_change_cb
+ .. doxygenfunction:: simgrid::s4u::Disk::on_this_state_change_cb
.. _API_s4u_Host:
/* The signals */
/** @brief Add a callback fired when a new Disk is created */
static void on_creation_cb(const std::function<void(Disk&)>& cb) { on_creation.connect(cb); }
- /** @brief Add a callback fired when a Disk is destroyed */
+ /** @brief Add a callback fired when any Disk is destroyed */
static void on_destruction_cb(const std::function<void(Disk const&)>& cb) { on_destruction.connect(cb); }
- /** @brief Add a callback fired when a Disk's state changes */
+ /** @brief Add a callback fired when this specific Disk is destroyed */
+ void on_this_destruction_cb(const std::function<void(Disk const&)>& cb) { on_this_destruction.connect(cb); }
+ /** @brief Add a callback fired when the state of any Disk changes */
static void on_state_change_cb(const std::function<void(Disk const&)>& cb) { on_state_change.connect(cb); }
+ /** @brief Add a callback fired when the state of this specific Disk changes */
+ void on_this_state_change_cb(const std::function<void(Disk const&)>& cb) { on_this_state_change.connect(cb); }
private:
static xbt::signal<void(Disk&)> on_creation;
static xbt::signal<void(Disk const&)> on_destruction;
+ xbt::signal<void(Disk const&)> on_this_destruction;
static xbt::signal<void(Disk const&)> on_state_change;
+ xbt::signal<void(Disk const&)> on_this_state_change;
};
} // namespace s4u
void DiskImpl::destroy()
{
s4u::Disk::on_destruction(piface_);
+ piface_.on_this_destruction(piface_);
delete this;
}
if (not is_on()) {
Resource::turn_on();
s4u::Disk::on_state_change(piface_);
+ piface_.on_this_state_change(piface_);
}
}
void DiskImpl::turn_off()
if (is_on()) {
Resource::turn_off();
s4u::Disk::on_state_change(piface_);
+ piface_.on_this_state_change(piface_);
const kernel::lmm::Element* elem = nullptr;
double now = EngineImpl::get_clock();