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

This template class describes a value type. More...

Constructors and destructors

 SBCMetaValueType ()
 Constructs a type.
 
virtual ~SBCMetaValueType ()
 Destructs the type.
 

Type attributes

virtual bool isEnumType () const
 Returns true if the value is of an enum type.
 
virtual bool isClassType () const
 Returns true if the value is of a class type.
 
virtual bool isFundamentalType () const
 Returns true if the value is of a fundamental type.
 
virtual bool isRegisteredType () const
 Returns true if the value is of a registered type.
 
virtual bool isConstType () const
 Returns true if the value is of a const type.
 
virtual bool isVolatileType () const
 Returns true if the value is of a volatile type.
 
virtual bool isReferenceType () const
 Returns true if the value is of a reference type.
 
virtual bool isArrayType () const
 Returns true if the value is of an array type.
 
virtual bool isPointerType () const
 Returns true if the value is of a pointer type.
 
virtual bool isPointerToMemberType () const
 Returns true if the value is of a pointer to member type.
 
virtual bool isFunctionType () const
 Returns true if the value is of a function type.
 
virtual bool isPointerToFunctionType () const
 Returns true if the value is of a pointer to function type.
 
virtual bool isPointerToMemberFunctionType () const
 Returns true if the value is of a pointer to member function type.
 
virtual bool hasBaseType () const
 Returns true if the value is of a type that has a base type.
 
virtual unsigned int getNumberOfParameters () const
 Returns the number of parameters of a function type.
 

Type names

virtual std::string getTypeName () const
 Returns the type name.
 
virtual std::string getParentTypeName () const
 Returns the parent type name.
 
virtual std::string getRootTypeName () const
 Returns the root type name.
 
virtual std::string getBaseTypeName () const
 Returns the base type name.
 
virtual std::string getOutputTypeName () const
 Returns the output type name.
 
virtual std::string getClassTypeName () const
 Returns the class type name.
 
virtual std::string getParameterTypeName (unsigned int i) const
 Returns the type name of parameter i.
 
virtual std::string getShortTypeName () const
 Returns the short type name.
 
virtual std::string getShortParentTypeName () const
 Returns the short parent type name.
 
virtual std::string getShortRootTypeName () const
 Returns the short root type name.
 
virtual std::string getShortBaseTypeName () const
 Returns the short base type name.
 
virtual std::string getShortOutputTypeName () const
 Returns the short output type name.
 
virtual std::string getShortClassTypeName () const
 Returns the short class type name.
 
virtual std::string getShortParameterTypeName (unsigned int i) const
 Returns the short type name of parameter i.
 

Dependent types

virtual SBCMetaValueBasegetParentType () const
 Returns the parent type.
 
virtual SBCMetaValueBasegetRootType () const
 Returns the root type.
 
virtual SBCMetaValueBasegetBaseType () const
 Returns the base type.
 
virtual SBCMetaValueBasegetOutputType () const
 Returns the output type.
 
virtual SBCMetaValueBasegetClassType () const
 Returns the class type.
 
virtual SBCMetaValueBasegetParameterType (unsigned int i) const
 Returns the type of parameter i.
 

Identity

virtual SBCContainerUUID getTypeUUID () const
 Returns the type UUID

 

Cloning

virtual SBCMetaValueBaseclone () const
 Clones the value.
 

Additional Inherited Members

- Public Member Functions inherited from SBCMetaValueBase
virtual ~SBCMetaValueBase ()
 Destructs the value.
 
virtual SBCClassProxygetProxy () const
 Returns the proxy of the value.
 
virtual SBCMetaValueBasecall (const SBCMetaValue &object, const std::string &functionName, const SBCMetaValue &t0, const SBCMetaValue &t1, const SBCMetaValue &t2, const SBCMetaValue &t3, const SBCMetaValue &t4, const SBCMetaValue &t5, const SBCMetaValue &t6, const SBCMetaValue &t7, const SBCMetaValue &t8, const SBCMetaValue &t9, const SBCMetaValue &t10, const SBCMetaValue &t11, const SBCMetaValue &t12, const SBCMetaValue &t13, const SBCMetaValue &t14, const SBCMetaValue &t15) const
 Calls the function functionName of the value with arguments t0, t1, ..., t15.
 
virtual SBCMetaValueBaseconstCall (const SBCMetaValue &object, const std::string &functionName, const SBCMetaValue &t0, const SBCMetaValue &t1, const SBCMetaValue &t2, const SBCMetaValue &t3, const SBCMetaValue &t4, const SBCMetaValue &t5, const SBCMetaValue &t6, const SBCMetaValue &t7, const SBCMetaValue &t8, const SBCMetaValue &t9, const SBCMetaValue &t10, const SBCMetaValue &t11, const SBCMetaValue &t12, const SBCMetaValue &t13, const SBCMetaValue &t14, const SBCMetaValue &t15) const
 Calls the const function functionName of the value with arguments t0, t1, ..., t15.
 
virtual SBCMetaValueBaseget (const SBCMetaValue &object, const std::string &attributeName) const
 Returns the value of attribute attributeName for this value.
 
virtual void set (const SBCMetaValue &object, const std::string &attributeName, const SBCMetaValue &value, const SBCMetaValue &size) const
 Sets the value of attribute attributeName for this value to value.
 
virtual bool has (const SBCMetaValue &object, const std::string &attributeName) const
 Returns whether attribute attributeName exists in the value and has a value.
 
virtual void clear (const SBCMetaValue &object, const std::string &attributeName) const
 Clears attribute attributeName from the value when possible.
 
virtual unsigned int getSize (const SBCMetaValue &object, const std::string &attributeName) const
 Returns the size of attribute attributeName in the value when relevant.
 
- Protected Member Functions inherited from SBCMetaValueBase
 SBCMetaValueBase ()
 Constructs a value.
 

Detailed Description

template<typename T>
class SBCMetaValueType< T >
Parameters
TThe type described

This template class holds information about a type. It is also the direct base class of the template class SBCMetaValueHolder, used to hold values.

Assume a SAMSON Extension called SEElement defines a class A, and another SAMSON Extension called SEOtherElement wants to use it. If the SAMSON Extension called SEOtherElement does not have access to the declaration of class A (typically provided in a header file included in SEElement), it cannot use the symbol A in its source code. For example, if the source code of SEOtherElement contained the line:

A* a = new A();

the compiler would complain that the symbol A is not defined.

In order to provide access to exposed classes, SAMSON uses a mechanism to hold values (for example, pointers to objects) in a uniform way. In the example above, the constructor exposed in the SAMSON Extension SEElement returns a value holder that stores a pointer to the new instance of class A:

return new SBValueHolder<A*>(new A());

and the SAMSON Extension SEOtherElement sees this value holder as a pointer to a SBValue (the base class of SBValueHolder<A*>):

SBValue* objectHolder = classProxy->createInstance();
This class represents values.
Definition: SBCMetaValue.hpp:23

The template class SBCMetaValueType does not hold a value (this is the role of SBCMetaValueHolder, which derives from SBCMetaValueType), but provides information about a type T. For example, the short name of a registered type may be retrieved using this class:

// shortName = "SBAtom";
std::string shortName = SBType<SBMStructuralModelNodeAtom>::getShortTypeName();

Short name: SBValueType

See also
SBCMetaType
SBCMetaValue
SBCMetaValueHolder
Introspection

Member Function Documentation

◆ clone()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::clone ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

Reimplemented in SBCMetaValueHolder< T >.

◆ getBaseType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getBaseType ( ) const
inlinevirtual

This function returns the base type, i.e. an instance of the template class SBCMetaValueType which contains type information about the base type of this type. For example, the base type of SBMStructuralModelNodeAtom is SBMStructuralModelNode.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getBaseTypeName().

See also
SBCMetaValueType::getBaseTypeName()

Reimplemented from SBCMetaValueBase.

◆ getBaseTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getBaseTypeName ( ) const
inlinevirtual

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

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getBaseType().

See also
SBCMetaValueType::getBaseType()

Reimplemented from SBCMetaValueBase.

◆ getClassType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getClassType ( ) const
inlinevirtual

This function returns the class type, i.e. an instance of the template class SBCMetaValueType which contains type information about the class type of this type, when the type is a pointer to a member or a pointer to a member function. For example, the class type name of &SBMStructuralModelNodeAtom::clearName is SBMStructuralModelNodeAtom.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getClassTypeName().

See also
SBCMetaValueType::getClassTypeName()

Reimplemented from SBCMetaValueBase.

◆ getClassTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getClassTypeName ( ) const
inlinevirtual

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".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getClassType().

See also
SBCMetaValueType::getClassType()

Reimplemented from SBCMetaValueBase.

◆ getNumberOfParameters()

template<typename T >
virtual unsigned int SBCMetaValueType< T >::getNumberOfParameters ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ getOutputType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getOutputType ( ) const
inlinevirtual

This function returns the output type, i.e. an instance of the template class SBCMetaValueType which contains type information about the output type of this type, when the type is a function. For example, the output type name of SBMStructuralModelNodeAtom* getFirstAtom() is SBMStructuralModelNodeAtom.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getOutputTypeName().

See also
SBCMetaValueType::getOutputTypeName()

Reimplemented from SBCMetaValueBase.

◆ getOutputTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getOutputTypeName ( ) const
inlinevirtual

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*".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getOutputType().

See also
SBCMetaValueType::getOutputType()

Reimplemented from SBCMetaValueBase.

◆ getParameterType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getParameterType ( unsigned int  i) const
inlinevirtual

This function returns the type of parameter i, , i.e. an instance of the template class SBCMetaValueType which contains type information about the type of parameter i, when the type is a function. For example, the type name of parameter 2 of myFunction(int, double, const SBMStructuralModelNodeAtom*) is const SBMStructuralModelNodeAtom*.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getParameterTypeName().

See also
SBCMetaValueType::getParameterTypeName()

Reimplemented from SBCMetaValueBase.

◆ getParameterTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getParameterTypeName ( unsigned int  i) const
inlinevirtual

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*".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getParameterType().

See also
SBCMetaValueType::getParameterType()

Reimplemented from SBCMetaValueBase.

◆ getParentType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getParentType ( ) const
inlinevirtual

This function returns the parent type, i.e. an instance of the template class SBCMetaValueType which contains type information about the parent type of this type. For example, the parent type of int* is int.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getParentTypeName().

See also
SBCMetaValueType::getParentTypeName()

Reimplemented from SBCMetaValueBase.

◆ getParentTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getParentTypeName ( ) const
inlinevirtual

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

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getParentType().

See also
SBCMetaValueType::getParentType()
SBCMetaValueType::getRootTypeName()

Reimplemented from SBCMetaValueBase.

◆ getRootType()

template<typename T >
virtual SBCMetaValueBase * SBCMetaValueType< T >::getRootType ( ) const
inlinevirtual

This function returns the root type, i.e. an instance of the template class SBCMetaValueType which contains type information about the root type of this type. For example, the root type of const std::string& is std::string.

Note that this function returns a type. If a string is needed, use SBCMetaValueType::getRootTypeName().

See also
SBCMetaValueType::getRootTypeName()

Reimplemented from SBCMetaValueBase.

◆ getRootTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getRootTypeName ( ) const
inlinevirtual

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".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getRootType().

See also
SBCMetaValueType::getRootType()
SBCMetaValueType::getParentTypeName()

Reimplemented from SBCMetaValueBase.

◆ getShortBaseTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortBaseTypeName ( ) const
inlinevirtual

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

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getBaseType().

See also
SBCMetaValueType::getBaseType()

Reimplemented from SBCMetaValueBase.

◆ getShortClassTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortClassTypeName ( ) const
inlinevirtual

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*".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getClassType().

See also
SBCMetaValueType::getClassType()

Reimplemented from SBCMetaValueBase.

◆ getShortOutputTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortOutputTypeName ( ) const
inlinevirtual

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".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getOutputType().

See also
SBCMetaValueType::getOutputType()

Reimplemented from SBCMetaValueBase.

◆ getShortParameterTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortParameterTypeName ( unsigned int  i) const
inlinevirtual

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*".

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getParameterType().

See also
SBCMetaValueType::getParameterType()

Reimplemented from SBCMetaValueBase.

◆ getShortParentTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortParentTypeName ( ) const
inlinevirtual

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

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getParentType().

See also
SBCMetaValueType::getParentType()
SBCMetaValueType::getShortRootTypeName()

Reimplemented from SBCMetaValueBase.

◆ getShortRootTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortRootTypeName ( ) const
inlinevirtual

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

Note that this function returns a string. If a type is needed, use SBCMetaValueType::getRootType().

See also
SBCMetaValueType::getRootType()
SBCMetaValueType::getShortParentTypeName()

Reimplemented from SBCMetaValueBase.

◆ getShortTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getShortTypeName ( ) const
inlinevirtual

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*").

Reimplemented from SBCMetaValueBase.

◆ getTypeName()

template<typename T >
virtual std::string SBCMetaValueType< T >::getTypeName ( ) const
inlinevirtual

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*").

Reimplemented from SBCMetaValueBase.

◆ getTypeUUID()

template<typename T >
virtual SBCContainerUUID SBCMetaValueType< T >::getTypeUUID ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ hasBaseType()

template<typename T >
virtual bool SBCMetaValueType< T >::hasBaseType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isArrayType()

template<typename T >
virtual bool SBCMetaValueType< T >::isArrayType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isClassType()

template<typename T >
virtual bool SBCMetaValueType< T >::isClassType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isConstType()

template<typename T >
virtual bool SBCMetaValueType< T >::isConstType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isEnumType()

template<typename T >
virtual bool SBCMetaValueType< T >::isEnumType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isFunctionType()

template<typename T >
virtual bool SBCMetaValueType< T >::isFunctionType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isFundamentalType()

template<typename T >
virtual bool SBCMetaValueType< T >::isFundamentalType ( ) const
inlinevirtual

Returns true if the value is of a fundamental type (void, bool, char, signed char, unsigned char, wchar_t, short, unsigned short, int, unsigned int, long, unsigned long, float, double or long double).

Reimplemented from SBCMetaValueBase.

◆ isPointerToFunctionType()

template<typename T >
virtual bool SBCMetaValueType< T >::isPointerToFunctionType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isPointerToMemberFunctionType()

template<typename T >
virtual bool SBCMetaValueType< T >::isPointerToMemberFunctionType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isPointerToMemberType()

template<typename T >
virtual bool SBCMetaValueType< T >::isPointerToMemberType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isPointerType()

template<typename T >
virtual bool SBCMetaValueType< T >::isPointerType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isReferenceType()

template<typename T >
virtual bool SBCMetaValueType< T >::isReferenceType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isRegisteredType()

template<typename T >
virtual bool SBCMetaValueType< T >::isRegisteredType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.

◆ isVolatileType()

template<typename T >
virtual bool SBCMetaValueType< T >::isVolatileType ( ) const
inlinevirtual

Reimplemented from SBCMetaValueBase.