Internal wrapper around an object and its type information.
More...
#include <Value.h>
|
std::unique_ptr< uint8_t[]> | buffer = nullptr |
| Internal buffer that holds the actual object. More...
|
|
const char *(* | type_name )() |
| Function returning the name of the object's type. More...
|
|
bool(* | same )(std::size_t) |
| Function that checks if a given type matches the object's type. More...
|
|
Internal wrapper around an object and its type information.
- Note
- Values are move-only.
Definition at line 38 of file Value.h.
◆ Value() [1/3]
palimpsest::Value::Value |
( |
| ) |
|
|
default |
◆ Value() [2/3]
palimpsest::Value::Value |
( |
const Value & |
other | ) |
|
|
inline |
Copy constructor.
Definition at line 44 of file Value.h.
◆ Value() [3/3]
palimpsest::Value::Value |
( |
Value && |
| ) |
|
|
default |
Default move constructor.
◆ ~Value()
palimpsest::Value::~Value |
( |
| ) |
|
|
inline |
Destruct the object and free the internal buffer.
Definition at line 74 of file Value.h.
◆ allocate()
template<typename T >
void palimpsest::Value::allocate |
( |
| ) |
|
|
inline |
Allocate the internal buffer.
Definition at line 82 of file Value.h.
◆ deserialize()
void palimpsest::Value::deserialize |
( |
mpack_node_t |
node | ) |
|
|
inline |
Update value from an MPack node.
- Parameters
-
- Exceptions
-
TypeError | if the deserialized type does not match. |
Definition at line 92 of file Value.h.
◆ get_reference()
template<typename T >
T & palimpsest::Value::get_reference |
( |
| ) |
const |
|
inline |
Cast value to its object's type after checking that it matches T.
- Returns
- Reference to the stored value with type T.
- Exceptions
-
TypeError | if the object's type does not match T. |
Definition at line 155 of file Value.h.
◆ operator=() [1/2]
Value & palimpsest::Value::operator= |
( |
const Value & |
other | ) |
|
|
inline |
Copy assignment operator.
Definition at line 51 of file Value.h.
◆ operator=() [2/2]
Default move assignment operator.
◆ print()
void palimpsest::Value::print |
( |
std::ostream & |
stream | ) |
const |
|
inline |
Print value to an output stream;.
- Parameters
-
[out] | stream | Output stream to print to. |
Definition at line 98 of file Value.h.
◆ serialize()
void palimpsest::Value::serialize |
( |
mpack::Writer & |
writer | ) |
const |
|
inline |
Serialize value to a MessagePack writer.
- Parameters
-
[out] | writer | Writer to serialize to. |
Definition at line 104 of file Value.h.
◆ setup()
template<typename T , typename... ArgsT>
T & palimpsest::Value::setup |
( |
| ) |
|
|
inline |
Allocate object and register internal functions.
- Returns
- Reference to allocated object.
Definition at line 113 of file Value.h.
◆ buffer
std::unique_ptr<uint8_t[]> palimpsest::Value::buffer = nullptr |
Internal buffer that holds the actual object.
Definition at line 168 of file Value.h.
◆ same
bool(* palimpsest::Value::same) (std::size_t) |
Function that checks if a given type matches the object's type.
Definition at line 174 of file Value.h.
◆ type_name
const char *(* palimpsest::Value::type_name) () |
Function returning the name of the object's type.
Definition at line 171 of file Value.h.
The documentation for this class was generated from the following file: