Loading...
Searching...
No Matches
Opm::Serializer< Packer > Class Template Reference

Class for (de-)serializing. More...

`#include <Serializer.hpp>`

## Classes

struct | has_serializeOp
| Detect existence of `serializeOp` member function. More...
struct | has_serializeOp< T, std::void_t< decltype(std::declval< T >().serializeOp(std::declval< Serializer< Packer > & >()))> >
| Detect existence of `serializeOp` member function. More...
struct | is_array
| Predicate for arrays. More...
struct | is_array< std::array< T, N > >
struct | is_map
| Predicate for maps. More...
struct | is_map< std::map< Key, T, Compare, Allocator > >
struct | is_map< std::unordered_map< Key, T, Hash, KeyEqual, Allocator > >
struct | is_optional
| Predicate for std::optional. More...
struct | is_optional< std::optional< T1 > >
struct | is_pair_or_tuple
| Predicate for detecting pairs and tuples. More...
struct | is_pair_or_tuple< std::pair< T1, T2 > >
struct | is_pair_or_tuple< std::tuple< Ts... > >
struct | is_ptr
| Predicate for smart pointers. More...
struct | is_ptr< std::shared_ptr< T1 > >
struct | is_ptr< std::unique_ptr< T1, Deleter > >
struct | is_set
| Predicate for sets. More...
struct | is_set< std::set< Key, Compare, Allocator > >
struct | is_set< std::unordered_set< Key, Hash, KeyEqual, Allocator > >
struct | is_variant
| Predicate for detecting variants. More...
struct | is_variant< std::variant< Ts... > >
struct | is_vector
| Predicate for detecting vectors. More...
struct | is_vector< std::vector< T1, Allocator > >

## 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 >
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 | shared_ptr (const PtrType &data)
| Handler for shared pointers.
template<class PtrType >
void | unique_ptr (const PtrType &data)

## 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.
size_t | m_position = 0
| Current position in buffer.
std::vector< char > | m_buffer
| Buffer for serialized data.
std::map< std::uintptr_t, std::shared_ptr< void > > | m_ptrmap
| Map to keep track of which pointer data has been serialized and actual pointers during unpacking.

## Detailed Description

template<class Packer>
class Opm::Serializer< Packer >

Class for (de-)serializing.

!

If the class has a serializeOp member this is used, if not it is passed on to the underlying packer.

## Member Enumeration Documentation

## Operation

template<class Packer >

enum class Opm::Serializer::Operation

strong protected

Enumeration of operations.

Enumerator
PACKSIZE | Calculating serialization buffer size.
PACK | Performing serialization.
UNPACK | Performing de-serialization.

## Constructor & Destructor Documentation

## Serializer()

template<class Packer >

Opm::Serializer< Packer >::Serializer | ( | const Packer & | packer | ) |

inline explicit

Constructor.

Parameters

  packer | Packer to use

## Member Function Documentation

## array()

template<class Packer >
template<class Array >

void Opm::Serializer< Packer >::array | ( | const Array & | data | ) |

inline protected

Handler for arrays.

Parameters

  data | The array to (de-)serialize

## map()

template<class Packer >
template<class Map >

void Opm::Serializer< Packer >::map | ( | const Map & | data | ) |

inline protected

Handler for maps.

Template Parameters

  Map | map type

Parameters

  map | The map to (de-)serialize

## optional()

template<class Packer >
template<class T >

void Opm::Serializer< Packer >::optional | ( | const std::optional< T > & | data | ) |

inline protected

Handler for std::optional.

Template Parameters

  T | Type for data

Parameters

  data | The optional to (de-)serialize

## pack() [1/2]

template<class Packer >
template<class... Args>

void Opm::Serializer< Packer >::pack | ( | const Args &... | data | ) |

inline

Call this to serialize data.

Template Parameters

  T | Type of class to serialize

Parameters

  data | Class to serialize

## pack() [2/2]

template<class Packer >
template<class T >

void Opm::Serializer< Packer >::pack | ( | const T & | data | ) |

inline

Call this to serialize data.

Template Parameters

  T | Type of class to serialize

Parameters

  data | Class to serialize

## set()

template<class Packer >
template<class Set >

void Opm::Serializer< Packer >::set | ( | const Set & | data | ) |

inline protected

Handler for sets.

Template Parameters

  Set | set type

Parameters

  data | The set to (de-)serialize

## tuple()

template<class Packer >
template<class Tuple >

void Opm::Serializer< Packer >::tuple | ( | const Tuple & | data | ) |

inline protected

Handler for std::tuple.

Parameters

  data | The tuple to (de-)serialize

## unpack() [1/2]

template<class Packer >
template<class... Args>

void Opm::Serializer< Packer >::unpack | ( | Args &... | data | ) |

inline

Call this to de-serialize data.

Template Parameters

  T | Type of class to de-serialize

Parameters

  data | Class to de-serialize

## unpack() [2/2]

template<class Packer >
template<class T >

void Opm::Serializer< Packer >::unpack | ( | T & | data | ) |

inline

Call this to de-serialize data.

Template Parameters

  T | Type of class to de-serialize

Parameters

  data | Class to de-serialize

## variant()

template<class Packer >
template<class... Args>

void Opm::Serializer< Packer >::variant | ( | const std::variant< Args... > & | data | ) |

inline protected

Handler for std::variant.

Parameters

  data | The variant to (de-)serialize

## vector() [1/2]

template<class Packer >

void Opm::Serializer< Packer >::vector | ( | const std::vector< bool > & | data | ) |

inline protected

Handler for bool vectors.

Parameters

  data | The vector to (de-)serialize

## vector() [2/2]

template<class Packer >
template<typename Vector >

void Opm::Serializer< Packer >::vector | ( | const Vector & | data | ) |

inline protected

Handler for vectors.

Template Parameters

  T | Type for vector elements

Parameters

  data | The vector to (de-)serialize

The documentation for this class was generated from the following file:

- opm/common/utility/Serializer.hpp