libcppa
Version 0.1
|
#include <uniform_type_info.hpp>
Public Member Functions | |
const std::string & | name () const |
object | create () const |
object | deserialize (deserializer *source) const |
virtual bool | equals (const std::type_info &tinfo) const =0 |
virtual bool | equals (const void *instance1, const void *instance2) const =0 |
virtual void | serialize (const void *instance, serializer *sink) const =0 |
virtual void | deserialize (void *instance, deserializer *source) const =0 |
Static Public Member Functions | |
static uniform_type_info * | from (const std::string &uniform_name) |
static const uniform_type_info * | from (const std::type_info &tinfo) |
static std::vector < uniform_type_info * > | instances () |
Protected Member Functions | |
virtual void | delete_instance (void *instance) const =0 |
virtual void * | new_instance (const void *instance=nullptr) const =0 |
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:
std::string
is named @str
std::u16string
is named @u16str
std::u32string
is named @u32str
integers
are named @(i|u)$size
@i32
is a 32 bit signed integer; @u16
is a 16 bit unsigned integer@_
namespace { class foo { }; }
is mapped to @_::foo
object cppa::uniform_type_info::create | ( | ) | const |
Creates an object of this type.
virtual void cppa::uniform_type_info::delete_instance | ( | void * | instance | ) | const [protected, pure virtual] |
Casts instance
to the native type and deletes it.
instance | Instance of this type. |
instance
has the type of this
. Implemented in cppa::util::abstract_uniform_type_info< T >, cppa::util::abstract_uniform_type_info< Map >, cppa::util::abstract_uniform_type_info< std::pair< first_type, second_type > >, cppa::util::abstract_uniform_type_info< std::pair< T1, T2 > >, and cppa::util::abstract_uniform_type_info< List >.
object cppa::uniform_type_info::deserialize | ( | deserializer * | source | ) | const |
Deserializes an object of this type from source
.
virtual void cppa::uniform_type_info::deserialize | ( | void * | instance, |
deserializer * | source | ||
) | const [pure virtual] |
Deserializes instance
from source
.
instance | Instance of this type. |
sink | Data source. |
instance
has the type of this
. virtual bool cppa::uniform_type_info::equals | ( | const std::type_info & | tinfo | ) | const [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 cppa::util::abstract_uniform_type_info< T >, cppa::util::abstract_uniform_type_info< Map >, cppa::util::abstract_uniform_type_info< std::pair< first_type, second_type > >, cppa::util::abstract_uniform_type_info< std::pair< T1, T2 > >, and cppa::util::abstract_uniform_type_info< List >.
virtual bool cppa::uniform_type_info::equals | ( | const void * | instance1, |
const void * | instance2 | ||
) | const [pure virtual] |
Compares two instances of this type.
instance1 | Left hand operand. |
instance2 | Right hand operand. |
true
if *instance1 == *instance2
. instance1
and instance2
have the type of this
. Implemented in cppa::util::abstract_uniform_type_info< T >, cppa::util::abstract_uniform_type_info< Map >, cppa::util::abstract_uniform_type_info< std::pair< first_type, second_type > >, cppa::util::abstract_uniform_type_info< std::pair< T1, T2 > >, and cppa::util::abstract_uniform_type_info< List >.
static uniform_type_info* cppa::uniform_type_info::from | ( | const std::string & | uniform_name | ) | [static] |
Get instance by uniform name.
uniform_name | The libcppa internal name for a type. |
uniform_name
. std::runtime_error | if no type named uniform_name was found. |
static const uniform_type_info* cppa::uniform_type_info::from | ( | const std::type_info & | tinfo | ) | [static] |
Get instance by std::type_info.
tinfo | A STL RTTI object. |
tinfo
. std::runtime_error | if tinfo is not an announced type. |
static std::vector<uniform_type_info*> cppa::uniform_type_info::instances | ( | ) | [static] |
Get all instances.
const std::string& cppa::uniform_type_info::name | ( | ) | const |
Get the internal libcppa
name for this type.
libcppa
internal type name. virtual void* cppa::uniform_type_info::new_instance | ( | const void * | instance = nullptr | ) | const [protected, pure virtual] |
Creates an instance of this type, either as a copy of instance
or initialized with the default constructor if instance == nullptr
.
instance | Optional instance of this type. |
instance
or a new instance, initialized with the default constructor. instance
has the type of this
or is set to nullptr
. Implemented in cppa::util::abstract_uniform_type_info< T >, cppa::util::abstract_uniform_type_info< Map >, cppa::util::abstract_uniform_type_info< std::pair< first_type, second_type > >, cppa::util::abstract_uniform_type_info< std::pair< T1, T2 > >, and cppa::util::abstract_uniform_type_info< List >.
virtual void cppa::uniform_type_info::serialize | ( | const void * | instance, |
serializer * | sink | ||
) | const [pure virtual] |
Serializes instance
to sink
.
instance | Instance of this type. |
sink | Target data sink. |
instance
has the type of this
.