|
| template<typename T, std::enable_if_t< std::is_trivially_copyable_v< T >||std::is_same_v< T, std::string >, bool > = true> |
| void | put_in (const T &val, std::vector< char > &vec) |
| |
| template<typename T> |
| void | put_in_vec (const std::vector< T > &val, std::vector< char > &vec) |
| |
| template<typename T, std::enable_if_t< std::is_trivially_copyable_v< T >||std::is_same_v< T, std::string >, bool > = true> |
| T | get_out (std::vector< char >::const_iterator &it) |
| |
| template<typename T> |
| std::vector< T > | get_out_vec (std::vector< char >::const_iterator &it) |
| |
template<typename T, std::enable_if_t< std::is_trivially_copyable_v< T >||std::is_same_v< T, std::string >, bool > = true>
| T ablastr::utils::serialization::get_out |
( |
std::vector< char >::const_iterator & | it | ) |
|
This function extracts a variable of type T from a byte vector, at the position given by a std::vector<char> iterator. The iterator is then advanced according to the number of bytes read from the byte vector. T must be either a trivially copyable type or an std::string.
- Template Parameters
-
| T | the variable type (must be trivially copyable) |
- Parameters
-
| [in,out] | it | the iterator to a byte vector |
- Returns
- the variable extracted from the byte array
template<typename T, std::enable_if_t< std::is_trivially_copyable_v< T >||std::is_same_v< T, std::string >, bool > = true>
| void ablastr::utils::serialization::put_in |
( |
const T & | val, |
|
|
std::vector< char > & | vec ) |
This function transforms a variable of type T into a vector of chars holding its byte representation and it appends this vector at the end of an existing vector of chars. T must be either a trivially copyable type or an std::string
- Template Parameters
-
- Parameters
-
| [in] | val | a variable of type T to be serialized |
| [in,out] | vec | a reference to the vector to which the byte representation of val is appended |