Event.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-11-26
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #ifndef LS_STD_EVENT_HPP
  10. #define LS_STD_EVENT_HPP
  11. #include <ls_std/base/Class.hpp>
  12. #include <ls_std/serialization/ISerializable.hpp>
  13. #include <memory>
  14. #include "EventTypes.hpp"
  15. namespace ls_std
  16. {
  17. class Event : public ls_std::Class, public ISerializable
  18. {
  19. public:
  20. explicit Event(const ls_std::event_id &_id);
  21. ~Event() override = default;
  22. // implementation
  23. ls_std::byte_field marshal() override;
  24. void unmarshal(const ls_std::byte_field &_data) override;
  25. // additional functionality
  26. void addParameter(const ls_std::event_parameter &_eventParameter);
  27. void clearParameterList();
  28. ls_std::event_id getId();
  29. ls_std::event_parameter_list getParameterList();
  30. void removeParameter(const ls_std::event_parameter_id &_id);
  31. void setId(const ls_std::event_id &_id);
  32. void setSerializable(std::shared_ptr<ISerializable> _serializable);
  33. private:
  34. ls_std::event_id id{};
  35. ls_std::event_parameter_list parameterList{};
  36. std::shared_ptr<ISerializable> serializable{};
  37. void _assignId(const ls_std::event_id &_id);
  38. bool _hasParameter(const ls_std::event_id &_id);
  39. };
  40. }
  41. #endif