This page is for an old version of Hexaly Optimizer. We recommend that you update your version and read the documentation for the latest stable release.

LSPFunction Class

class LSPFunction

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 LSPFunctor for more information on how to create external functions.

See

LSPFunctor

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.

asValue

Returns the function as an LSPValue.

Overloaded operators

LSPValue

Returns the function as an LSPValue.

Functions

std::string LSPFunction::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.

LSPValue LSPFunction::call()

Calls the function with no argument and returns the result.

Returns

Return value of the call.

LSPValue LSPFunction::call(const std::vector<LSPValue> &arguments)

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

Parameters

arguments – List of arguments.

Returns

Return value of the call.

LSPValue LSPFunction::call(const LSPValue *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.

template<typename T>
LSPValue LSPFunction::call(T begin, T end)

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

Parameters
  • T – Type of an iterator referencing LSPValues.

  • begin – Iterator to the beginning of the arguments.

  • end – Iterator to the end of the arguments.

Returns

Return value of the call.

LSPValue LSPFunction::asValue() const

Returns the function as an LSPValue.

See

LSPValue

Overloaded operators

explicit operator LSPFunction::LSPValue() const

Returns the function as an LSPValue.

See

LSPValue