STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Static Public Member Functions | Public Types
stapl::typer_traits< T, Enable > Class Template Reference

Provides methods for assisting in packing and unpacking objects. More...

Static Public Member Functions

static std::size_t packed_size (T const &t) noexcept
 Returns the packed (dynamic) size of the given object.
 
static std::pair< bool, std::size_t > meets_requirements (const typer::pass_type p, T const &t) noexcept
 Returns the packing requirements for pass p.
 
static void prepack (T *dest, T const *src, const std::size_t num=1) noexcept
 Performs any operations that need to be done before calling typer_traits::pack(). More...
 
static std::size_t pack (T &dest, void *base, const std::size_t offset, T const &src) noexcept
 Packs the object to the given buffer, returning its packed size. More...
 
static std::size_t unpack (T &t, void *base)
 Unpacks the object from the buffer, returning its packed size. More...
 
static void destroy (T &t) noexcept
 Cleans up after the unpacked object. More...
 

Public Types

using value_type = T
 

Detailed Description

template<typename T, typename Enable>
class stapl::typer_traits< T, Enable >

Provides methods for assisting in packing and unpacking objects.

Template Parameters
TObject type to be packed.

It has functions to determine the packing requirements, additional packed size requirements (e.g., objects that contain pointers require extra space to serialize the data pointed to), and implements the packing and unpacking functions.

The default typer_traits uses the class's define_type().

See also
typer

Member Function Documentation

◆ prepack()

template<typename T , typename Enable >
static void stapl::typer_traits< T, Enable >::prepack ( T *  dest,
T const *  src,
const std::size_t  num = 1 
)
staticnoexcept

Performs any operations that need to be done before calling typer_traits::pack().

The default version does a memcpy from source object to destination, effectively packing the static part of the object.

Parameters
destDestination to pack the object to.
srcSource to pack the object from.
numNumber of objects to pack.

◆ pack()

template<typename T , typename Enable >
static std::size_t stapl::typer_traits< T, Enable >::pack ( T &  dest,
void *  base,
const std::size_t  offset,
T const &  src 
)
staticnoexcept

Packs the object to the given buffer, returning its packed size.

This function takes care of the dynamic part of the object.

Parameters
destDestination to pack the object to.
baseStart of the buffer where the dynamic part of the object will be written to.
offsetOffset from the base to write the dynamic part of the object.
srcSource to pack the object from.
Returns
The dynamic size of the object in bytes.

◆ unpack()

template<typename T , typename Enable >
static std::size_t stapl::typer_traits< T, Enable >::unpack ( T &  t,
void *  base 
)
static

Unpacks the object from the buffer, returning its packed size.

Parameters
tObject to be unpacked.
baseStart of the buffer where the dynamic part of the object was written to.
Returns
The dynamic size of the object in bytes.

◆ destroy()

template<typename T , typename Enable >
static void stapl::typer_traits< T, Enable >::destroy ( T &  t)
staticnoexcept

Cleans up after the unpacked object.

This function will recursively call all the destroy() functions to release any memory allocated while unpacking.

Parameters
tObject to clean up after it.

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