Storage for objects used in communication over shared memory.
More...
|
| object_storage (object_storage const &)=delete |
|
object_storage & | operator= (object_storage const &)=delete |
|
bool | construct (T &&t, void *const base, std::size_t &size) |
| Initializes this object by moving t in it. More...
|
|
bool | construct (T const &t, void *const base, std::size_t &size) |
| Initializes this object by copying t in it. More...
|
|
void | destroy (void) noexcept |
| Destroys the internal storage as if it holds a moved or copied object.
|
|
void | destroy_packed (void) noexcept |
| Destroys the internal storage as if it holds a packed object.
|
|
T & | get (void) noexcept |
| Returns the moved or copied object.
|
|
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...
|
|
T | moveout (void) |
| Moves the object out if it was moved or copied in.
|
|
|
static std::size_t | packed_size (T &&t) noexcept |
| Returns the packed size of t .
|
|
static std::size_t | packed_size (T const &t) noexcept |
| Returns the packed size of t .
|
|
template<typename T>
class stapl::runtime::object_storage< T >
Storage for objects used in communication over shared memory.
- Template Parameters
-
This class uses a properly aligned char
array to store an object of type T
. Determined by typer_traits::meets_requirements(), the object is either copied or moved in this array. Otherwise, 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 construct().
- Warning
- One of the destroy() or destroy_packed() functions has to be called prior to the destructor to avoid memory leaks.
-
There can be only a single call to the get(), moveout(), get(void*const) or get(void*const,std::size_t&) functions.
- See also
- packed_object_storage
◆ construct() [1/2]
Initializes this object by moving t
in it.
- Warning
- This function can only be called if the object has been default constructed.
- Returns
true
if t
was moved, otherwise false
.
◆ construct() [2/2]
Initializes this object by copying t
in it.
- Warning
- This function can only be called if the object has been default constructed.
- Returns
true
if t
was copied, otherwise false
.
◆ get() [1/2]
Returns the stored object after unpacking it.
- Parameters
-
base | Buffer where the dynamic part of the object is stored. |
◆ get() [2/2]
Returns the stored object after unpacking it.
- Parameters
-
base | Buffer where the dynamic part of the object is stored. |
size | Variable to store how many bytes were unpacked. |
◆ m_force_alignment
The documentation for this class was generated from the following file: