Web Analytics Made Easy - Statcounter
Skip to content

Class SBCMetaValueHolder#

template <typename T>

ClassList > SBCMetaValueHolder

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

  • #include <SBCMetaValueHolder.hpp>

Inherits the following classes: SBCMetaValueType

Inherited by the following classes: SBCClassObjectHolder

Public Functions#

Type Name
SBCMetaValueHolder (const T & v)
Constructs a value holder that holds value v .
virtual SBCMetaValueBase * clone () const
Clones the value.
T const & getConstReference () const
Returns a const reference to the hold value.
T & getReference ()
Returns a reference to the hold value.
T getValue () const
Returns the hold value.
virtual ~SBCMetaValueHolder ()
Destructs the value holder.

Public Functions inherited from SBCMetaValueType#

See SBCMetaValueType

Type Name
SBCMetaValueType ()
Constructs a type.
virtual SBCMetaValueBase * clone () const
Clones the value.
virtual SBCMetaValueBase * getBaseType () const
Returns the base type.
virtual std::string getBaseTypeName () const
Returns the base type name.
virtual SBCMetaValueBase * getClassType () const
Returns the class type.
virtual std::string getClassTypeName () const
Returns the class type name.
virtual unsigned int getNumberOfParameters () const
Returns the number of parameters of a function type.
virtual SBCMetaValueBase * getOutputType () const
Returns the output type.
virtual std::string getOutputTypeName () const
Returns the output type name.
virtual SBCMetaValueBase * getParameterType (unsigned int i) const
Returns the type of parameter i .
virtual std::string getParameterTypeName (unsigned int i) const
Returns the type name of parameter i .
virtual SBCMetaValueBase * getParentType () const
Returns the parent type.
virtual std::string getParentTypeName () const
Returns the parent type name.
virtual SBCMetaValueBase * getRootType () const
Returns the root type.
virtual std::string getRootTypeName () const
Returns the root type name.
virtual std::string getShortBaseTypeName () const
Returns the short base type name.
virtual std::string getShortClassTypeName () const
Returns the short class type name.
virtual std::string getShortOutputTypeName () const
Returns the short output type name.
virtual std::string getShortParameterTypeName (unsigned int i) const
Returns the short type name of parameter i .
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 getShortTypeName () const
Returns the short type name.
virtual std::string getTypeName () const
Returns the type name.
virtual SBCContainerUUID getTypeUUID () const
Returns the type UUID .
virtual bool hasBaseType () const
Returns true if the value is of a type that has a base type.
virtual bool isArrayType () const
Returns true if the value is of an array type.
virtual bool isClassType () const
Returns true if the value is of a class type.
virtual bool isConstType () const
Returns true if the value is of a const type.
virtual bool isEnumType () const
Returns true if the value is of an enum type.
virtual bool isFunctionType () const
Returns true if the value is of a function type.
virtual bool isFundamentalType () const
Returns true if the value is of a fundamental 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 isPointerToMemberType () const
Returns true if the value is of a pointer to member type.
virtual bool isPointerType () const
Returns true if the value is of a pointer type.
virtual bool isReferenceType () const
Returns true if the value is of a reference type.
virtual bool isRegisteredType () const
Returns true if the value is of a registered type.
virtual bool isVolatileType () const
Returns true if the value is of a volatile type.
virtual ~SBCMetaValueType ()
Destructs the type.

Public Functions inherited from SBCMetaValueBase#

See SBCMetaValueBase

Type Name
virtual SBCMetaValueBase * call (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 argumentst0 ,t1 , ...,t15 .
virtual void clear (const SBCMetaValue & object, const std::string & attributeName) const
Clears attribute attributeName from the value when possible.
virtual SBCMetaValueBase * clone () const
Clones the value.
virtual SBCMetaValueBase * constCall (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 argumentst0 ,t1 , ...,t15 .
virtual SBCMetaValueBase * get (const SBCMetaValue & object, const std::string & attributeName) const
Returns the value of attribute attributeName for this value.
virtual SBCMetaValueBase * getBaseType () const
Returns the base type.
virtual std::string getBaseTypeName () const
Returns the base type name.
virtual SBCMetaValueBase * getClassType () const
Returns the class type.
virtual std::string getClassTypeName () const
Returns the class type name.
virtual unsigned int getNumberOfParameters () const
Returns the number of parameters of a function type.
virtual SBCMetaValueBase * getOutputType () const
Returns the output type.
virtual std::string getOutputTypeName () const
Returns the output type name.
virtual SBCMetaValueBase * getParameterType (unsigned int i) const
Returns the type of parameter i .
virtual std::string getParameterTypeName (unsigned int i) const
Returns the type name of parameter i .
virtual SBCMetaValueBase * getParentType () const
Returns the parent type.
virtual std::string getParentTypeName () const
Returns the parent type name.
virtual SBCClassProxy * getProxy () const
Returns the proxy of the value.
virtual SBCMetaValueBase * getRootType () const
Returns the root type.
virtual std::string getRootTypeName () const
Returns the root type name.
virtual std::string getShortBaseTypeName () const
Returns the short base type name.
virtual std::string getShortClassTypeName () const
Returns the short class type name.
virtual std::string getShortOutputTypeName () const
Returns the short output type name.
virtual std::string getShortParameterTypeName (unsigned int i) const
Returns the short type name of parameter i .
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 getShortTypeName () const
Returns the short type name.
virtual unsigned int getSize (const SBCMetaValue & object, const std::string & attributeName) const
Returns the size of attribute attributeName in the value when relevant.
virtual std::string getTypeName () const
Returns the type name.
virtual SBCContainerUUID getTypeUUID () const
Returns the type UUID .
virtual bool has (const SBCMetaValue & object, const std::string & attributeName) const
Returns whether attribute attributeName exists in the value and has a value.
virtual bool hasBaseType () const
Returns true if the value is of a type that has a base type.
virtual bool isArrayType () const
Returns true if the value is of an array type.
virtual bool isClassType () const
Returns true if the value is of a class type.
virtual bool isConstType () const
Returns true if the value is of a const type.
virtual bool isEnumType () const
Returns true if the value is of an enum type.
virtual bool isFunctionType () const
Returns true if the value is of a function type.
virtual bool isFundamentalType () const
Returns true if the value is of a fundamental 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 isPointerToMemberType () const
Returns true if the value is of a pointer to member type.
virtual bool isPointerType () const
Returns true if the value is of a pointer type.
virtual bool isReferenceType () const
Returns true if the value is of a reference type.
virtual bool isRegisteredType () const
Returns true if the value is of a registered type.
virtual bool isVolatileType () const
Returns true if the value is of a volatile type.
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 tovalue .
virtual ~SBCMetaValueBase ()
Destructs the value.

Public Static Functions#

Type Name
T const & getValue (SBCMetaValueBase * container)
Returns the value held in the container .

Protected Attributes#

Type Name
T value
The hold value.

Protected Functions inherited from SBCMetaValueBase#

See SBCMetaValueBase

Type Name
SBCMetaValueBase ()
Constructs a value.

Detailed Description#

Parameters:

  • T The type described

This template class holds a value. It derives from the template class SBCMetaValueType, used to hold type information, which derives from SBCMetaValue, the base class of value holders.

Assume a SAMSON Extension called SEElement defines a class A, and another Extension called SEOtherElement wants to use it. If the 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 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 Extension SEOtherElement sees this value holder as a pointer to a SBValue (the base class of SBValueHolder<A*>):
SBValue* objectHolder = classProxy->createInstance();

Unlike the template class SBCMetaValueType, which only holds information about the type T of the value, the template class SBCMetaValueHolder does hold the value:

SBValueHolder<int>* intHolder = new SBValueHolder<int>(2);
int i = intHolder->getValue(); // i = 2
std::string typeName = intHolder->getTypeName(); // typeName = "int"

Short name: SBValueHolder

See also: SBCMetaType, SBCMetaValue, SBCMetaValueType

See also: Introspection

Public Functions Documentation#

function SBCMetaValueHolder#

Constructs a value holder that holds value v .

inline SBCMetaValueHolder::SBCMetaValueHolder (
    const T & v
) 


function clone#

Clones the value.

inline virtual SBCMetaValueBase * SBCMetaValueHolder::clone () const

Implements SBCMetaValueType::clone


function getConstReference#

Returns a const reference to the hold value.

inline T const & SBCMetaValueHolder::getConstReference () const


function getReference#

Returns a reference to the hold value.

inline T & SBCMetaValueHolder::getReference () 


function getValue [1/2]#

Returns the hold value.

inline T SBCMetaValueHolder::getValue () const


function ~SBCMetaValueHolder#

Destructs the value holder.

inline virtual SBCMetaValueHolder::~SBCMetaValueHolder () 


Public Static Functions Documentation#

function getValue [2/2]#

Returns the value held in the container .

static inline T const & SBCMetaValueHolder::getValue (
    SBCMetaValueBase * container
) 


Protected Attributes Documentation#

variable value#

The hold value.

T value;