This is Unofficial EPICS BASE Doxygen Site
ntscalarArray.h
Go to the documentation of this file.
1 /* ntscalarArray.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 NTSCALARARRAY_H
7 #define NTSCALARARRAY_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define ntscalarArrayEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #include <pv/pvDisplay.h>
15 #include <pv/pvControl.h>
16 
17 #ifdef ntscalarArrayEpicsExportSharedSymbols
18 # define epicsExportSharedSymbols
19 # undef ntscalarArrayEpicsExportSharedSymbols
20 #endif
21 
22 #include <pv/ntfield.h>
23 
24 #include <shareLib.h>
25 
26 
27 namespace epics { namespace nt {
28 
30 typedef std::tr1::shared_ptr<NTScalarArray> NTScalarArrayPtr;
31 
32 namespace detail {
33 
42  public std::tr1::enable_shared_from_this<NTScalarArrayBuilder>
43  {
44  public:
46 
52  shared_pointer value(epics::pvData::ScalarType elementType);
53 
60  shared_pointer arrayValue(epics::pvData::ScalarType elementType);
61 
66  shared_pointer addDescriptor();
67 
72  shared_pointer addAlarm();
73 
78  shared_pointer addTimeStamp();
79 
84  shared_pointer addDisplay();
85 
90  shared_pointer addControl();
91 
97  epics::pvData::StructureConstPtr createStructure();
98 
104  epics::pvData::PVStructurePtr createPVStructure();
105 
111  NTScalarArrayPtr create();
112 
119  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
120 
121  private:
123 
124  void reset();
125 
126  bool valueTypeSet;
127  epics::pvData::ScalarType valueType;
128 
129  bool descriptor;
130  bool alarm;
131  bool timeStamp;
132  bool display;
133  bool control;
134 
135  // NOTE: this preserves order, however it does not handle duplicates
136  epics::pvData::StringArray extraFieldNames;
138 
139  friend class ::epics::nt::NTScalarArray;
140  };
141 
142 }
143 
144 typedef std::tr1::shared_ptr<detail::NTScalarArrayBuilder> NTScalarArrayBuilderPtr;
145 
146 
147 
154 {
155 public:
157 
158  static const std::string URI;
159 
171  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
172 
182  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
183 
195  static bool is_a(epics::pvData::StructureConstPtr const & structure);
196 
208  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
209 
219  static bool isCompatible(
221 
231  static bool isCompatible(
232  epics::pvData::PVStructurePtr const &pvStructure);
233 
242  bool isValid();
243 
248  static NTScalarArrayBuilderPtr createBuilder();
249 
254 
261  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
262 
269  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
270 
277  bool attachDisplay(epics::pvData::PVDisplay &pvDisplay) const;
278 
285  bool attachControl(epics::pvData::PVControl &pvControl) const;
286 
291  epics::pvData::PVStructurePtr getPVStructure() const;
292 
297  epics::pvData::PVStringPtr getDescriptor() const;
298 
303  epics::pvData::PVStructurePtr getTimeStamp() const;
304 
309  epics::pvData::PVStructurePtr getAlarm() const;
310 
315  epics::pvData::PVStructurePtr getDisplay() const;
316 
321  epics::pvData::PVStructurePtr getControl() const;
322 
327  epics::pvData::PVFieldPtr getValue() const;
328 
335  template<typename PVT>
336  std::tr1::shared_ptr<PVT> getValue() const
337  {
338  return std::tr1::dynamic_pointer_cast<PVT>(pvValue);
339  }
340 
341 private:
342  NTScalarArray(epics::pvData::PVStructurePtr const & pvStructure);
343  epics::pvData::PVStructurePtr pvNTScalarArray;
345 
347 };
348 
349 }}
350 #endif /* NTSCALARARRAY_H */
Definition: link.h:174
Methods for accessing an control structure.
Definition: pvControl.h:34
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
std::tr1::shared_ptr< NTScalarArray > NTScalarArrayPtr
Definition: ntscalarArray.h:29
std::tr1::shared_ptr< PVT > getValue() const
Mark external symbols and entry points for shared libraries.
std::tr1::shared_ptr< detail::NTScalarArrayBuilder > NTScalarArrayBuilderPtr
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
static const std::string URI
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
Convenience Class for NTScalarArray.
std::vector< std::string > StringArray
Definition: pvType.h:110
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
Methods for accessing an display structure.
Definition: pvDisplay.h:39
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
Interface for in-line creating of NTScalarArray.
Definition: ntscalarArray.h:41