Class PVEnumerated

Class Documentation

class PVEnumerated

Methods for accessing an enumerated structure.

An enumerated structure has the following fields:

structure
    int index
    string[] choices
This class can be attached to an enumerated structure field of any PVData object. The methods provide access to the fields in the attached structure. This class should not be extended.

Public Functions

inline PVEnumerated()
bool attach(PVFieldPtr const &pvField)
void detach()

Detach for pvField.

bool isAttached()

Is the PVEnumerated attached to a pvField?

Returns

(false,true) (is not,is) attached to a pvField.

bool setIndex(int32 index)

Set the index.

Parameters

index – The new index.

Throws

if – not attached. The index will be changed even if it is out of range of size of choices.

int32 getIndex()

Get the index.

Throws

if – not attached.

Returns

The current index.

std::string getChoice()

Get the choice corresponding to current index.

Throws

if – not attached.

Returns

The choice. If index is out of range a null string is returned.

bool choicesMutable()

Can choices be changed?

Throws

if – not attached.

Returns

(false,true) if choices (can not, can) be changed.

inline PVStringArray::const_svector getChoices()

Get the choices.

Throws

if – not attached.

Returns

The current index.

int32 getNumberChoices()

Get the size of the choices array.

Throws

if – not attached.

Returns

The size.

bool setChoices(const StringArray &choices)

Get the choices.

Parameters

choices – The new value for choices.`

Throws

if – not attached.

Returns

(false,true) if choices (was not was) replaced.