actor_test.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // Copyright (c) 2019-2021 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
  3. //
  4. // Distributed under the MIT Software License
  5. //
  6. #pragma once
  7. #include "rotor/actor_base.h"
  8. #include <list>
  9. #include <functional>
  10. namespace rotor {
  11. namespace test {
  12. namespace payload {
  13. struct sample_t {
  14. int value;
  15. };
  16. } // namespace payload
  17. namespace message {
  18. using sample_t = rotor::message_t<payload::sample_t>;
  19. }
  20. struct actor_test_t;
  21. using plugin_configurer_t = std::function<void(actor_base_t &self, plugin::plugin_base_t &)>;
  22. using shutdown_fn_t = std::function<void(actor_test_t &self)>;
  23. struct actor_test_t : public actor_base_t {
  24. using actor_base_t::actor_base_t;
  25. ~actor_test_t();
  26. plugin_configurer_t configurer;
  27. shutdown_fn_t shutdowner;
  28. void configure(plugin::plugin_base_t &plugin) noexcept override;
  29. auto &get_plugins() const noexcept { return plugins; }
  30. auto get_activating_plugins() noexcept { return this->activating_plugins; }
  31. auto get_deactivating_plugins() noexcept { return this->deactivating_plugins; }
  32. auto &get_state() noexcept { return state; }
  33. void shutdown_finish() noexcept override;
  34. void force_cleanup() noexcept;
  35. };
  36. } // namespace test
  37. } // namespace rotor