SerializableSectionPairRowSingleValue.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-11
  6. * Changed: 2023-02-13
  7. *
  8. * */
  9. #include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
  10. #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
  11. #include <ls-std/io/section-pair/model/SectionPairRowSingleValue.hpp>
  12. #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.hpp>
  13. ls::std::io::SerializableSectionPairRowSingleValue::SerializableSectionPairRowSingleValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
  14. {
  15. this->_setValue(_value);
  16. }
  17. ls::std::io::SerializableSectionPairRowSingleValue::~SerializableSectionPairRowSingleValue() = default;
  18. ::std::shared_ptr<ls::std::core::Class> ls::std::io::SerializableSectionPairRowSingleValue::getValue()
  19. {
  20. return this->value;
  21. }
  22. ls::std::core::type::byte_field ls::std::io::SerializableSectionPairRowSingleValue::marshal()
  23. {
  24. return ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->get();
  25. }
  26. void ls::std::io::SerializableSectionPairRowSingleValue::unmarshal(const ls::std::core::type::byte_field &_data)
  27. {
  28. ls::std::core::EmptyStringArgumentEvaluator{_data}.evaluate();
  29. ::std::dynamic_pointer_cast<ls::std::io::SectionPairRowSingleValue>(this->value)->set(_data);
  30. }
  31. void ls::std::io::SerializableSectionPairRowSingleValue::_setValue(const ::std::shared_ptr<ls::std::core::Class> &_value)
  32. {
  33. ls::std::core::NullPointerArgumentEvaluator{_value, "model reference for SerializableSectionPairRowSingleValue is null!"}.evaluate();
  34. this->value = _value;
  35. }