normativeTypesCPP 6.0.2
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
23namespace epics { namespace nt {
24
25class NTEnum;
26typedef std::tr1::shared_ptr<NTEnum> NTEnumPtr;
27
28namespace detail {
29
37 class epicsShareClass NTEnumBuilder :
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:
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;
101 epics::pvData::FieldConstPtrArray extraFields;
102
103 friend class ::epics::nt::NTEnum;
104 };
105
106}
107
108typedef std::tr1::shared_ptr<detail::NTEnumBuilder> NTEnumBuilderPtr;
109
110
111
117class epicsShareClass NTEnum
118{
119public:
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(
182 epics::pvData::StructureConstPtr const &structure);
183
193 static bool isCompatible(
194 epics::pvData::PVStructurePtr const &pvStructure);
195
205 bool isValid();
206
211 static NTEnumBuilderPtr createBuilder();
212
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
264private:
265 NTEnum(epics::pvData::PVStructurePtr const & pvStructure);
266 epics::pvData::PVStructurePtr pvNTEnum;
267 epics::pvData::PVStructurePtr pvValue;
268
270};
271
272}}
273#endif /* NTENUM_H */
Convenience Class for NTEnum.
Definition ntenum.h:118
POINTER_DEFINITIONS(NTEnum)
static bool isCompatible(epics::pvData::PVStructurePtr const &pvStructure)
static const std::string URI
Definition ntenum.h:122
static bool is_a(epics::pvData::PVStructurePtr const &pvStructure)
static bool is_a(epics::pvData::StructureConstPtr const &structure)
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
Interface for in-line creating of NTEnum.
Definition ntenum.h:39
std::tr1::shared_ptr< NTEnum > NTEnumPtr
Definition ntenum.h:26
std::tr1::shared_ptr< detail::NTEnumBuilder > NTEnumBuilderPtr
Definition ntenum.h:108