init_shutdown.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. //
  3. // Copyright (c) 2019-2020 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
  4. //
  5. // Distributed under the MIT Software License
  6. //
  7. #include "plugin_base.h"
  8. namespace rotor::plugin {
  9. /** \struct init_shutdown_plugin_t
  10. *
  11. * \brief manages actors init and shutdown procedures
  12. *
  13. * All actor plugins are polled when init(shutdown) request is received
  14. * in the direct(reverse) order. When all actors confirmed that they are
  15. * ready then initialization (shutdown) is confirmed to uplink.
  16. *
  17. */
  18. struct init_shutdown_plugin_t : public plugin_base_t {
  19. using plugin_base_t::plugin_base_t;
  20. /** The plugin unique identity to allow further static_cast'ing*/
  21. static const void *class_identity;
  22. const void *identity() const noexcept override;
  23. void activate(actor_base_t *actor) noexcept override;
  24. /** \brief init message handler */
  25. void on_init(message::init_request_t &message) noexcept;
  26. /** \brief shutdown message handler */
  27. void on_shutdown(message::shutdown_request_t &message) noexcept;
  28. bool handle_shutdown(message::shutdown_request_t *message) noexcept override;
  29. bool handle_init(message::init_request_t *message) noexcept override;
  30. };
  31. } // namespace rotor::plugin