This is Unofficial EPICS BASE Doxygen Site
ntnameValue.h
Go to the documentation of this file.
1 /* ntnameValue.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 NTNAMEVALUE_H
7 #define NTNAMEVALUE_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define ntnameValueEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #include <pv/pvDisplay.h>
15 #include <pv/pvControl.h>
16 
17 #ifdef ntnameValueEpicsExportSharedSymbols
18 # define epicsExportSharedSymbols
19 # undef ntnameValueEpicsExportSharedSymbols
20 #endif
21 
22 #include <pv/ntfield.h>
23 
24 #include <shareLib.h>
25 
26 namespace epics { namespace nt {
27 
29 typedef std::tr1::shared_ptr<NTNameValue> NTNameValuePtr;
30 
31 namespace detail {
32 
41  public std::tr1::enable_shared_from_this<NTNameValueBuilder>
42  {
43  public:
45 
51  shared_pointer value(epics::pvData::ScalarType scalarType);
52 
57  shared_pointer addDescriptor();
58 
63  shared_pointer addAlarm();
64 
69  shared_pointer addTimeStamp();
70 
76  epics::pvData::StructureConstPtr createStructure();
77 
83  epics::pvData::PVStructurePtr createPVStructure();
84 
90  NTNameValuePtr create();
91 
98  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
99 
100  private:
102 
103  void reset();
104 
105  bool valueTypeSet;
106  epics::pvData::ScalarType valueType;
107 
108  bool descriptor;
109  bool alarm;
110  bool timeStamp;
111 
112  // NOTE: this preserves order, however it does not handle duplicates
113  epics::pvData::StringArray extraFieldNames;
115 
116  friend class ::epics::nt::NTNameValue;
117  };
118 
119 }
120 
121 typedef std::tr1::shared_ptr<detail::NTNameValueBuilder> NTNameValueBuilderPtr;
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 
182  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
183 
192  static bool isCompatible(
194 
204  static bool isCompatible(
205  epics::pvData::PVStructurePtr const &pvStructure);
206 
216  bool isValid();
217 
222  static NTNameValueBuilderPtr createBuilder();
223 
228 
235  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
236 
243  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
244 
249  epics::pvData::PVStructurePtr getPVStructure() const;
250 
255  epics::pvData::PVStringPtr getDescriptor() const;
256 
261  epics::pvData::PVStructurePtr getTimeStamp() const;
262 
267  epics::pvData::PVStructurePtr getAlarm() const;
268 
273  epics::pvData::PVStringArrayPtr getName() const;
274 
279  epics::pvData::PVFieldPtr getValue() const;
280 
288  template<typename PVT>
289  std::tr1::shared_ptr<PVT> getValue() const
290  {
291  epics::pvData::PVFieldPtr pvField = getValue();
292  if (pvField.get())
293  return std::tr1::dynamic_pointer_cast<PVT>(pvField);
294  else
295  return std::tr1::shared_ptr<PVT>();
296  }
297 
298 private:
299  NTNameValue(epics::pvData::PVStructurePtr const & pvStructure);
300  epics::pvData::PVStructurePtr pvNTNameValue;
302 };
303 
304 }}
305 #endif /* NTNAMEVALUE_H */
Interface for in-line creating of NTNameValue.
Definition: ntnameValue.h:40
std::tr1::shared_ptr< NTNameValue > NTNameValuePtr
Definition: ntnameValue.h:28
Definition: link.h:174
static const std::string URI
Definition: ntnameValue.h:133
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< PVT > getValue() const
Definition: ntnameValue.h:289
Mark external symbols and entry points for shared libraries.
std::tr1::shared_ptr< PVStringArray > PVStringArrayPtr
Definition: pvData.h:1464
std::tr1::shared_ptr< detail::NTNameValueBuilder > NTNameValueBuilderPtr
Definition: ntnameValue.h:121
#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< PVField > PVFieldPtr
Definition: pvData.h:66
Convenience Class for NTNameValue.
Definition: ntnameValue.h:128