# NAG CPP Interfacenagcpp::opt::handle_opt_get (e04zn)

## 1Purpose

handle_opt_get is an option getting function for all solvers from the NAG optimization modelling suite. It is used to query the value of optional parameters.

## 2Specification

```#include "e04/nagcpp_e04zn.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM>

void function handle_opt_get(COMM &comm, const string optstr, types::f77_integer &ivalue, double &rvalue, string &cvalue, types::f77_integer &optype, OptionalE04ZN opt)```
```template <typename COMM>

void function handle_opt_get(COMM &comm, const string optstr, types::f77_integer &ivalue, double &rvalue, string &cvalue, types::f77_integer &optype)```

## 3Description

handle_opt_get is used to query the current values of options. It can be especially useful to retrieve the optional parameters left for automatic choice by the solver.
This function will normally return either an integer, real or character value dependent upon the type associated with the optional parameter being queried. This is indicated by the returned value of optype.
Information relating to available option names is given in the documentation of the particular solver. See also Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

## 5Arguments

1: $\mathbf{comm}$CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: $\mathbf{optstr}$string Input
On entry: a string identifying the option whose current value is required. See the documentation of the particular solver for information on valid options.
3: $\mathbf{ivalue}$types::f77_integer Output
On exit: if the optional parameter supplied in optstr is an integer-valued parameter, ivalue will hold its current value.
4: $\mathbf{rvalue}$double Output
On exit: if the optional parameter supplied in optstr is a real-valued parameter, rvalue will hold its current value.
5: $\mathbf{cvalue}$string Output
Note: the string returned in cvalue will never exceed $40$ characters in length.
On exit: if the optional parameter supplied in optstr is a character-valued parameter, cvalue will hold its current value.
6: $\mathbf{optype}$types::f77_integer Output
On exit: indicates whether the optional parameter supplied in optstr is an integer, real or character-valued parameter and hence which of ivalue, rvalue or cvalue holds the current value.
${\mathbf{optype}}=1$
optstr is an integer-valued optional parameter; its current value has been returned in ivalue.
${\mathbf{optype}}=2$
optstr is a real-valued optional parameter; its current value has been returned in rvalue.
${\mathbf{optype}}=3$
optstr is a character-valued optional parameter; its current value has been returned in cvalue.
7: $\mathbf{opt}$OptionalE04ZN Input/Output
Optional parameter container, derived from Optional.

## 6Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=1$
comm::handle has not been initialized.
$\mathbf{errorid}=1$
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
$\mathbf{errorid}=1$
comm::handle has not been initialized properly or is corrupted.
$\mathbf{errorid}=11$
On entry, the $\mathit{option}$ supplied in optstr was not recognized:
${\mathbf{optstr}}=⟨\mathit{value}⟩$.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.
Raises: WarningException
$\mathbf{errorid}=41$
On entry, optstr indicates a character option, but cvalue is
too short to hold the stored value. The returned value will be truncated.

Not applicable.

## 8Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.