µSer
|
µSer main API. More...
Namespaces | |
ByteOrder | |
Byte orders for integers in serialized data. | |
Hook | |
Attributes to define hook functions for uSer. | |
SignFormat | |
Formats for signed integers. | |
Classes | |
struct | DynSize |
class | Exception |
struct | FixedSize |
struct | InfSize |
struct | MaxSize |
Indicates a fixed maximum size for a dynamic data structure. More... | |
struct | NoDyn |
Indicates a data structure with no dynamic data. More... | |
struct | RawInfo |
Attribute: Declares the serialization word explicitly. More... | |
struct | StructMembers |
Define the members of a struct by providing member pointers. More... | |
struct | Unlimited |
Indicates a dynamic data structure whose maximum serialized size can not be pre-calculated (e.g. when containers are used) More... | |
struct | Width |
Attribute: Define the serialized size of an integer type. May not be larger than the C(++) data type used. More... | |
Typedefs | |
using | AttrNone = Attributes<> |
template<typename RawIter , typename Obj , typename... Attr> | |
using | RawMaxDynamic = typename decltype(SWalk::walk(GetSerAlgo< true, RawIter, Attr... >::template root< Obj, InfSize, Helper::GetRootAttr< Attr... >>(std::declval< RawIter >(), std::declval< Obj & >(), infSize), Helper::GetRootAttr< Attr... >{}))::MaxDyn |
Indicates the maximum number of dynamic serialization words in raw data; may be an alias to Unlimited, NoDyn, or MaxSize. | |
Functions | |
template<typename... Attr, typename RawIter , typename Obj , typename SizeT , std::enable_if_t< std::is_convertible_v< SizeT, Helper::SizeDefTag >, int > = 42> | |
decltype(auto) | serialize (RawIter &&raw, const Obj &obj, SizeT size, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | serialize (SWord(&raw)[N], const Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | serialize (std::array< SWord, N > &raw, const Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename RawIter , typename Obj > | |
decltype(auto) | serialize (RawIter &&raw, const Obj &obj, std::size_t size, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename RawContainer , typename Obj , decltype(std::size(std::declval< RawContainer >()))* = nullptr> | |
decltype(auto) | serialize (RawContainer &&raw, const Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename RawIter , typename Obj , typename SizeT , std::enable_if_t< std::is_convertible_v< SizeT, Helper::SizeDefTag >, int > = 42> | |
decltype(auto) | deserialize (RawIter &&raw, Obj &obj, SizeT size, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | deserialize (const SWord(&raw)[N], Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | deserialize (const std::array< SWord, N > &raw, Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | deserialize (SWord(&raw)[N], Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename SWord , typename Obj , std::size_t N> | |
decltype(auto) | deserialize (std::array< SWord, N > &raw, Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename RawIter , typename Obj > | |
decltype(auto) | deserialize (RawIter &&raw, Obj &obj, std::size_t size, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename RawContainer , typename Obj , decltype(std::size(std::declval< RawContainer >()))* = nullptr> | |
decltype(auto) | deserialize (RawContainer &&raw, Obj &obj, std::size_t *sizeUsed=nullptr) |
template<typename... Attr, typename Obj > | |
constexpr bool | compare (const Obj &a, const Obj &b) |
template<typename... Attr, typename Obj > | |
std::ostream & | print (std::ostream &os, const Obj &obj) |
µSer main API.
constexpr bool uSer::compare | ( | const Obj & | a, |
const Obj & | b | ||
) |
Compares two serializable objects of equal type.
decltype(auto) uSer::deserialize | ( | RawIter && | raw, |
Obj & | obj, | ||
SizeT | size, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize an arbitrary raw input stream or container given via an iterator. The input buffer size must me given explicitly.
[in] | raw | Any input iterator for the raw data. |
[out] | obj | The object to receive the deserialized data |
[in] | size | The size of the raw data stream; either a fixedSize or infSize |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | const SWord(&) | raw[N], |
Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from a const C-array given as a reference. The array's type must include the size, i.e. it can't be a pointer to an array.
[in] | raw | A reference to a constant C array. |
[out] | obj | The object to receive the deserialized data |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | const std::array< SWord, N > & | raw, |
Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from a const std::array<T,N> given as a reference.
[in] | raw | A reference to constant std::array<T,N>. |
[out] | obj | The object to receive the deserialized data |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | SWord(&) | raw[N], |
Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from a non-const C-array given as a reference. The array's type must include the size, i.e. it can't be a pointer to an array. This overload prevents the one for generic containers from being called if the array is non-const.
[in] | raw | A reference to a C array. |
[out] | obj | The object to receive the deserialized data |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | std::array< SWord, N > & | raw, |
Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from a non-const std::array<T,N> given as a reference. This overload prevents the one for generic containers from being called if the array is non-const.
[in] | raw | A reference to std::array<T,N>. |
[out] | obj | The object to receive the deserialized data |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | RawIter && | raw, |
Obj & | obj, | ||
std::size_t | size, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from an arbitrary raw input stream or container given via an iterator. The input buffer size must me given explicitly as an integer.
[in] | raw | Any input iterator for the raw data. |
[out] | obj | The object to receive the deserialized data |
[in] | size | The size of the raw data stream given as a std::size_t |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::deserialize | ( | RawContainer && | raw, |
Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Deserialize from an arbitrary container given as a reference. The input buffer's size is queried via its .size() member function.
[in] | raw | Any container supporting iterators and a .size() member function |
[out] | obj | The object to receive the deserialized data |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
std::ostream& uSer::print | ( | std::ostream & | os, |
const Obj & | obj | ||
) |
Outputs a textual version of a serializable object.
[out] | os | A stream to write the textual data to, e.g. std::cout. |
[in] | obj | The object to print |
decltype(auto) uSer::serialize | ( | RawIter && | raw, |
const Obj & | obj, | ||
SizeT | size, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Serialize to an arbitrary raw output stream or container given via an iterator. The output buffer size must me given explicitly.
[out] | raw | Any output iterator for the raw data. |
[in] | obj | The object to serialize |
[in] | size | The size of the raw data stream; either a fixedSize or infSize |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::serialize | ( | SWord(&) | raw[N], |
const Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Serialize to a C-array given as a reference. The array's type must include the size, i.e. it can't be a pointer to an array.
[out] | raw | A reference to a C array. |
[in] | obj | The object to serialize |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::serialize | ( | std::array< SWord, N > & | raw, |
const Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Serialize to std::array<T,N> given as a reference.
[out] | raw | A reference to std::array<T,N>. |
[in] | obj | The object to serialize |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::serialize | ( | RawIter && | raw, |
const Obj & | obj, | ||
std::size_t | size, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Serialize to an arbitrary raw output stream or container given via an iterator. The output buffer size must me given explicitly as an integer.
[out] | raw | Any output iterator for the raw data. |
[in] | obj | The object to serialize |
[in] | size | The size of the raw data stream given as a std::size_t |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |
decltype(auto) uSer::serialize | ( | RawContainer && | raw, |
const Obj & | obj, | ||
std::size_t * | sizeUsed = nullptr |
||
) |
Serialize to an arbitrary container given as a reference. The output buffer's size is queried via its .size() member function.
[out] | raw | Any container supporting iterators and a .size() member function |
[in] | obj | The object to serialize |
[out] | sizeUsed | Optional output parameter indicating the number of serialization words actually used in the raw data stream. |