# PostScriptCalculatorFunction Class

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

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PostScriptCalculatorFunction
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class PostScriptCalculatorFunction : Function
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`Function`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Function.md)

## Description

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

## Constructors

### PostScriptCalculatorFunction

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

*constructor*

**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

```cpp
datalogics_interface::PostScriptCalculatorFunction::PostScriptCalculatorFunction(PostScriptCalculatorFunction &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`PostScriptCalculatorFunction &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PostScriptCalculatorFunction.md))

### ~PostScriptCalculatorFunction

```cpp
datalogics_interface::PostScriptCalculatorFunction::~PostScriptCalculatorFunction() override
```

*destructor*

## Methods

### apply

```cpp
std::vector< double > datalogics_interface::Function::apply(const std::vector< double > &args) const
```

**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:** `std::vector< double >`

a list of the result values from the function

Apply the function to supplied input values

### get_code

```cpp
std::string datalogics_interface::PostScriptCalculatorFunction::get_code() const
```

**Returns:** `std::string`

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

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

### get_domain

```cpp
std::vector< double > datalogics_interface::Function::get_domain() const
```

**Returns:** `std::vector< double >`

The domain of the function.

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

```cpp
int datalogics_interface::Function::get_n_inputs() const
```

**Returns:** `int`

The number of inputs to the function.

### get_n_outputs

```cpp
int datalogics_interface::Function::get_n_outputs() const
```

**Returns:** `int`

The number of outputs from the function.

### operator=

```cpp
PostScriptCalculatorFunction & datalogics_interface::PostScriptCalculatorFunction::operator=(PostScriptCalculatorFunction &&) noexcept
```

**Parameters**

- (unnamed) ([`PostScriptCalculatorFunction &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PostScriptCalculatorFunction.md))

**Returns:** [`PostScriptCalculatorFunction &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PostScriptCalculatorFunction.md)

### set_domain

```cpp
void datalogics_interface::Function::set_domain(const std::vector< double > &domain)
```

**Parameters**

- `domain` (`const std::vector< double > &`)

**Returns:** `void`

The domain of the function.

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

```cpp
std::string datalogics_interface::PostScriptCalculatorFunction::to_string() const override
```

**Returns:** `std::string`

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.
