Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::MethodArgument Class Reference

Holds argument type and value information. More...

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

Public Member Functions

template<typename TDataType >
optional< TDataType > get (const PropertyType< TDataType > &argumentType) const
 Returns the value of the argument. More...
 
template<typename TDataType >
bool get (AbstractPropertyType argumentType, TDataType &value) const
 Overloaded version of get() using AbstractPropertyType to retrieve the value. More...
 
AbstractPropertyType getType () const
 Returns the type of the argument. More...
 
bool isValid () const
 Returns true if the argument stores a valid value, false otherwise. More...
 
 MethodArgument ()
 Constructor. More...
 
template<typename TDataType >
 MethodArgument (const PropertyType< TDataType > &argumentType, typename PropertyType< TDataType >::DataType value)
 Creates an argument with a property type. More...
 
template<typename TDataType >
 MethodArgument (AbstractPropertyType argumentType, TDataType value)
 Creates an argument using an AbstractPropertyType. More...
 
 MethodArgument (const MethodArgument &other)
 Copy-constructor. More...
 
MethodArgumentoperator= (const MethodArgument &other)
 Assignment operator. More...
 
 ~MethodArgument ()
 Destructor. More...
 

Detailed Description

Holds argument type and value information.

The MethodArgument holds the type and value of a metamethod argument or the return value of the method. You can specify the value of the argument upon instantiation and retrieve it with one of the get() template function members.

Constructor & Destructor Documentation

kanzi::MethodArgument::MethodArgument ( )
explicit

Constructor.

kanzi::MethodArgument::~MethodArgument ( )

Destructor.

template<typename TDataType >
kanzi::MethodArgument::MethodArgument ( const PropertyType< TDataType > &  argumentType,
typename PropertyType< TDataType >::DataType  value 
)
inlineexplicit

Creates an argument with a property type.

Parameters
argumentTypeA property type defining the type of the argument.
valueThe value of the argument.
template<typename TDataType >
kanzi::MethodArgument::MethodArgument ( AbstractPropertyType  argumentType,
TDataType  value 
)
inlineexplicit

Creates an argument using an AbstractPropertyType.

The type of the value must match the type defined by the argumentType.

Parameters
argumentTypeAn abstract property type defining the type of the argument.
valueThe value of the argument.
kanzi::MethodArgument::MethodArgument ( const MethodArgument other)
inline

Copy-constructor.

Member Function Documentation

MethodArgument& kanzi::MethodArgument::operator= ( const MethodArgument other)
inline

Assignment operator.

template<typename TDataType >
optional<TDataType> kanzi::MethodArgument::get ( const PropertyType< TDataType > &  argumentType) const
inline

Returns the value of the argument.

The argumentType must match the type of the MethodArgument instance.

Parameters
argumentTypeType of the argument.
Returns
The value of the argument, or nullopt, if the argument is not valid or the argumentType and the stored type do not match.
template<typename TDataType >
bool kanzi::MethodArgument::get ( AbstractPropertyType  argumentType,
TDataType &  value 
) const
inline

Overloaded version of get() using AbstractPropertyType to retrieve the value.

Parameters
argumentTypeAbstractPropertyType defining the type of the argument.
valueThe address to store the argument value.
Returns
true if the argument can be retrieved, false if the argument is invalid, the argumentType differs from the type stored, or the type of the value differs from the type of the argument.
AbstractPropertyType kanzi::MethodArgument::getType ( ) const
inline

Returns the type of the argument.

bool kanzi::MethodArgument::isValid ( ) const
inline

Returns true if the argument stores a valid value, false otherwise.


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