normativeTypesCPP 6.0.2
ntattribute.h
Go to the documentation of this file.
1/* ntattribute.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 NTATTRIBUTE_H
7#define NTATTRIBUTE_H
8
9#ifdef epicsExportSharedSymbols
10# define ntattributeEpicsExportSharedSymbols
11# undef epicsExportSharedSymbols
12#endif
13
14#ifdef ntattributeEpicsExportSharedSymbols
15# define epicsExportSharedSymbols
16# undef ntattributeEpicsExportSharedSymbols
17#endif
18
19#include <pv/ntfield.h>
20
21#include <shareLib.h>
22
23namespace epics { namespace nt {
24
25class NTAttribute;
26typedef std::tr1::shared_ptr<NTAttribute> NTAttributePtr;
27
28namespace detail {
29
37 class epicsShareClass NTAttributeBuilder :
38 public std::tr1::enable_shared_from_this<NTAttributeBuilder>
39 {
40 public:
42
47 shared_pointer addTags();
48
53 shared_pointer addDescriptor();
54
59 shared_pointer addAlarm();
60
65 shared_pointer addTimeStamp();
66
72 epics::pvData::StructureConstPtr createStructure();
73
79 epics::pvData::PVStructurePtr createPVStructure();
80
86 NTAttributePtr create();
87
94 shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
95
96 protected://private:
98
99 void reset();
100
101 bool tags;
103 bool alarm;
105
106 // NOTE: this preserves order, however it does not handle duplicates
107 epics::pvData::StringArray extraFieldNames;
108 epics::pvData::FieldConstPtrArray extraFields;
109
110 friend class ::epics::nt::NTAttribute;
111 };
112
113}
114
115typedef std::tr1::shared_ptr<detail::NTAttributeBuilder> NTAttributeBuilderPtr;
116
117
118
124class epicsShareClass NTAttribute
125{
126public:
128
129 static const std::string URI;
130
142 static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
143
153 static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
154
166 static bool is_a(epics::pvData::StructureConstPtr const & structure);
167
179 static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
180
190 static bool isCompatible(
191 epics::pvData::StructureConstPtr const &structure);
192
202 static bool isCompatible(
203 epics::pvData::PVStructurePtr const &pvStructure);
204
214 bool isValid();
215
220 static NTAttributeBuilderPtr createBuilder();
221
226
233 bool attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
234
241 bool attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
242
247 epics::pvData::PVStructurePtr getPVStructure() const;
248
253 epics::pvData::PVStringPtr getDescriptor() const;
254
259 epics::pvData::PVStructurePtr getTimeStamp() const;
260
265 epics::pvData::PVStructurePtr getAlarm() const;
266
271 epics::pvData::PVStringPtr getName() const;
272
277 epics::pvData::PVUnionPtr getValue() const;
278
283 epics::pvData::PVStringArrayPtr getTags() const;
284
285private:
286 NTAttribute(epics::pvData::PVStructurePtr const & pvStructure);
287 epics::pvData::PVStructurePtr pvNTAttribute;
288 epics::pvData::PVUnionPtr pvValue;
289
291};
292
293}}
294#endif /* NTATTRIBUTE_H */
Convenience Class for NTAttribute.
static bool isCompatible(epics::pvData::PVStructurePtr const &pvStructure)
static bool is_a(epics::pvData::PVStructurePtr const &pvStructure)
POINTER_DEFINITIONS(NTAttribute)
static const std::string URI
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
static bool is_a(epics::pvData::StructureConstPtr const &structure)
Interface for in-line creating of NTAttribute.
Definition ntattribute.h:39
epics::pvData::StringArray extraFieldNames
POINTER_DEFINITIONS(NTAttributeBuilder)
epics::pvData::FieldConstPtrArray extraFields
std::tr1::shared_ptr< detail::NTAttributeBuilder > NTAttributeBuilderPtr
std::tr1::shared_ptr< NTAttribute > NTAttributePtr
Definition ntattribute.h:26