SerializableJsonState.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-15
  6. * Changed: 2022-07-15
  7. *
  8. * */
  9. #ifndef LS_STD_SERIALIZABLE_JSON_STATE_HPP
  10. #define LS_STD_SERIALIZABLE_JSON_STATE_HPP
  11. #include <memory>
  12. #include <ls_std/core/types/Types.hpp>
  13. #include <ls_std/logic/State.hpp>
  14. #include <ls_std/core/interface/ISerializable.hpp>
  15. #include <ls_std/core/Class.hpp>
  16. #include <ls_std/os/dynamic_goal.hpp>
  17. namespace ls::std::logic
  18. {
  19. class [[deprecated("consider using ls_game_tool_kit dependency instead!")]] LS_STD_DYNAMIC_GOAL SerializableJsonState : public ls::std::core::Class, public ls::std::core::interface_type::ISerializable
  20. {
  21. public:
  22. explicit SerializableJsonState(const ::std::shared_ptr<ls::std::logic::State> &_value);
  23. ~SerializableJsonState() override = default;
  24. // implementation
  25. ls::std::core::type::byte_field marshal() override;
  26. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  27. // additional functionality
  28. ::std::shared_ptr<ls::std::logic::State> getValue();
  29. void setValue(const ::std::shared_ptr<ls::std::logic::State> &_value);
  30. private:
  31. ls::std::core::type::json jsonObject{};
  32. ::std::shared_ptr<ls::std::logic::State> value{};
  33. void _assignValue(const ::std::shared_ptr<ls::std::logic::State> &_value);
  34. void _clear();
  35. void _unmarshalStateConnections();
  36. void _update();
  37. void _updateStateConnections();
  38. };
  39. }
  40. #endif