normativeTypesCPP 6.0.2
ntndarray.h
Go to the documentation of this file.
1/* ntndarray.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 NTNDARRAY_H
7#define NTNDARRAY_H
8
9#include <vector>
10#include <string>
11
12#ifdef epicsExportSharedSymbols
13# define ntndarrayEpicsExportSharedSymbols
14# undef epicsExportSharedSymbols
15#endif
16
17#include <pv/pvDisplay.h>
18#include <pv/pvControl.h>
19
20#ifdef ntndarrayEpicsExportSharedSymbols
21# define epicsExportSharedSymbols
22# undef ntndarrayEpicsExportSharedSymbols
23#endif
24
25#include <pv/ntfield.h>
26
27#include <shareLib.h>
28
29namespace epics { namespace nt {
30
31class NTNDArray;
32typedef std::tr1::shared_ptr<NTNDArray> NTNDArrayPtr;
33
34namespace detail {
35
43 class epicsShareClass NTNDArrayBuilder :
44 public std::tr1::enable_shared_from_this<NTNDArrayBuilder>
45 {
46 public:
48
53 shared_pointer addDescriptor();
54
59 shared_pointer addAlarm();
60
65 shared_pointer addTimeStamp();
66
71 shared_pointer addDisplay();
72
78 epics::pvData::StructureConstPtr createStructure();
79
85 epics::pvData::PVStructurePtr createPVStructure();
86
92 NTNDArrayPtr create();
93
100 shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
101
102 private:
104
105 void reset();
106
107 bool descriptor;
108 bool timeStamp;
109 bool alarm;
110 bool display;
111
112 // NOTE: this preserves order, however it does not handle duplicates
113 epics::pvData::StringArray extraFieldNames;
114 epics::pvData::FieldConstPtrArray extraFields;
115
116 friend class ::epics::nt::NTNDArray;
117 };
118
119}
120
121typedef std::tr1::shared_ptr<detail::NTNDArrayBuilder> NTNDArrayBuilderPtr;
122
128class epicsShareClass NTNDArray
129{
130public:
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(
195 epics::pvData::StructureConstPtr const &structure);
196
205 static bool isCompatible(
206 epics::pvData::PVStructurePtr const &pvStructure);
207
217 bool isValid();
218
223 static NTNDArrayBuilderPtr createBuilder();
224
229
236 bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
237
244 bool attachDataTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
245
252 bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
253
258 epics::pvData::PVStructurePtr getPVStructure() const;
259
264 epics::pvData::PVUnionPtr getValue() const;
265
270 epics::pvData::PVStructurePtr getCodec() const;
271
276 epics::pvData::PVLongPtr getCompressedDataSize() const;
277
282 epics::pvData::PVLongPtr getUncompressedDataSize() const;
283
288 epics::pvData::PVStructureArrayPtr getDimension() const;
289
294 epics::pvData::PVIntPtr getUniqueId() const;
295
300 epics::pvData::PVStructurePtr getDataTimeStamp() const;
301
306 epics::pvData::PVStructureArrayPtr getAttribute() const;
307
312 epics::pvData::PVStringPtr getDescriptor() const;
313
318 epics::pvData::PVStructurePtr getTimeStamp() const;
319
324 epics::pvData::PVStructurePtr getAlarm() const;
325
332 bool attachDisplay(epics::pvData::PVDisplay &pvDisplay) const;
333
338 epics::pvData::PVStructurePtr getDisplay() const;
339
340private:
341 NTNDArray(epics::pvData::PVStructurePtr const & pvStructure);
342
343 epics::pvData::int64 getExpectedUncompressedSize();
344 epics::pvData::int64 getValueSize();
345 epics::pvData::int64 getValueTypeSize();
346
347 epics::pvData::PVStructurePtr pvNTNDArray;
348
350};
351
352}}
353#endif /* NTNDARRAY_H */
Convenience Class for NTNDArray.
Definition ntndarray.h:129
static bool isCompatible(epics::pvData::PVStructurePtr const &pvStructure)
static bool is_a(epics::pvData::PVStructurePtr const &pvStructure)
POINTER_DEFINITIONS(NTNDArray)
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
static bool is_a(epics::pvData::StructureConstPtr const &structure)
static const std::string URI
Definition ntndarray.h:133
Interface for in-line creating of NTNDArray.
Definition ntndarray.h:45
std::tr1::shared_ptr< detail::NTNDArrayBuilder > NTNDArrayBuilderPtr
Definition ntndarray.h:121
std::tr1::shared_ptr< NTNDArray > NTNDArrayPtr
Definition ntndarray.h:32