17#ifndef IOX_HOOFS_CXX_SERIALIZATION_HPP
18#define IOX_HOOFS_CXX_SERIALIZATION_HPP
20#include "iceoryx_hoofs/cxx/convert.hpp"
78 operator std::
string() const noexcept;
85 template <typename... Targs>
96 template <typename T, typename... Targs>
97 bool extract(T& t, Targs&... args) const noexcept;
106 template <typename T>
107 bool getNth(const
unsigned int index, T& t) const noexcept;
117 static constexpr char separator =
':';
120 static std::string serializer() noexcept;
122 static
bool removeFirstEntry(std::
string& firstEntry, std::
string& remainder) noexcept;
124 template <typename T>
125 static typename std::enable_if<std::is_convertible<T,
Serialization>::value, std::
string>::type
126 getString(const T& t) noexcept;
127 template <typename T>
128 static typename std::enable_if<!std::is_convertible<T,
Serialization>::value, std::
string>::type
129 getString(const T& t) noexcept;
130 template <typename T, typename... Targs>
131 static std::
string serializer(const T& t, const Targs&... args) noexcept;
133 static
bool deserialize(const std::
string& serializedString) noexcept;
135 template <typename T, typename... Targs>
136 static
bool deserialize(const std::
string& serializedString, T& t, Targs&... args) noexcept;
142#include "iceoryx_hoofs/internal/cxx/serialization.inl"
Simple serializer which serials every given type into the following format: (The type needs to be con...
Definition serialization.hpp:66
bool getNth(const unsigned int index, T &t) const noexcept
Extracts the value at index and writes it into t. If the conversion failed it returns false It also r...
Serialization(const std::string &value) noexcept
Creates a serialization object from a given raw serialization.
bool extract(T &t, Targs &... args) const noexcept
Extracts the values from the serialization and writes them into the the given args,...
std::string toString() const noexcept
string conversion operator, returns the raw serialized string
Error
This is an error which can be used for cxx::expected on a custom deserialization when extract fails.
Definition serialization.hpp:111
@ DESERIALIZATION_FAILED
indicates a failed deserialization
static Serialization create(const Targs &... args) noexcept
Create Serialization if every arguments is convertable to string via cxx::convert::toString,...
building block to easily create free function for logging in a library context
Definition lockfree_queue.hpp:29