Signature

template<typename T> struct Signature

Signatures provide a uniform means of accessing the Class object and the static type of that class of any reflected type, dynamic (Dynamic) or not.

Since it is a templated struct, it must be specialized for every static type it reflects (this is done in DECLARE_STATIC_REFLECTION), its default implementation covers the dynamic types.

Its main use is for getting the class of a type, which can be done with

Signature<Type>::TheClass()

However, since it is a templated struct, this is somewhat awkward.  It is suggested that you use TypeOf instead, which is easier to use inside a template and saves typeing (pun!).

The functions opaque_cast and translucent_cast turn typed pointers into generic (opaque) pointers and back.  This loses typeinfo, for a generic way to pass typed data around, see Variant.

Summary
SignatureSignatures provide a uniform means of accessing the Class object and the static type of that class of any reflected type, dynamic (Dynamic) or not.
Types
ClassTypeThis is the public static type of the Class represented by this signature type.
Functions
TheClassReturns the Class of the type represented by this signature.
Helper FunctionsThese functions help automate the common uses of the Signature type.
Functions
TypeOfTemplated function, returns the Class of a reflected type.
TypeOf (by value)Returns the Class type of an expression with a reflected type.
TypeOf (by array value)Returns a pointer type for an array.
opaque_castTurns a typed pointer (of type Type *) into an opaque pointer (a void *), for use with the class Signature::TheClass.
translucent_castTurns an opaque pointer (of type void *) into a typed pointer of the specified type.

Types

ClassType

typedef typename T::ClassType ClassType

This is the public static type of the Class represented by this signature type.

Functions

TheClass

Returns the Class of the type represented by this signature.

Helper Functions

These functions help automate the common uses of the Signature type.

Summary
Functions
TypeOfTemplated function, returns the Class of a reflected type.
TypeOf (by value)Returns the Class type of an expression with a reflected type.
TypeOf (by array value)Returns a pointer type for an array.
opaque_castTurns a typed pointer (of type Type *) into an opaque pointer (a void *), for use with the class Signature::TheClass.
translucent_castTurns an opaque pointer (of type void *) into a typed pointer of the specified type.

Functions

TypeOf

template<typename T> inline typename Signature<T>::ClassType *TypeOf()

Templated function, returns the Class of a reflected type.

For Example

Class *type = TypeOf<int>();
if(TypeOf<MyObject>()->Derives<Persistent>()) ...

TypeOf (by value)

template<typename T> inline typename Signature<T>::ClassType *TypeOf(const &)

Returns the Class type of an expression with a reflected type.

TypeOf (by array value)

template<typename T, unsigned size> inline typename Signature<T>::ClassType *TypeOf(
   const (&)[size]
)

Returns a pointer type for an array.  (so TypeOf(“Hello”) works as expected).

opaque_cast

template<typename T> inline void *opaque_cast(*value)

Turns a typed pointer (of type Type *) into an opaque pointer (a void *), for use with the class Signature::TheClass.  There are const and non-const versions of this function.

See Also

translucent_cast

template<typename Type> inline Type translucent_cast(void *value)

Turns an opaque pointer (of type void *) into a typed pointer of the specified type.  There are const and non-const versions of this function.

Implemented by Class::TranslucentCast.

Paired with opaque_cast.

template<typename T> struct Signature
Signatures provide a uniform means of accessing the Class object and the static type of that class of any reflected type, dynamic (Dynamic) or not.
class ReflectExport(reflect) Class : public ObjectType
class ReflectExport(reflect) Dynamic
This class defines the core interface for all runtime type identification (RTTI) in reflect.
typedef typename T::ClassType ClassType
This is the public static type of the Class represented by this signature type.
template<typename T> inline typename Signature<T>::ClassType *TypeOf()
Templated function, returns the Class of a reflected type.
template<typename T> inline typename Signature<T>::ClassType *TypeOf(const &)
Returns the Class type of an expression with a reflected type.
template<typename T, unsigned size> inline typename Signature<T>::ClassType *TypeOf(
   const (&)[size]
)
Returns a pointer type for an array.
template<typename T> inline void *opaque_cast(*value)
Turns a typed pointer (of type Type *) into an opaque pointer (a void *), for use with the class Signature::TheClass.
Returns the Class of the type represented by this signature.
template<typename Type> inline Type translucent_cast(void *value)
Turns an opaque pointer (of type void *) into a typed pointer of the specified type.
Declares reflection for a static type.
class ReflectExport(reflect) Variant
Variants represent objects of any reflected type.
template<typename T> static void *OpaqueCast(*ptr)
Casts a type represented by this Class to a void *, used by Serialize.
template<typename T> static T *TranslucentCast(void *ptr)
Casts a void * from OpaqueCast (template/static) back to a T *.
Close