SerializableJsonEvent.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-07
  6. * Changed: 2024-05-24
  7. *
  8. * */
  9. #ifndef LS_STD_SERIALIZABLE_JSON_EVENT_HPP
  10. #define LS_STD_SERIALIZABLE_JSON_EVENT_HPP
  11. #include <ls-std/core/Class.hpp>
  12. #include <ls-std/core/interface/ISerializable.hpp>
  13. #include <ls-std/core/type/Types.hpp>
  14. #include <ls-std/event/Event.hpp>
  15. #include <ls-std/os/dynamic-goal.hpp>
  16. #include <memory>
  17. /*
  18. * @class(name: 'SerializableJsonEvent', package: 'event')
  19. * */
  20. namespace ls::std::event
  21. {
  22. class LS_STD_DYNAMIC_GOAL SerializableJsonEvent : public ls::std::core::Class, public ls::std::core::interface_type::ISerializable
  23. {
  24. public:
  25. explicit SerializableJsonEvent(const ::std::shared_ptr<ls::std::event::Event> &_value);
  26. ~SerializableJsonEvent() noexcept override;
  27. // implementation
  28. [[nodiscard]] ls::std::core::type::byte_field marshal() override;
  29. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  30. // additional functionality
  31. [[nodiscard]] ::std::shared_ptr<ls::std::event::Event> getValue() const;
  32. void setValue(const ::std::shared_ptr<ls::std::event::Event> &_value);
  33. private:
  34. ls::std::core::type::json jsonObject{};
  35. ::std::shared_ptr<ls::std::event::Event> value{};
  36. void _assignValue(const ::std::shared_ptr<ls::std::event::Event> &_value);
  37. void _unmarshalParameterList();
  38. void _update();
  39. void _updateEventParameterList();
  40. };
  41. }
  42. #endif