PostScriptCalculatorFunction Class Documentation

classPostScriptCalculatorFunction : Function

Namespace:datalogics_interface

Inherits from:
Function

Detailed Description

A function represented as a stream containing code written in a small subset of the PostScript language.

Constructor & Destructor Documentation

PostScriptCalculatorFunction

PostScriptCalculatorFunction(const std::vector< double > &domain, const std::vector< double > &range, const std::string &code)

Parameters

domain: const std::vector< double > &

an array of 2 * m numbers, where m is the number of input values

range: const std::vector< double > &

an array of 2 * n numbers, where n is the number of output values

code: const std::string &

the code of the function, written in a subset of the PostScript language

Create PostScript calculator function, represented as a stream containing code written in a small subset of the PostScript language.

~PostScriptCalculatorFunction

~PostScriptCalculatorFunction()

Member Function Documentation

apply

std::vector< double >apply(const std::vector< double > &args)

Parameters

args: const std::vector< double > &

input values for the function. The number of input values must agree with the number of inputs the function takes.

Returns:

a list of the result values from the function

Apply the function to supplied input values

get_code

std::stringget_code()

Returns:

std::string

The code defines how input values are transformed into output values.

get_domain

std::vector< double >get_domain()

Returns:

std::vector< double >

Contains 2 * m elements, where m is the number of inputs to the function. Each successive pair of elements gives the minimum and maximum values for one of the inputs. Input values to the function are clamped to these minimum and maximum values.

get_n_inputs

intget_n_inputs()

Returns:

int

The number of inputs to the function.

get_n_outputs

intget_n_outputs()

Returns:

int

The number of outputs from the function.

set_domain

voidset_domain(const std::vector< double > &domain)

Parameters

domain: const std::vector< double > &

Returns:

void

Contains 2 * m elements, where m is the number of inputs to the function. Each successive pair of elements gives the minimum and maximum values for one of the inputs. Input values to the function are clamped to these minimum and maximum values.

to_string

std::stringto_string()

Returns:

A string representation of the PostScriptCalculatorFunction, including the number of inputs and outputs, domain, range, and the PostScript code.

A string value describing the function.