libcaf
0.13.2
|
Provides a platform independent type name and a (very primitive) kind of reflection in combination with object. More...
#include <uniform_type_info.hpp>
Public Member Functions | |
uniform_type_info (uniform_type_info &&)=delete | |
uniform_type_info (const uniform_type_info &)=delete | |
uniform_type_info & | operator= (uniform_type_info &&)=delete |
uniform_type_info & | operator= (const uniform_type_info &)=delete |
virtual uniform_value | create (const uniform_value &other=uniform_value{}) const =0 |
Creates a copy of other . | |
uniform_value | deserialize (deserializer *source) const |
Deserializes an object of this type from source . | |
virtual const char * | name () const =0 |
Get the internal name for this type. More... | |
virtual bool | equal_to (const std::type_info &tinfo) const =0 |
Determines if this uniform_type_info describes the same type than tinfo . More... | |
virtual bool | equals (const void *instance1, const void *instance2) const =0 |
Compares two instances of this type. More... | |
virtual void | serialize (const void *instance, serializer *sink) const =0 |
Serializes instance to sink . More... | |
virtual void | deserialize (void *instance, deserializer *source) const =0 |
Deserializes instance from source . More... | |
virtual message | as_message (void *instance) const =0 |
Returns instance encapsulated as an message . | |
uint16_t | type_nr () const |
Returns a unique number for builtin types or 0. | |
Static Public Member Functions | |
static const uniform_type_info * | from (const std::string &uniform_name) |
Get instance by uniform name. More... | |
static const uniform_type_info * | from (const std::type_info &tinfo) |
Get instance by std::type_info. More... | |
static std::vector< const uniform_type_info * > | instances () |
Get all instances. More... | |
Protected Member Functions | |
uniform_type_info (uint16_t typenr=0) | |
template<class T > | |
uniform_value | create_impl (const uniform_value &other) const |
Friends | |
bool | operator== (const uniform_type_info &lhs, const uniform_type_info &rhs) |
Related Functions | |
(Note that these are not member functions.) | |
using | uniform_type_info_ptr = std::unique_ptr< uniform_type_info > |
bool | operator== (const uniform_type_info &lhs, const uniform_type_info &rhs) |
bool | operator!= (const uniform_type_info &lhs, const uniform_type_info &rhs) |
Provides a platform independent type name and a (very primitive) kind of reflection in combination with object.
The platform independent name is equal to the "in-sourcecode-name" with a few exceptions:
|
pure virtual |
Deserializes instance
from source
.
instance | Instance of this type. |
source | Data source. |
instance
has the type of this
.
|
pure virtual |
Determines if this uniform_type_info describes the same type than tinfo
.
true
if tinfo
describes the same type as this
. Implemented in caf::abstract_uniform_type_info< T >.
|
pure virtual |
Compares two instances of this type.
instance1 | Left hand operand. |
instance2 | Right hand operand. |
true
if *instance1 == *instance2. @pre
instance1and
instance2have the type of
this`. Implemented in caf::abstract_uniform_type_info< T >.
|
static |
Get instance by uniform name.
uniform_name | The internal name for a type. |
uniform_name
. std::runtime_error | if no type named uniform_name was found. |
|
static |
Get instance by std::type_info.
tinfo | A STL RTTI object. |
tinfo
. std::runtime_error | if tinfo is not an announced type. |
|
static |
Get all instances.
|
pure virtual |
Get the internal name for this type.
Implemented in caf::abstract_uniform_type_info< T >.
|
pure virtual |
Serializes instance
to sink
.
instance | Instance of this type. |
sink | Target data sink. |
instance
has the type of this
. std::ios_base::failure | Thrown when the underlying serialization layer is unable to serialize the data, e.g., when exceeding maximum buffer sizes. |
|
related |
|
related |
|
related |