Program Listing for File pvEnumerated.h¶
↰ Return to documentation for file (src/property/pv/pvEnumerated.h)
/* pvEnumerated.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#ifndef PVENUMERATED_H
#define PVENUMERATED_H
#include <string>
#include <pv/pvType.h>
#include <pv/pvData.h>
#include <shareLib.h>
namespace epics { namespace pvData {
class epicsShareClass PVEnumerated {
public:
/*
* Constructor.
*/
PVEnumerated() {}
//default constructors and destructor are OK
//This class should not be extended
//returns (false,true) if pvField(is not, is) a valid enumerated structure
//An automatic detach is issued if already attached.
/*
* Attach to a field of a PVData object.
* @param pvField The pvField.
* @return (false,true) if the pvField (is not, is) an enumerated structure.
*/
bool attach(PVFieldPtr const & pvField);
void detach();
bool isAttached();
// each of the following throws logic_error is not attached to PVField
// a set returns false if field is immutable
bool setIndex(int32 index);
int32 getIndex();
std::string getChoice();
bool choicesMutable();
inline PVStringArray::const_svector getChoices(){return pvChoices->view();}
int32 getNumberChoices();
bool setChoices(const StringArray & choices);
private:
static std::string notFound;
static std::string notAttached;
PVIntPtr pvIndex;
PVStringArrayPtr pvChoices;
};
}}
#endif /* PVENUMERATED_H */