My Project
|
Class for (de-)serializing. More...
#include <Serializer.hpp>
Public Member Functions | |
Serializer (const Packer &packer) | |
Constructor. | |
template<class T > | |
void | operator() (const T &data) |
Applies current serialization op to the passed data. | |
template<class T > | |
void | pack (const T &data) |
Call this to serialize data. | |
template<class... Args> | |
void | pack (const Args &... data) |
Call this to serialize data. | |
template<class T > | |
void | unpack (T &data) |
Call this to de-serialize data. | |
template<class... Args> | |
void | unpack (Args &... data) |
Call this to de-serialize data. | |
size_t | position () const |
Returns current position in buffer. | |
bool | isSerializing () const |
Returns true if we are currently doing a serialization operation. | |
Protected Types | |
enum class | Operation { PACKSIZE , PACK , UNPACK } |
Enumeration of operations. More... | |
Protected Member Functions | |
template<typename Vector > | |
const Vector::value_type * | getVectorData (const Vector &data) |
Utility function for missing data() member function in FieldVector of DUNE 2.6. | |
template<typename Vector > | |
Vector::value_type * | getVectorData (Vector &data) |
Utility function for missing data() member function in FieldVector of DUNE 2.6. | |
template<typename Vector > | |
void | vector (const Vector &data) |
Handler for vectors. | |
void | vector (const std::vector< bool > &data) |
Handler for bool vectors. | |
template<class Array > | |
void | array (const Array &data) |
Handler for arrays. | |
template<class... Args> | |
void | variant (const std::variant< Args... > &data) |
Handler for std::variant. | |
template<class T > | |
void | optional (const std::optional< T > &data) |
Handler for std::optional. | |
template<class Tuple > | |
void | tuple (const Tuple &data) |
Handler for std::tuple. | |
template<class Map > | |
void | map (const Map &data) |
Handler for maps. | |
template<class Set > | |
void | set (const Set &data) |
Handler for sets. | |
template<typename T , typename... Args> | |
void | variadic_call (T &first, Args &&... args) |
template<std::size_t I = 0, typename Tuple > | |
std::enable_if< I==std::tuple_size< Tuple >::value, void >::type | tuple_call (const Tuple &) |
template<std::size_t I = 0, typename Tuple > | |
std::enable_if< I!=std::tuple_size< Tuple >::value, void >::type | tuple_call (const Tuple &tuple) |
template<class PtrType > | |
void | ptr (const PtrType &data) |
Handler for smart pointers. | |
Protected Attributes | |
const Packer & | m_packer |
Packer to use. | |
Operation | m_op = Operation::PACKSIZE |
Current operation. | |
size_t | m_packSize = 0 |
Required buffer size after PACKSIZE has been done. | |
int | m_position = 0 |
Current position in buffer. | |
std::vector< char > | m_buffer |
Buffer for serialized data. | |
Class for (de-)serializing.
!
If the class has a serializeOp member this is used, if not it is passed on to the underlying packer.
|
strongprotected |
|
inlineexplicit |
Constructor.
packer | Packer to use |
|
inlineprotected |
Handler for arrays.
data | The array to (de-)serialize |
|
inlineprotected |
Handler for maps.
Map | map type |
map | The map to (de-)serialize |
|
inlineprotected |
Handler for std::optional.
T | Type for data |
data | The optional to (de-)serialize |
|
inline |
Call this to serialize data.
T | Type of class to serialize |
data | Class to serialize |
|
inline |
Call this to serialize data.
T | Type of class to serialize |
data | Class to serialize |
|
inlineprotected |
Handler for sets.
Set | set type |
data | The set to (de-)serialize |
|
inlineprotected |
Handler for std::tuple.
data | The tuple to (de-)serialize |
|
inline |
Call this to de-serialize data.
T | Type of class to de-serialize |
data | Class to de-serialize |
|
inline |
Call this to de-serialize data.
T | Type of class to de-serialize |
data | Class to de-serialize |
|
inlineprotected |
Handler for std::variant.
data | The variant to (de-)serialize |
|
inlineprotected |
Handler for bool vectors.
data | The vector to (de-)serialize |
|
inlineprotected |
Handler for vectors.
T | Type for vector elements |
data | The vector to (de-)serialize |