libcppa
Version 0.1
|
#include <object.hpp>
Inherited by cppa::detail::obj_impl< T >.
Public Member Functions | |
object (void *val, const uniform_type_info *utinfo) | |
object () | |
object (object &&other) | |
object (const object &other) | |
object & | operator= (object &&other) |
object & | operator= (const object &other) |
const uniform_type_info & | type () const |
const void * | value () const |
void * | mutable_value () |
Static Public Member Functions | |
template<typename T > | |
static object | from (T &&what) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
T & | get_ref (object &obj) |
template<typename T > | |
const T & | get (const object &obj) |
An abstraction class that stores an instance of an announced type.
cppa::object::object | ( | void * | val, |
const uniform_type_info * | utinfo | ||
) |
Creates an object of type utinfo
with value val
.
val
. val != nullptr && utinfo != nullptr
cppa::object::object | ( | ) |
Creates an empty object.
cppa::object::object | ( | object && | other | ) |
Creates an object and moves type and value from other
to this
.
cppa::object::object | ( | const object & | other | ) |
Creates a (deep) copy of other
.
object cppa::object::from | ( | T && | what | ) | [static] |
Creates an object from what
.
what | Value of an announced type. |
what
. type() == *uniform_typeid<T>()
std::runtime_error | if T is not announced. |
void* cppa::object::mutable_value | ( | ) |
Gets the stored value.
Moves the content from other
to this.
*this
Creates a (deep) copy of other
and assigns it to this
.
*this
const uniform_type_info& cppa::object::type | ( | ) | const |
Gets the RTTI of this object.
this
. const void* cppa::object::value | ( | ) | const |
Gets the stored value.
const T & get | ( | const object & | obj | ) | [related] |
Grants const access to the stored value of obj
.
obj | Object with obj.type() == typeid(T) . |
obj
.std::invalid_argument | if obj.type() != typeid(T) |
T & get_ref | ( | object & | obj | ) | [related] |
Grants mutable access to the stored value of obj
.
obj | Object with obj.type() == typeid(T) . |
obj
.std::invalid_argument | if obj.type() != typeid(T) |