§tiro::native_type

More...

#include "tiropp/fwd.hpp"

§Public Functions

Name
native_type(std::string name)
~native_type() =default
native_type(native_type && ) =default
native_type &operator=(native_type && ) =default
boolvalid() const
Returns true is valid, i.e. if this native_type has not been moved from.
const std::string &name() const
Returns the native type's name (the value of original constructor argument).
boolis_instance(const native & object) const
Returns true if the given native object is an instance of this type.
nativemake(vm & v, T && instance) const
Constructs a new object of this type. The contents of instance will be moved into the constructed object.
T *access(const native & object) const
Returns the address of the native object instance.
boolis_destroyed(const native & object) const
Returns true if the referenced object was already destroyed manually by calling [destroy()]().
voiddestroy(const native & object) const
Manually destroys the native object.

§Detailed Description

template <typename T >
class tiro::native_type;

§Public Functions Documentation

§function native_type

inline explicit native_type(
std::string name
)

§function ~native_type

~native_type() =default

§function native_type

native_type(
native_type &&
) =default

§function operator=

native_type & operator=(
native_type &&
) =default

§function valid

inline bool valid() const

Returns true is valid, i.e. if this native_type has not been moved from.

§function name

inline const std::string & name() const

Returns the native type's name (the value of original constructor argument).

§function is_instance

inline bool is_instance(
const native & object
) const

Returns true if the given native object is an instance of this type.

§function make

inline native make(
vm & v,
T && instance
) const

Constructs a new object of this type. The contents of instance will be moved into the constructed object.

§function access

inline T * access(
const native & object
) const

Returns the address of the native object instance.

TODO: This API will have to change (or become more dangerous) once the gc starts to move objects around.

§function is_destroyed

inline bool is_destroyed(
const native & object
) const

Returns true if the referenced object was already destroyed manually by calling [destroy()]().

§function destroy

inline void destroy(
const native & object
) const

Manually destroys the native object.

Future [access()](/docs/api/classes/classtiro_1_1native__type#function-access) calls to the same object will fail with an exception. Note that objects are destroyed automatically when they are collected by the garbage collector. This function allows the programmer to trigger the destruction at an earlier point in time.


Updated on 2022-02-27 at 21:17:13 +0100