Loading...
Searching...
No Matches
SBCMetaType< T > Class Template Reference

This template class provides type information. More...

Type information

enum  TypeInformation {
  IsEnumType ,
  IsClassType ,
  IsFundamentalType ,
  IsRegisteredType ,
  IsConstType ,
  IsVolatileType ,
  IsReferenceType ,
  IsArrayType ,
  IsPointerType ,
  IsPointerToMemberType ,
  IsFunctionType ,
  IsPointerToFunctionType ,
  IsPointerToMemberFunctionType ,
  HasBaseType ,
  NumberOfParameters
}
 Type information. More...
 

Type names

static std::string getTypeName ()
 Returns the type name.
 
static std::string getParentTypeName ()
 Returns the parent type name.
 
static std::string getRootTypeName ()
 Returns the root type name.
 
static std::string getBaseTypeName ()
 Returns the base type name.
 
static std::string getOutputTypeName ()
 Returns the output type name.
 
static std::string getClassTypeName ()
 Returns the class type name.
 
static std::string getParameterTypeName (unsigned int i)
 Returns the type name of parameter i.
 

Short type names

static std::string getShortTypeName ()
 Returns the short type name.
 
static std::string getShortParentTypeName ()
 Returns the short parent type name.
 
static std::string getShortRootTypeName ()
 Returns the short root type name.
 
static std::string getShortBaseTypeName ()
 Returns the short base type name.
 
static std::string getShortOutputTypeName ()
 Returns the short output type name.
 
static std::string getShortClassTypeName ()
 Returns the short class type name.
 
static std::string getShortParameterTypeName (unsigned int i)
 Returns the short type name of parameter i.
 

Identity

static SBCContainerUUID getTypeUUID ()
 Returns the UUID of the type.
 

Detailed Description

template<typename T>
class SBCMetaType< T >
Parameters
TThe type about which information is sought

This template class provides information about a type T, through enumerated values and static functions, including for example:

// isConstType = true
bool isConstType = SBType<const double>::IsConstType;
// typeName = "const std::string&";
std::string typeName = SBType<const std::string&>::getTypeName();
// parentTypeName = "std::string";
std::string parentTypeName = SBType<const std::string>::getParentTypeName();
// rootTypeName = "std::string";
std::string rootTypeName = SBType<const std::string**>::getRootTypeName();
// shortName = "SBAtom";
std::string shortName = SBType<SBMStructuralModelNodeAtom>::getShortTypeName();

Short name: SBType

See also
SBCMetaValue
SBCMetaValueType
SBCMetaValueHolder
Introspection

Member Enumeration Documentation

◆ TypeInformation

template<typename T >
enum SBCMetaType::TypeInformation

This enumerated type returns information about the type T. Besides NumberOfParameters, each enumerated value is equal to either 1 or 0.

Enumerator
IsEnumType 

IsEnumType is equal to 1 if T is an enum.

IsClassType 

IsClassType is equal to 1 if T is a class.

IsFundamentalType 

IsFundamentalType is equal to 1 if T is fundamental (void, bool, char, signed char, unsigned char, wchar_t, short, unsigned short, int, unsigned int, long, unsigned long, float, double or long double).

IsRegisteredType 

IsRegisteredType is equal to 1 if T is a registered type.

IsConstType 

IsConstType is equal to 1 if T is const.

IsVolatileType 

IsVolatileType is equal to 1 if T is volatile.

IsReferenceType 

IsReferenceType is equal to 1 if T is a reference.

IsArrayType 

IsArrayType is equal to 1 if T is an array.

IsPointerType 

IsPointerType is equal to 1 if T is a pointer.

IsPointerToMemberType 

IsPointerToMemberType is equal to 1 if T is a pointer to a member.

IsFunctionType 

IsFunctionType is equal to 1 if T is a function.

IsPointerToFunctionType 

IsPointerToFunctionType is equal to 1 if T is a function pointer.

IsPointerToMemberFunctionType 

IsPointerToMemberFunctionType is equal to 1 if T is a pointer to a member function.

HasBaseType 

HasBaseType is equal to 1 if T has a base type.

NumberOfParameters 

When T is a function, NumberOfParameters is equal to the number of its parameters.

Member Function Documentation

◆ getBaseTypeName()

template<typename T >
static std::string SBCMetaType< T >::getBaseTypeName ( )
inlinestatic

This function returns the type name of the base type of T. For example, the base type name of SBMStructuralModelNodeAtom is "SBMStructuralModelNode".

◆ getClassTypeName()

template<typename T >
static std::string SBCMetaType< T >::getClassTypeName ( )
inlinestatic

This function returns the type name of the class associated to T, when T is a pointer to a member or a pointer to a member function ("void" otherwise). For example, the class type name of &SBMStructuralModelNodeAtom::clearName is "SBMStructuralModelNodeAtom".

◆ getOutputTypeName()

template<typename T >
static std::string SBCMetaType< T >::getOutputTypeName ( )
inlinestatic

This function returns the type name of the output type of T, when T is a function. For example, the output type name of SBMStructuralModelNodeAtom* getFirstAtom() is "SBMStructuralModelNodeAtom*".

◆ getParameterTypeName()

template<typename T >
static std::string SBCMetaType< T >::getParameterTypeName ( unsigned int  i)
inlinestatic

This function returns the type name of parameter i of type T, when T is a function ("void" otherwise). For example, the type name of parameter 2 of myFunction(int, double, const SBMStructuralModelNodeAtom*) is "const SBMStructuralModelNodeAtom*".

◆ getParentTypeName()

template<typename T >
static std::string SBCMetaType< T >::getParentTypeName ( )
inlinestatic

This function returns the type name of the parent type of T. For example, the parent type name of int* is "int".

◆ getRootTypeName()

template<typename T >
static std::string SBCMetaType< T >::getRootTypeName ( )
inlinestatic

This function returns the type name of the root type of T. For example, the root type name of const std::string& is "std::string".

◆ getShortBaseTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortBaseTypeName ( )
inlinestatic

This function returns the short type name of the base type of T. For example, the short base type name of SBMStructuralModelNodeAtom is "SBNode".

◆ getShortClassTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortClassTypeName ( )
inlinestatic

This function returns the short type name of the class associated to T, when T is a pointer to a member or a pointer to a member function ("void" otherwise). For example, the short class type name of &SBMStructuralModelNodeAtom::clearName is "SBAtom".

◆ getShortOutputTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortOutputTypeName ( )
inlinestatic

This function returns the short type name of the output type of T, when T is a function. For example, the short output type name of SBMStructuralModelNodeAtom* getFirstAtom() is "SBAtom*".

◆ getShortParameterTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortParameterTypeName ( unsigned int  i)
inlinestatic

This function returns the short type name of parameter i of type T, when T is a function ("void" otherwise). For example, the short type name of parameter 2 of myFunction(int, double, const SBMStructuralModelNodeAtom*) is "const SBAtom*".

◆ getShortParentTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortParentTypeName ( )
inlinestatic

This function returns the short type name of the parent type of T. For example, the short parent type name of SBMStructuralModelNodeAtom* is "SBAtom".

◆ getShortRootTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortRootTypeName ( )
inlinestatic

This function returns the type name of the root type of T. For example, the short root type name of const SBMStructuralModelNodeAtom& is "SBAtom".

◆ getShortTypeName()

template<typename T >
static std::string SBCMetaType< T >::getShortTypeName ( )
inlinestatic

When the type T is fundamental, this function returns a string containing the fundamental type (e.g. "unsigned int"). When T is registered, this function returns its short type name. Else, this function recursively decomposes the type in order to provide a string describing it, but using short names (e.g. "const SBAtom*").

◆ getTypeName()

template<typename T >
static std::string SBCMetaType< T >::getTypeName ( )
inlinestatic

When the type T is fundamental, this function returns a string containing the fundamental type (e.g. "unsigned int"). When T is registered, this function returns its type name. Else, this function recursively decomposes the type in order to provide a string describing it (e.g. "const SBMStructuralModelNodeAtom*").

◆ getTypeUUID()

template<typename T >
static SBCContainerUUID SBCMetaType< T >::getTypeUUID ( )
inlinestatic

If the type is registered, this function returns the associated UUID. Else, the function returns an invalid UUID.