event.h 670 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <cstdlib>
  3. #include <string>
  4. #include <reflection/context.h>
  5. #include <reflection/object.h>
  6. #include <engine/forwards.h>
  7. namespace engine {
  8. class Event {
  9. private:
  10. uint64_t id_;
  11. std::string_view type_;
  12. reflection::Object source_;
  13. reflection::Context context_;
  14. public:
  15. Event(std::string_view type, reflection::Object const & source,
  16. reflection::Context const & context);
  17. bool is_a(std::string_view type) const { return type_ == type; }
  18. std::string_view type() const { return type_; }
  19. reflection::Object const & source() const { return source_; }
  20. reflection::Context const & context() const { return context_; }
  21. };
  22. }