SerializableJsonEvent.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-07
  6. * Changed: 2023-05-19
  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. namespace ls::std::event
  18. {
  19. class LS_STD_DYNAMIC_GOAL SerializableJsonEvent : public ls::std::core::Class, public ls::std::core::interface_type::ISerializable
  20. {
  21. public:
  22. explicit SerializableJsonEvent(const ::std::shared_ptr<ls::std::event::Event> &_value);
  23. ~SerializableJsonEvent() noexcept override;
  24. // implementation
  25. [[nodiscard]] ls::std::core::type::byte_field marshal() override;
  26. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  27. // additional functionality
  28. [[nodiscard]] ::std::shared_ptr<ls::std::event::Event> getValue() const;
  29. void setValue(const ::std::shared_ptr<ls::std::event::Event> &_value);
  30. private:
  31. ls::std::core::type::json jsonObject{};
  32. ::std::shared_ptr<ls::std::event::Event> value{};
  33. void _assignValue(const ::std::shared_ptr<ls::std::event::Event> &_value);
  34. void _unmarshalParameterList();
  35. void _update();
  36. void _updateEventParameterList();
  37. };
  38. }
  39. #endif