This is Unofficial EPICS BASE Doxygen Site
ntenum.h
Go to the documentation of this file.
1 /* ntenum.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  */
6 #ifndef NTENUM_H
7 #define NTENUM_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define ntenumEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #ifdef ntenumEpicsExportSharedSymbols
15 # define epicsExportSharedSymbols
16 # undef ntenumEpicsExportSharedSymbols
17 #endif
18 
19 #include <pv/ntfield.h>
20 
21 #include <shareLib.h>
22 
23 namespace epics { namespace nt {
24 
25 class NTEnum;
26 typedef std::tr1::shared_ptr<NTEnum> NTEnumPtr;
27 
28 namespace detail {
29 
38  public std::tr1::enable_shared_from_this<NTEnumBuilder>
39  {
40  public:
42 
47  shared_pointer addDescriptor();
48 
53  shared_pointer addAlarm();
54 
59  shared_pointer addTimeStamp();
60 
66  epics::pvData::StructureConstPtr createStructure();
67 
73  epics::pvData::PVStructurePtr createPVStructure();
74 
80  NTEnumPtr create();
81 
88  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
89 
90  private:
91  NTEnumBuilder();
92 
93  void reset();
94 
95  bool descriptor;
96  bool alarm;
97  bool timeStamp;
98 
99  // NOTE: this preserves order, however it does not handle duplicates
100  epics::pvData::StringArray extraFieldNames;
102 
103  friend class ::epics::nt::NTEnum;
104  };
105 
106 }
107 
108 typedef std::tr1::shared_ptr<detail::NTEnumBuilder> NTEnumBuilderPtr;
109 
110 
111 
118 {
119 public:
121 
122  static const std::string URI;
123 
133  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
134 
144  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
145 
157  static bool is_a(epics::pvData::StructureConstPtr const & structure);
158 
170  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
171 
181  static bool isCompatible(
183 
193  static bool isCompatible(
194  epics::pvData::PVStructurePtr const &pvStructure);
195 
205  bool isValid();
206 
211  static NTEnumBuilderPtr createBuilder();
212 
216  ~NTEnum() {}
217 
224  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
225 
232  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
233 
238  epics::pvData::PVStructurePtr getPVStructure() const;
239 
244  epics::pvData::PVStringPtr getDescriptor() const;
245 
250  epics::pvData::PVStructurePtr getTimeStamp() const;
251 
256  epics::pvData::PVStructurePtr getAlarm() const;
257 
262  epics::pvData::PVStructurePtr getValue() const;
263 
264 private:
265  NTEnum(epics::pvData::PVStructurePtr const & pvStructure);
268 
269  friend class detail::NTEnumBuilder;
270 };
271 
272 }}
273 #endif /* NTENUM_H */
std::tr1::shared_ptr< detail::NTEnumBuilder > NTEnumBuilderPtr
Definition: ntenum.h:108
Convenience Class for NTEnum.
Definition: ntenum.h:117
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
Mark external symbols and entry points for shared libraries.
Interface for in-line creating of NTEnum.
Definition: ntenum.h:37
static const std::string URI
Definition: ntenum.h:122
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
Methods for accessing a timeStamp structure.
Definition: pvTimeStamp.h:38
#define epicsShareClass
Definition: shareLib.h:206
Methods for accessing an alarm structure.
Definition: pvAlarm.h:37
std::vector< FieldConstPtr > FieldConstPtrArray
Definition: pvIntrospect.h:146
std::tr1::shared_ptr< const Field > FieldConstPtr
Definition: pvIntrospect.h:137
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
std::tr1::shared_ptr< PVString > PVStringPtr
Definition: pvData.h:540
std::vector< std::string > StringArray
Definition: pvType.h:110
std::tr1::shared_ptr< NTEnum > NTEnumPtr
Definition: ntenum.h:25