SerializableJSONDouble.hpp 926 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-04
  6. * Changed: 2020-11-06
  7. *
  8. * */
  9. #ifndef LS_STD_SERIALIZABLE_JSON_DOUBLE_HPP
  10. #define LS_STD_SERIALIZABLE_JSON_DOUBLE_HPP
  11. #include <memory>
  12. #include <json.hpp>
  13. #include "../../../../../include/base/Class.hpp"
  14. #include "../../ISerializable.hpp"
  15. #include "../../../boxing/Double.hpp"
  16. namespace ls_std {
  17. class SerializableJSONDouble : public Class, public ISerializable {
  18. public:
  19. explicit SerializableJSONDouble(std::shared_ptr<ls_std::Double> _value);
  20. ~SerializableJSONDouble() = default;
  21. ls_std::byte_field marshal() override;
  22. void unmarshal(const ls_std::byte_field& _data) override;
  23. private:
  24. std::shared_ptr<ls_std::Double> value {};
  25. nlohmann::json jsonObject {};
  26. void _update();
  27. };
  28. }
  29. #endif