osgIntrospection::Type Class Reference

Objects of class Type are used to maintain information about reflected types. More...

Inheritance diagram for osgIntrospection::Type:

Inheritance graph
[legend]

List of all members.

Public Types

enum  FunctionCategory { PUBLIC_FUNCTIONS, PROTECTED_FUNCTIONS }
 Function category specifier for querying constructors and methods. More...

Public Member Functions

 ~Type ()
 Destructor. Note that this class is not meant to be subclassed.
const std::type_info & getStdTypeInfo () const
 Returns a reference to the std::type_info instance associated to this Type.
ExtendedTypeInfo getExtendedTypeInfo () const
 Returns a reference to the ExtendedTypeInfo associated to this Type.
bool isDefined () const
 Returns true if this Type is defined, false if it's just declared.
const std::string & getName () const
 Returns the name of the reflected type.
const std::string & getNamespace () const
 Returns the namespace of the reflected type.
std::string getQualifiedName () const
 Returns the qualified name of the reflected type.
bool matchesName (const std::string &name) const
 Returns true if either the fully-qualified name or one of the name aliases match the given argument.
virtual const
std::string & 
getBriefHelp () const
 Returns the brief help of the reflected type.
virtual const
std::string & 
getDetailedHelp () const
 Returns the detailed help of the reflected type.
int getNumBaseTypes () const
 Returns the number of base types.
const TypegetBaseType (int i) const
 Returns the i-th base type.
const TypeListgetBaseTypeList () const
 Returns the base type list.
int getNumAliases () const
 Returns the number of type name aliases.
const std::string & getAlias (int i) const
 Returns the i-th name alias.
bool isAbstract () const
 Returns whether the reflected type is abstract.
bool isAtomic () const
 Returns whether the reflected type is "atomic", that is it can be rendered to and decoded from a stream directly.
bool isEnum () const
 Returns whether the reflected type is an enumeration.
bool isVoid () const
 Returns whether the reflected type is the type void.
bool isPointer () const
 Returns true if the reflected type is a pointer, false otherwise.
bool isConstPointer () const
 Returns true if the reflected type is a pointer AND it is const, false otherwise.
bool isNonConstPointer () const
 Returns true if the reflected type is a pointer AND it is not const, false otherwise.
const TypegetPointedType () const
 Returns the pointed type.
bool isReference () const
 Returns true if the reflected type is a reference, false otherwise.
bool isConstReference () const
 Returns true if the reflected type is a reference AND it is const, false otherwise.
bool isNonConstReference () const
 Returns true if the reflected type is a reference AND it is not const, false otherwise.
const TypegetReferencedType () const
 Returns the referenced type.
const PropertyInfoListgetProperties () const
 Returns the list of properties defined for this type.
void getAllProperties (PropertyInfoList &props) const
 Fills a list of properties that are either defined in this Type or in inherited types.
void getPropertiesMap (PropertyInfoMap &props) const
 Fills a map of "type <-> propertyInfoList" that are either defined in this Type or in inherited types.
const
ConstructorInfoList
getConstructors (FunctionCategory category=PUBLIC_FUNCTIONS) const
 Returns the list of constructors defined for this type.
const MethodInfoListgetMethods (FunctionCategory category=PUBLIC_FUNCTIONS) const
 Returns the list of methods defined for this type.
void getAllMethods (MethodInfoList &methods, FunctionCategory category=PUBLIC_FUNCTIONS) const
 Fills a list of methods that are either defined in this Type or in inherited types.
void getMethodsMap (MethodInfoMap &methods, FunctionCategory category=PUBLIC_FUNCTIONS) const
 Fills a map of "type <-> MethodInfoList" that are either defined in this Type or in inherited types.
const EnumLabelMapgetEnumLabels () const
 Returns the map of enumeration labels.
const ConstructorInfogetCompatibleConstructor (const ValueList &values) const
 Searches for a constructor that can be called with the given list of arguments without raising type conversion errors.
const ConstructorInfogetConstructor (const ParameterInfoList &params) const
 Searches for a constructor whose parameters match exactly the given list of parameter descriptions.
const MethodInfogetCompatibleMethod (const std::string &name, const ValueList &values, bool inherit) const
 Searches for a method that can be called with the given list of arguments without raising type conversion errors.
const MethodInfogetMethod (const std::string &name, const ParameterInfoList &params, bool inherit) const
 Searches for a method whose parameters match exactly the given list of parameter descriptions.
const PropertyInfogetProperty (const std::string &name, const Type &ptype, const ParameterInfoList &indices, bool inherit) const
 Searches for a property given its name, type and list of indices.
Value invokeMethod (const std::string &name, const Value &instance, ValueList &args, bool inherit) const
 Searches for a suitable method and invokes it with the given list of arguments (const instance).
Value invokeMethod (const std::string &name, Value &instance, ValueList &args, bool inherit) const
 Searches for a suitable method and invokes it with the given list of arguments.
bool isSubclassOf (const Type &type) const
 Returns whether the reflected type is derived from another type.
const ReaderWritergetReaderWriter () const
 Returns the instance of the reader/writer object assigned to this type, if any.
const ComparatorgetComparator () const
 Returns the instance of the comparator object assigned to this type, if any.
const std::string & getDeclaringFile () const
 Returns the path to the file where this type is declared, relative the the OpenSceneGraph include directory.
Value createInstance (ValueList &args) const
 Creates an instance of the reflected type.
Value createInstance () const

Protected Member Functions

 Type (const ExtendedTypeInfo &ti)
void check_defined () const
virtual void getInheritedProviders (CustomAttributeProviderList &providers) const

Friends

class Reflector
struct TypeNameAliasProxy
class Reflection


Detailed Description

Objects of class Type are used to maintain information about reflected types.

They also provide a number of services, like instance creation and dynamic calling of methods. All details about the data type being described are available at runtime, provided that the type was defined (and not just declared) through a Reflector class. It is not possible to modify a Type object once it has been created, unless you are a class derived from Reflector (which has firm friendship with this class).


Member Enumeration Documentation

enum osgIntrospection::Type::FunctionCategory

Function category specifier for querying constructors and methods.

Enumerator:
PUBLIC_FUNCTIONS 
PROTECTED_FUNCTIONS 


Constructor & Destructor Documentation

osgIntrospection::Type::~Type (  ) 

Destructor. Note that this class is not meant to be subclassed.

osgIntrospection::Type::Type ( const ExtendedTypeInfo ti  )  [inline, protected]


Member Function Documentation

const std::type_info & osgIntrospection::Type::getStdTypeInfo (  )  const [inline]

Returns a reference to the std::type_info instance associated to this Type.

ExtendedTypeInfo osgIntrospection::Type::getExtendedTypeInfo (  )  const [inline]

Returns a reference to the ExtendedTypeInfo associated to this Type.

bool osgIntrospection::Type::isDefined (  )  const [inline]

Returns true if this Type is defined, false if it's just declared.

See class Reflector if you want to create a new Type.

const std::string & osgIntrospection::Type::getName (  )  const [inline]

Returns the name of the reflected type.

const std::string & osgIntrospection::Type::getNamespace (  )  const [inline]

Returns the namespace of the reflected type.

std::string osgIntrospection::Type::getQualifiedName (  )  const [inline]

Returns the qualified name of the reflected type.

The qualified name is formed by the namespace, if present, plus other modifiers like 'const' and/or '*' (pointer) where applicable.

bool osgIntrospection::Type::matchesName ( const std::string &  name  )  const [inline]

Returns true if either the fully-qualified name or one of the name aliases match the given argument.

const std::string & osgIntrospection::Type::getBriefHelp (  )  const [inline, virtual]

Returns the brief help of the reflected type.

const std::string & osgIntrospection::Type::getDetailedHelp (  )  const [inline, virtual]

Returns the detailed help of the reflected type.

int osgIntrospection::Type::getNumBaseTypes (  )  const [inline]

Returns the number of base types.

This number is zero if the type is not derived from any other type.

const Type & osgIntrospection::Type::getBaseType ( int  i  )  const [inline]

Returns the i-th base type.

const TypeList & osgIntrospection::Type::getBaseTypeList (  )  const [inline]

Returns the base type list.

int osgIntrospection::Type::getNumAliases (  )  const [inline]

Returns the number of type name aliases.

const std::string & osgIntrospection::Type::getAlias ( int  i  )  const [inline]

Returns the i-th name alias.

bool osgIntrospection::Type::isAbstract (  )  const [inline]

Returns whether the reflected type is abstract.

bool osgIntrospection::Type::isAtomic (  )  const [inline]

Returns whether the reflected type is "atomic", that is it can be rendered to and decoded from a stream directly.

bool osgIntrospection::Type::isEnum (  )  const [inline]

Returns whether the reflected type is an enumeration.

bool osgIntrospection::Type::isVoid (  )  const [inline]

Returns whether the reflected type is the type void.

bool osgIntrospection::Type::isPointer (  )  const [inline]

Returns true if the reflected type is a pointer, false otherwise.

bool osgIntrospection::Type::isConstPointer (  )  const [inline]

Returns true if the reflected type is a pointer AND it is const, false otherwise.

bool osgIntrospection::Type::isNonConstPointer (  )  const [inline]

Returns true if the reflected type is a pointer AND it is not const, false otherwise.

const Type & osgIntrospection::Type::getPointedType (  )  const [inline]

Returns the pointed type.

If the reflected type is not a pointer, the object returned is typeof(void).

bool osgIntrospection::Type::isReference (  )  const [inline]

Returns true if the reflected type is a reference, false otherwise.

bool osgIntrospection::Type::isConstReference (  )  const [inline]

Returns true if the reflected type is a reference AND it is const, false otherwise.

bool osgIntrospection::Type::isNonConstReference (  )  const [inline]

Returns true if the reflected type is a reference AND it is not const, false otherwise.

const Type & osgIntrospection::Type::getReferencedType (  )  const [inline]

Returns the referenced type.

If the reflected type is not a reference, the object returned is typeof(void).

const PropertyInfoList & osgIntrospection::Type::getProperties (  )  const [inline]

Returns the list of properties defined for this type.

The list does not include properties inherited from base types.

void osgIntrospection::Type::getAllProperties ( PropertyInfoList props  )  const

Fills a list of properties that are either defined in this Type or in inherited types.

void osgIntrospection::Type::getPropertiesMap ( PropertyInfoMap props  )  const

Fills a map of "type <-> propertyInfoList" that are either defined in this Type or in inherited types.

const ConstructorInfoList & osgIntrospection::Type::getConstructors ( FunctionCategory  category = PUBLIC_FUNCTIONS  )  const [inline]

Returns the list of constructors defined for this type.

const MethodInfoList & osgIntrospection::Type::getMethods ( FunctionCategory  category = PUBLIC_FUNCTIONS  )  const [inline]

Returns the list of methods defined for this type.

The list does not include methods inherited from base types.

void osgIntrospection::Type::getAllMethods ( MethodInfoList methods,
FunctionCategory  category = PUBLIC_FUNCTIONS 
) const

Fills a list of methods that are either defined in this Type or in inherited types.

void osgIntrospection::Type::getMethodsMap ( MethodInfoMap methods,
FunctionCategory  category = PUBLIC_FUNCTIONS 
) const

Fills a map of "type <-> MethodInfoList" that are either defined in this Type or in inherited types.

const EnumLabelMap & osgIntrospection::Type::getEnumLabels (  )  const [inline]

Returns the map of enumeration labels.

If the type is not an enumeration, an empty map is returned.

const ConstructorInfo* osgIntrospection::Type::getCompatibleConstructor ( const ValueList values  )  const

Searches for a constructor that can be called with the given list of arguments without raising type conversion errors.

If more than one constructors are suitable for calling, the best match is returned.

const ConstructorInfo* osgIntrospection::Type::getConstructor ( const ParameterInfoList params  )  const

Searches for a constructor whose parameters match exactly the given list of parameter descriptions.

const MethodInfo* osgIntrospection::Type::getCompatibleMethod ( const std::string &  name,
const ValueList values,
bool  inherit 
) const

Searches for a method that can be called with the given list of arguments without raising type conversion errors.

If more than one method are suitable for calling, the best match is returned.

const MethodInfo* osgIntrospection::Type::getMethod ( const std::string &  name,
const ParameterInfoList params,
bool  inherit 
) const

Searches for a method whose parameters match exactly the given list of parameter descriptions.

const PropertyInfo* osgIntrospection::Type::getProperty ( const std::string &  name,
const Type ptype,
const ParameterInfoList indices,
bool  inherit 
) const

Searches for a property given its name, type and list of indices.

Only exact matches are returned.

Value osgIntrospection::Type::invokeMethod ( const std::string &  name,
const Value instance,
ValueList args,
bool  inherit 
) const

Searches for a suitable method and invokes it with the given list of arguments (const instance).

Value osgIntrospection::Type::invokeMethod ( const std::string &  name,
Value instance,
ValueList args,
bool  inherit 
) const

Searches for a suitable method and invokes it with the given list of arguments.

bool osgIntrospection::Type::isSubclassOf ( const Type type  )  const

Returns whether the reflected type is derived from another type.

const ReaderWriter * osgIntrospection::Type::getReaderWriter (  )  const [inline]

Returns the instance of the reader/writer object assigned to this type, if any.

Otherwise it returns the null pointer.

const Comparator * osgIntrospection::Type::getComparator (  )  const [inline]

Returns the instance of the comparator object assigned to this type, if any.

Otherwise it returns the null pointer.

const std::string & osgIntrospection::Type::getDeclaringFile (  )  const [inline]

Returns the path to the file where this type is declared, relative the the OpenSceneGraph include directory.

Returns the empty string if no path information is available.

Value osgIntrospection::Type::createInstance ( ValueList args  )  const

Creates an instance of the reflected type.

The returned Value can be casted to T*, where T is the reflected type. If the type is abstract, an exception is thrown.

Value osgIntrospection::Type::createInstance (  )  const [inline]

void osgIntrospection::Type::check_defined (  )  const [inline, protected]

virtual void osgIntrospection::Type::getInheritedProviders ( CustomAttributeProviderList providers  )  const [protected, virtual]

Implements osgIntrospection::CustomAttributeProvider.


Friends And Related Function Documentation

friend class Reflector [friend]

friend struct TypeNameAliasProxy [friend]

friend class Reflection [friend]


The documentation for this class was generated from the following file:
Generated at Sun Oct 14 02:12:33 2007 for the OpenSceneGraph by doxygen 1.5.3.