Traverse struct
#include <src/checkpoint/dispatch/dispatch.h>
Traverse a target recursivelyT with a traverser object (typically inheriting from Serializer).
Public static functions
-
template<typename T, typename TraverserT>static auto with(T& target, TraverserT& t, SerialSizeType len = 1) -> TraverserT&
- Traverse a
targetof typeTrecursively with a generalTraverserTthat gets applied to each element. -
template<typename T, typename TraverserT, typename UserTraits = UserTraitHolder<>, typename... Args>static auto with(T& target, Args && ... args) -> TraverserT
- Traverse a
targetof typeTrecursively after constructing aTraverserTfromargs. -
template<typename T>static auto reconstruct(SerialByteType* mem) -> T*
- Reconstruct in place a
Ton allocated memorymem. The buffermemmust contain enough memory to holdsizeof(T). This calls the reconstruction strategy based on trait detection which will detect the user's method of reconstructing the class.
Function documentation
template<typename T, typename TraverserT>
static TraverserT& checkpoint:: dispatch:: Traverse:: with(T& target,
TraverserT& t,
SerialSizeType len = 1)
Traverse a target of type T recursively with a general TraverserT that gets applied to each element.
| Parameters | |
|---|---|
| target in/out | the target to traverse |
| t in/out | a reference to the traverser |
| len in | the len of the target. If > 1, target is an array |
| Returns | the traverser after traversal is complete |
template<typename T, typename TraverserT, typename UserTraits = UserTraitHolder<>, typename... Args>
static TraverserT checkpoint:: dispatch:: Traverse:: with(T& target,
Args && ... args)
Traverse a target of type T recursively after constructing a TraverserT from args.
| Parameters | |
|---|---|
| target in/out | the target to traverse |
| args in | the args to pass to the traverser for construction |
| Returns | the constructed traverser after traversal is complete |
template<typename T>
static T* checkpoint:: dispatch:: Traverse:: reconstruct(SerialByteType* mem)
Reconstruct in place a T on allocated memory mem. The buffer mem must contain enough memory to hold sizeof(T). This calls the reconstruction strategy based on trait detection which will detect the user's method of reconstructing the class.
| Parameters | |
|---|---|
| mem in | The memory to in-place construct on |
| Returns | a pointer to T |