This is Unofficial EPICS BASE Doxygen Site
pvEnumerated.h
Go to the documentation of this file.
1 /* pvEnumerated.h */
2 /*
3  * Copyright information and license terms for this software can be
4  * found in the file LICENSE that is included with the distribution
5  */
9 #ifndef PVENUMERATED_H
10 #define PVENUMERATED_H
11 
12 #include <string>
13 
14 #include <pv/pvType.h>
15 #include <pv/pvData.h>
16 
17 #include <shareLib.h>
18 
19 namespace epics { namespace pvData {
20 
35 public:
36  /*
37  * Constructor.
38  */
40  //default constructors and destructor are OK
41  //This class should not be extended
42  //returns (false,true) if pvField(is not, is) a valid enumerated structure
43  //An automatic detach is issued if already attached.
44  /*
45  * Attach to a field of a PVData object.
46  * @param pvField The pvField.
47  * @return (false,true) if the pvField (is not, is) an enumerated structure.
48  */
49  bool attach(PVFieldPtr const & pvField);
53  void detach();
58  bool isAttached();
59  // each of the following throws logic_error is not attached to PVField
60  // a set returns false if field is immutable
67  bool setIndex(int32 index);
73  int32 getIndex();
79  std::string getChoice();
85  bool choicesMutable();
91  inline PVStringArray::const_svector getChoices(){return pvChoices->view();}
97  int32 getNumberChoices();
104  bool setChoices(const StringArray & choices);
105 private:
106  static std::string notFound;
107  static std::string notAttached;
108  PVIntPtr pvIndex;
109  PVStringArrayPtr pvChoices;
110 };
111 
112 }}
113 #endif /* PVENUMERATED_H */
std::tr1::shared_ptr< PVInt > PVIntPtr
Definition: pvData.h:507
Methods for accessing an enumerated structure.
Definition: pvEnumerated.h:34
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
Mark external symbols and entry points for shared libraries.
std::tr1::shared_ptr< PVStringArray > PVStringArrayPtr
Definition: pvData.h:1464
#define epicsShareClass
Definition: shareLib.h:206
std::vector< std::string > StringArray
Definition: pvType.h:110
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
PVStringArray::const_svector getChoices()
Definition: pvEnumerated.h:91
int32_t int32
Definition: pvType.h:83