Event.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-11-26
  6. * Changed: 2020-12-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. class Event : public ls_std::Class, public ISerializable {
  17. public:
  18. explicit Event(const ls_std::event_id& _id);
  19. ~Event() override = default;
  20. // implementation
  21. ls_std::byte_field marshal() override;
  22. void unmarshal(const ls_std::byte_field& _data) override;
  23. // additional functionality
  24. void addParameter(const ls_std::event_parameter& _eventParameter);
  25. void clearParameterList();
  26. ls_std::event_id getId();
  27. ls_std::event_parameter_list getParameterList();
  28. void removeParameter(const ls_std::event_parameter_id& _id);
  29. void setId(const ls_std::event_id& _id);
  30. void setSerializable(std::shared_ptr<ISerializable> _serializable);
  31. private:
  32. ls_std::event_id id {};
  33. ls_std::event_parameter_list parameterList {};
  34. std::shared_ptr<ISerializable> serializable {};
  35. void _assignId(const ls_std::event_id& _id);
  36. bool _hasParameter(const ls_std::event_id& _id);
  37. };
  38. }
  39. #endif