HxmFunction Class

class HxmFunction

A function can be either a user-defined function or a built-in function. It is possible to create external functions from the modeler API and call them in the modeler. See HxmFunctor for more information on how to create external functions.

See:

HxmFunctor

Since:

10.0

Summary

Functions

getDeclaredName

Gets the name of the function.

call

Calls the function with no argument and returns the result.

call

Calls the function with the provided arguments and returns the result.

call

Calls the function with the provided arguments and returns the result.

call

Calls the function with the provided arguments.

callThis

Calls the function with no argument on the given object and returns the result.

callThis

Calls the function with the provided arguments on the given object and returns the result.

callThis

Calls the function with the provided arguments on the given object and returns the result.

asValue

Returns the function as an HxmValue.

Overloaded operators

HxmValue

Returns the function as an HxmValue.

Functions

std::string HxmFunction::getDeclaredName() const

Gets the name of the function. The name of the function does not necessarily reflect the name of the variable(s) to which the function is associated. The name is mainly used to identify the function in stack traces when exceptions occur.

HxmValue HxmFunction::call()

Calls the function with no argument and returns the result.

Returns:

Return value of the call.

See:

HxmValue

HxmValue HxmFunction::call(const std::vector<HxmValue> &arguments)

Calls the function with the provided arguments and returns the result.

Parameters:

arguments – List of arguments.

Returns:

Return value of the call.

See:

HxmValue

HxmValue HxmFunction::call(const HxmValue *arguments, int nbArguments)

Calls the function with the provided arguments and returns the result.

Parameters:
  • arguments – Pointer to the first argument.

  • nbArguments – Number of arguments.

Returns:

Return value of the call.

See:

HxmValue

template<typename T>
HxmValue HxmFunction::call(T begin, T end)

Calls the function with the provided arguments. The arguments must be iterators referencing HxmValues.

Parameters:
  • T – Type of an iterator referencing HxmValues.

  • begin – Iterator to the beginning of the arguments.

  • end – Iterator to the end of the arguments.

Returns:

Return value of the call.

See:

HxmValue

HxmValue HxmFunction::callThis(const HxmValue &self)

Calls the function with no argument on the given object and returns the result. Within the function, the this variable will be initialized to the supplied object.

Parameters:

self – The value to be used as the this variable.

Returns:

Return value of the call.

See:

HxmValue

HxmValue HxmFunction::callThis(const HxmValue &self, const std::vector<HxmValue> &arguments)

Calls the function with the provided arguments on the given object and returns the result. Within the function, the this variable will be initialized to the supplied object.

Parameters:
  • self – The value to be used as the this variable.

  • arguments – List of arguments.

Returns:

Return value of the call.

See:

HxmValue

template<typename T>
HxmValue HxmFunction::callThis(const HxmValue &self, T begin, T end)

Calls the function with the provided arguments on the given object and returns the result. Within the function, the this variable will be initialized to the supplied object. The arguments must be iterators referencing HxmValues.

Parameters:
  • T – Type of an iterator referencing HxmValues.

  • self – The value to be used as the this variable.

  • begin – Iterator to the beginning of the arguments.

  • end – Iterator to the end of the arguments.

Returns:

Return value of the call.

See:

HxmValue

HxmValue HxmFunction::asValue() const

Returns the function as an HxmValue.

See:

HxmValue

Overloaded operators

explicit operator HxmFunction::HxmValue() const

Returns the function as an HxmValue.

See:

HxmValue