This is Unofficial EPICS BASE Doxygen Site
nthistogram.h
Go to the documentation of this file.
1 /* nthistogram.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 NTHISTOGRAM_H
7 #define NTHISTOGRAM_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define nthistogramEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #ifdef nthistogramEpicsExportSharedSymbols
15 # define epicsExportSharedSymbols
16 # undef nthistogramEpicsExportSharedSymbols
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<NTHistogram> NTHistogramPtr;
28 
29 namespace detail {
30 
39  public std::tr1::enable_shared_from_this<NTHistogramBuilder>
40  {
41  public:
43 
49  shared_pointer value(epics::pvData::ScalarType scalarType);
50 
55  shared_pointer addDescriptor();
56 
61  shared_pointer addAlarm();
62 
67  shared_pointer addTimeStamp();
68 
74  epics::pvData::StructureConstPtr createStructure();
75 
81  epics::pvData::PVStructurePtr createPVStructure();
82 
88  NTHistogramPtr create();
89 
96  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
97 
98  private:
100 
101  void reset();
102 
103  bool valueTypeSet;
104  epics::pvData::ScalarType valueType;
105 
106  bool descriptor;
107  bool alarm;
108  bool timeStamp;
109 
110  // NOTE: this preserves order, however it does not handle duplicates
111  epics::pvData::StringArray extraFieldNames;
113 
114  friend class ::epics::nt::NTHistogram;
115  };
116 
117 }
118 
119 typedef std::tr1::shared_ptr<detail::NTHistogramBuilder> NTHistogramBuilderPtr;
120 
121 
122 
129 {
130 public:
132 
133  static const std::string URI;
134 
146  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
147 
157  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
158 
170  static bool is_a(epics::pvData::StructureConstPtr const & structure);
171 
183  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
184 
194  static bool isCompatible(
196 
206  static bool isCompatible(
207  epics::pvData::PVStructurePtr const &pvStructure);
208 
218  bool isValid();
219 
224  static NTHistogramBuilderPtr createBuilder();
225 
230 
237  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
238 
245  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
246 
251  epics::pvData::PVStructurePtr getPVStructure() const;
252 
257  epics::pvData::PVStringPtr getDescriptor() const;
258 
263  epics::pvData::PVStructurePtr getTimeStamp() const;
264 
269  epics::pvData::PVStructurePtr getAlarm() const;
270 
275  epics::pvData::PVDoubleArrayPtr getRanges() const;
276 
281  epics::pvData::PVScalarArrayPtr getValue() const;
282 
289  template<typename PVT>
290  std::tr1::shared_ptr<PVT> getValue() const
291  {
292  return std::tr1::dynamic_pointer_cast<PVT>(pvValue);
293  }
294 
295 
296 private:
297  NTHistogram(epics::pvData::PVStructurePtr const & pvStructure);
298  epics::pvData::PVStructurePtr pvNTHistogram;
300 
302 };
303 
304 }}
305 #endif /* NTHISTOGRAM_H */
static const std::string URI
Definition: nthistogram.h:133
Definition: link.h:174
std::tr1::shared_ptr< detail::NTHistogramBuilder > NTHistogramBuilderPtr
Definition: nthistogram.h:119
Convenience Class for NTHistogram.
Definition: nthistogram.h:128
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.
#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< NTHistogram > NTHistogramPtr
Definition: nthistogram.h:26
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
Interface for in-line creating of NTHistogram.
Definition: nthistogram.h:38
std::tr1::shared_ptr< PVDoubleArray > PVDoubleArrayPtr
Definition: pvData.h:1461
std::tr1::shared_ptr< PVT > getValue() const
Definition: nthistogram.h:290