This is Unofficial EPICS BASE Doxygen Site
ntunion.h
Go to the documentation of this file.
1 /* ntunion.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 NTUNION_H
7 #define NTUNION_H
8 
9 #ifdef epicsExportSharedSymbols
10 # define ntunionEpicsExportSharedSymbols
11 # undef epicsExportSharedSymbols
12 #endif
13 
14 #ifdef ntunionEpicsExportSharedSymbols
15 # define epicsExportSharedSymbols
16 # undef ntunionEpicsExportSharedSymbols
17 #endif
18 
19 #include <pv/ntfield.h>
20 
21 #include <shareLib.h>
22 
23 namespace epics { namespace nt {
24 
25 class NTUnion;
26 typedef std::tr1::shared_ptr<NTUnion> NTUnionPtr;
27 
28 namespace detail {
29 
38  public std::tr1::enable_shared_from_this<NTUnionBuilder>
39  {
40  public:
42 
49  shared_pointer value(epics::pvData::UnionConstPtr unionType);
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  NTUnionPtr create();
95  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
96 
97  private:
99 
101 
102  void reset();
103 
104  bool descriptor;
105  bool alarm;
106  bool timeStamp;
107 
108  // NOTE: this preserves order, however it does not handle duplicates
109  epics::pvData::StringArray extraFieldNames;
111 
112  friend class ::epics::nt::NTUnion;
113  };
114 
115 }
116 
117 typedef std::tr1::shared_ptr<detail::NTUnionBuilder> NTUnionBuilderPtr;
118 
119 
120 
127 {
128 public:
130 
131  static const std::string URI;
132 
144  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
145 
154  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
155 
167  static bool is_a(epics::pvData::StructureConstPtr const & structure);
168 
180  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
181 
190  static bool isCompatible(
192 
201  static bool isCompatible(
202  epics::pvData::PVStructurePtr const &pvStructure);
203 
212  bool isValid();
213 
218  static NTUnionBuilderPtr createBuilder();
219 
223  ~NTUnion() {}
224 
231  bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
232 
239  bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
240 
245  epics::pvData::PVStructurePtr getPVStructure() const;
246 
251  epics::pvData::PVStringPtr getDescriptor() const;
252 
257  epics::pvData::PVStructurePtr getTimeStamp() const;
258 
263  epics::pvData::PVStructurePtr getAlarm() const;
264 
269  epics::pvData::PVUnionPtr getValue() const;
270 
271 private:
272  NTUnion(epics::pvData::PVStructurePtr const & pvStructure);
275 
277 };
278 
279 }}
280 #endif /* NTUNION_H */
Definition: link.h:174
Interface for in-line creating of NTUnion.
Definition: ntunion.h:37
Convenience Class for NTUnion.
Definition: ntunion.h:126
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.
std::tr1::shared_ptr< PVUnion > PVUnionPtr
Definition: pvData.h:107
std::tr1::shared_ptr< const Union > UnionConstPtr
Definition: pvIntrospect.h:170
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
Methods for accessing a timeStamp structure.
Definition: pvTimeStamp.h:38
#define epicsShareClass
Definition: shareLib.h:206
static const std::string URI
Definition: ntunion.h:131
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< NTUnion > NTUnionPtr
Definition: ntunion.h:25
std::tr1::shared_ptr< detail::NTUnionBuilder > NTUnionBuilderPtr
Definition: ntunion.h:117