SectionPairSection.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-13
  6. * Changed: 2023-02-15
  7. *
  8. * */
  9. #ifndef LS_STD_SECTION_PAIR_SECTION_HPP
  10. #define LS_STD_SECTION_PAIR_SECTION_HPP
  11. #include <list>
  12. #include <ls-std/core/Class.hpp>
  13. #include <ls-std/core/interface/ISerializable.hpp>
  14. #include <ls-std/io/section-pair/SectionPairTypes.hpp>
  15. #include <ls-std/io/section-pair/type/SectionPairSectionTypes.hpp>
  16. #include <ls-std/os/dynamic-goal.hpp>
  17. #include <memory>
  18. namespace ls::std::io
  19. {
  20. class LS_STD_DYNAMIC_GOAL SectionPairSection : public ::std::enable_shared_from_this<SectionPairSection>, public ls::std::core::Class, public ls::std::core::interface_type::ISerializable
  21. {
  22. public:
  23. explicit SectionPairSection(const ls::std::io::section_pair_identifier &_sectionId);
  24. ~SectionPairSection() override;
  25. void add(const section_pair_row_list_element &_row);
  26. [[nodiscard]] section_pair_row_list_element get(size_t _index);
  27. [[nodiscard]] ls::std::io::section_pair_row_list getList();
  28. [[nodiscard]] size_t getRowAmount();
  29. [[nodiscard]] ls::std::io::section_pair_identifier getSectionId();
  30. [[nodiscard]] ls::std::core::type::byte_field marshal() override;
  31. void setSectionId(const ls::std::io::section_pair_identifier &_sectionId);
  32. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  33. private:
  34. ls::std::io::section_pair_row_list rows{};
  35. ls::std::io::section_pair_identifier sectionId{};
  36. ::std::shared_ptr<ls::std::core::interface_type::ISerializable> serializable{};
  37. void _createSerializable();
  38. [[nodiscard]] bool _hasRow(const ls::std::io::section_pair_identifier &_key);
  39. void _rowExistenceCheck(const ls::std::io::section_pair_identifier &_key);
  40. void _setSectionId(const ls::std::io::section_pair_identifier &_sectionId);
  41. };
  42. }
  43. #endif