Enumeration utility functions

Enumeration utility function provide run-time functions for handling enumerations defined within a schema. More...

Classes

struct  OSEnumItem
struct  OSNumericEnumItem
struct  OSNumericEnumItemU32
struct  OSNumericEnumItem64
struct  OSNumericEnumItemU64

Functions

EXTERNRT OSINT32 rtxLookupEnum (const OSUTF8CHAR *strValue, size_t strValueSize, const OSEnumItem enumTable[], OSUINT16 enumTableSize)
 This function will return the numeric value for the given enumerated identifier string.
EXTERNRT OSINT32 rtxLookupEnumByValue (OSINT32 value, const OSEnumItem enumTable[], size_t enumTableSize)
 Lookup enum by integer value.
EXTERNRT int rtxTestNumericEnum (OSINT32 ivalue, const OSNumericEnumItem enumTable[], OSUINT16 enumTableSize)
 This function determines if the given numeric enumerated value is within the defined numeration set.

Detailed Description

Enumeration utility function provide run-time functions for handling enumerations defined within a schema.


Function Documentation

EXTERNRT OSINT32 rtxLookupEnum ( const OSUTF8CHAR *  strValue,
size_t  strValueSize,
const OSEnumItem  enumTable[],
OSUINT16  enumTableSize 
)

This function will return the numeric value for the given enumerated identifier string.

Parameters:
strValue Enumerated identifier value
strValueSize Length of enumerated identifier
enumTable Table containing the defined enumeration
enumTableSize Number of rows in the table
Returns:
Index to enumerated item if found; otherwise, negative status code (RTERR_INVENUM).

EXTERNRT OSINT32 rtxLookupEnumByValue ( OSINT32  value,
const OSEnumItem  enumTable[],
size_t  enumTableSize 
)

Lookup enum by integer value.

Required for ASN.1 because enumerated values do not need to be sequential.

Parameters:
value Integer value of the enumerated item.
enumTable Table containing the defined enumeration
enumTableSize Number of rows in the table
Returns:
Index to enumerated item if found; otherwiae, negative status code (RTERR_INVENUM).

EXTERNRT int rtxTestNumericEnum ( OSINT32  ivalue,
const OSNumericEnumItem  enumTable[],
OSUINT16  enumTableSize 
)

This function determines if the given numeric enumerated value is within the defined numeration set.

Parameters:
ivalue Numeric enumerated value
enumTable Table containing the defined enumeration
enumTableSize Number of rows in the table
Returns:
Zero (0) if item in table, RTERR_INVENUM if not