normativeTypesCPP
ntcontinuum.h
Go to the documentation of this file.
1 /* ntcontinuum.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 NTCONTINUUM_H
7 #define NTCONTINUUM_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define ntcontinuumEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #ifdef ntcontinuumEpicsExportSharedSymbols
15 # define epicsExportSharedSymbols
16 # undef ntcontinuumEpicsExportSharedSymbols
17 #endif
18 
19 #include <pv/ntfield.h>
20 
21 #include <shareLib.h>
22 
23 
24 namespace epics { namespace nt {
25 
27 typedef std::tr1::shared_ptr<NTContinuum> NTContinuumPtr;
28 
29 namespace detail {
30 
38  class epicsShareClass NTContinuumBuilder :
39  public std::tr1::enable_shared_from_this<NTContinuumBuilder>
40  {
41  public:
42  POINTER_DEFINITIONS(NTContinuumBuilder);
43 
48  shared_pointer addDescriptor();
49 
54  shared_pointer addAlarm();
55 
60  shared_pointer addTimeStamp();
61 
67  epics::pvData::StructureConstPtr createStructure();
68 
74  epics::pvData::PVStructurePtr createPVStructure();
75 
81  NTContinuumPtr create();
82 
89  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
90 
91  private:
93 
94  void reset();
95 
96  bool descriptor;
97  bool alarm;
98  bool timeStamp;
99 
100  // NOTE: this preserves order, however it does not handle duplicates
101  epics::pvData::StringArray extraFieldNames;
102  epics::pvData::FieldConstPtrArray extraFields;
103 
104  friend class ::epics::nt::NTContinuum;
105  };
106 
107 }
108 
109 typedef std::tr1::shared_ptr<detail::NTContinuumBuilder> NTContinuumBuilderPtr;
110 
111 
112 
118 class epicsShareClass NTContinuum
119 {
120 public:
121  POINTER_DEFINITIONS(NTContinuum);
122 
123  static const std::string URI;
124 
136  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
137 
147  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
148 
160  static bool is_a(epics::pvData::StructureConstPtr const & structure);
161 
173  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
174 
184  static bool isCompatible(
185  epics::pvData::StructureConstPtr const &structure);
186 
196  static bool isCompatible(
197  epics::pvData::PVStructurePtr const &pvStructure);
198 
208  bool isValid();
209 
214  static NTContinuumBuilderPtr createBuilder();
215 
220 
227  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
228 
235  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
236 
241  epics::pvData::PVStructurePtr getPVStructure() const;
242 
247  epics::pvData::PVStringPtr getDescriptor() const;
248 
253  epics::pvData::PVStructurePtr getTimeStamp() const;
254 
259  epics::pvData::PVStructurePtr getAlarm() const;
260 
265  epics::pvData::PVDoubleArrayPtr getBase() const;
266 
271  epics::pvData::PVDoubleArrayPtr getValue() const;
272 
277  epics::pvData::PVStringArrayPtr getUnits() const;
278 
279 private:
280  NTContinuum(epics::pvData::PVStructurePtr const & pvStructure);
281  epics::pvData::PVStructurePtr pvNTContinuum;
282  epics::pvData::PVDoubleArrayPtr pvValue;
283 
285 };
286 
287 }}
288 #endif /* NTCONTINUUM_H */
std::tr1::shared_ptr< detail::NTContinuumBuilder > NTContinuumBuilderPtr
Definition: ntcontinuum.h:109
Convenience Class for NTContinuum.
Definition: ntcontinuum.h:118
Interface for in-line creating of NTContinuum.
Definition: ntcontinuum.h:38
static const std::string URI
Definition: ntcontinuum.h:123
std::tr1::shared_ptr< NTContinuum > NTContinuumPtr
Definition: ntcontinuum.h:26