From 7b6e0ca99f8521e034452f0d0243a7f3e33843a9 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 28 May 2024 17:23:20 +0200 Subject: Docs and Sycl fixes --- modules/codec/c++/data.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'modules/codec') diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index c7af0d4..2a5f082 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -205,15 +205,27 @@ public: } }; +/** + * Data class which represents a struct in the native format. + */ template class data...>, encode::Native> { private: + /** + * Tuple storing the member values. + */ std::tuple>...> value_; public: + /** + * Default constructor. + */ data() = default; SAW_DEFAULT_COPY(data); SAW_DEFAULT_MOVE(data); + /** + * Get the member value based on the string_literal. + */ template data< typename parameter_pack_type< @@ -225,6 +237,9 @@ public: return std::get::value>(value_); } + /** + * Get the member value based on the string_literal. + */ template const data< typename parameter_pack_type< @@ -236,6 +251,9 @@ public: return std::get::value>(value_); } + /** + * Return the amount of members. + */ constexpr size_t size() const { return sizeof...(T); } @@ -469,9 +487,15 @@ private: } }; +/** + * Data type representing string. + */ template<> class data> { private: + /** + * The native way to represent strings. + */ std::string value_; public: data() = default; @@ -483,18 +507,30 @@ public: value_.resize(size_); } + /** + * Return the length of the string. + */ std::size_t size() const { return value_.size(); } + /** + * set the inner string to str. + */ void set(std::string str){ value_ = std::move(str); } + /** + * Get a char reference at position i. + */ char& at(size_t i) { return value_.at(i); } + /** + * Get a char reference at position i. + */ const char& at(size_t i) const { return value_.at(i); } @@ -507,6 +543,9 @@ public: value_.at(i) = val; } + /** + * Check if a string_view is equal to this type. + */ bool operator==(const std::string_view& val)const{ return value_ == val; } -- cgit v1.2.3