nag_enum_value_to_name (x04nbc) (PDF version)
x04 Chapter Contents
x04 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_enum_value_to_name (x04nbc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_enum_value_to_name (x04nbc) returns the name of the NAG enumeration member given the enumeration member's value.

2  Specification

#include <nag.h>
#include <nagx04.h>
const char *  nag_enum_value_to_name (int enum_value)

3  Description

nag_enum_value_to_name (x04nbc) takes an integer argument, which must be the value of a NAG enumeration member and returns a string which is the name of that member (e.g., "Nag_ColMajor", "Nag_LogNormal", etc.). If the input value does not correspond to a NAG enumeration member then the function returns 0.
The reverse process of converting from enumeration member name to enumeration member value is also available using nag_enum_name_to_value (x04nac).
Converting enumeration members to and from name and value may be of use when saving a set of problem arguments to file or reading problem arguments from a file for use in an application. In the case of saving problem arguments, any enumeration members to be saved should be saved using their names to be subsequently read as strings. nag_enum_value_to_name (x04nbc) can be used to get enumeration member names for writing.

4  References

None.

5  Arguments

1:     enum_valueintInput
On entry: the value of a NAG enumeration member.

6  Error Indicators and Warnings

If the value 0 is returned then the input value is not recognized as a valid NAG enumeration member value.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

This example takes a set of NAG enumeration members and checks that the value used has a name that matches the member name.

9.1  Program Text

Program Text (x04nbce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (x04nbce.r)


nag_enum_value_to_name (x04nbc) (PDF version)
x04 Chapter Contents
x04 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012