kanzi::MethodArguments Class Reference

Holds arguments applied on metamethod invocation. More...

#include <kanzi/core/metadata/metamethod.hpp>

Public Member Functions

 MethodArguments ()
 
 ~MethodArguments ()
 
template<typename TDataType >
TDataType getArgument (const PropertyType< TDataType > &argumentType) const
 Returns the value of an argument of a given type. More...
 
template<typename TDataType >
void setArgument (const PropertyType< TDataType > &argumentType, typename PropertyType< TDataType >::DataType value)
 Adds or updates the value for a given argument type. More...
 
template<typename TDataType >
bool getAbstractArgument (AbstractPropertyType argumentType, TDataType &value)
 Retrieves an argument with the given argumentType into the value address. More...
 
template<typename TDataType >
void setAbstractArgument (AbstractPropertyType argumentType, TDataType value)
 Adds or updates the value for a given argument type. More...
 
bool isSet (AbstractPropertyType argumentType) const
 Checks whether a given argument type is set. More...
 
size_t getCount () const
 Returns the number of arguments set, or 0 if none set. More...
 

Detailed Description

Holds arguments applied on metamethod invocation.

MethodArguments includes argument values applied on metamethods during invocation. You can add values using setArgument() and setAbstractArgument(), and retrieve them with getArgument() and getAbstractArgument() methods. To get the argument values of a given type use the same argument type which you used to set them. To verify the presence of an argument type, use isSet().

Constructor & Destructor Documentation

kanzi::MethodArguments::MethodArguments ( )
explicit
kanzi::MethodArguments::~MethodArguments ( )

Member Function Documentation

template<typename TDataType >
TDataType kanzi::MethodArguments::getArgument ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of an argument of a given type.

Use it when the property type defining the metamethod argument is known at build time.

Parameters
argumentTypeThe type of the argument.
Returns
The argument value set, or the default value of the data type.
Note
The function does not tell whether the argument type is set. Use isSet() or getAbstractArgument() functions to find out whether the argument is set.
template<typename TDataType >
void kanzi::MethodArguments::setArgument ( const PropertyType< TDataType > &  argumentType,
typename PropertyType< TDataType >::DataType  value 
)
inline

Adds or updates the value for a given argument type.

Use it when the property type defining the metamethod argument is known at build time.

Parameters
argumentTypeThe abstract type of the argument to be set.
valueThe value of the argument type.
template<typename TDataType >
bool kanzi::MethodArguments::getAbstractArgument ( AbstractPropertyType  argumentType,
TDataType &  value 
)
inline

Retrieves an argument with the given argumentType into the value address.

Use it when the property type defining the metamethod argument is not known at build time.

Parameters
argumentTypeThe abstract type of the argument to be set.
valueThe value of the argument type.
Returns
true if the argument is set and the data type of the value matches the argument type.
template<typename TDataType >
void kanzi::MethodArguments::setAbstractArgument ( AbstractPropertyType  argumentType,
TDataType  value 
)
inline

Adds or updates the value for a given argument type.

Use it when the property type defining the metamethod argument is not known at build time.

Parameters
argumentTypeThe abstract type of the argument to be set.
valueThe value of the argument type.
bool kanzi::MethodArguments::isSet ( AbstractPropertyType  argumentType) const

Checks whether a given argument type is set.

Parameters
argumentTypeThe type of the argument whose presence is checked.
Returns
true if the argument type is defined, false otherwise.
size_t kanzi::MethodArguments::getCount ( ) const

Returns the number of arguments set, or 0 if none set.


The documentation for this class was generated from the following file: