Storage for object of type T
used in communication.
More...
Public Member Functions | |
packed_object_storage (T const &t, void *const base, std::size_t &size) noexcept | |
Constructs a new object by packing t in it. More... | |
packed_object_storage (packed_object_storage const &)=delete | |
packed_object_storage & | operator= (packed_object_storage const &)=delete |
T & | get (void *const base) |
Returns the stored object after unpacking it. More... | |
T & | get (void *const base, std::size_t &size) |
Returns the stored object after unpacking it. More... | |
Static Public Member Functions | |
static std::size_t | packed_size (T const &t) noexcept |
Returns the packed size of t . | |
Storage for object of type T
used in communication.
T | Object type. |
This class uses a properly aligned char
array to store an object of type T
. The static part of the object is copied in the array, while the dynamic part (e.g. any heap allocated space that a member of T
points to) will be copied in the extra space during packing in the constructor.
An explicit call to get() is necessary to retrieve the stored object.
|
noexcept |
Constructs a new object by packing t
in it.
This constructor will copy the dynamic part of the object at base + size
, which should be big enough to fit it.
t | Object to pack. |
base | Pointer to buffer start where the dynamic part of t can be stored in. |
size | Offset from base where space is available. |
T& stapl::runtime::packed_object_storage< T, Empty >::get | ( | void *const | base | ) |
Returns the stored object after unpacking it.
base | Buffer where the dynamic part of the object is stored. |
T& stapl::runtime::packed_object_storage< T, Empty >::get | ( | void *const | base, |
std::size_t & | size | ||
) |
Returns the stored object after unpacking it.
base | Buffer where the dynamic part of the object is stored. |
size | Variable to store how many bytes were unpacked. |
aligned_storage_t<sizeof(value_type)> stapl::runtime::packed_object_storage< T, Empty >::m_force_alignment |