This is Unofficial EPICS BASE Doxygen Site
epics::nt::NTAttribute Class Reference

Convenience Class for NTAttribute. More...

#include "ntattribute.h"

Public Member Functions

 POINTER_DEFINITIONS (NTAttribute)
 
bool isValid ()
 
 ~NTAttribute ()
 
bool attachTimeStamp (epics::pvData::PVTimeStamp &pvTimeStamp) const
 
bool attachAlarm (epics::pvData::PVAlarm &pvAlarm) const
 
epics::pvData::PVStructurePtr getPVStructure () const
 
epics::pvData::PVStringPtr getDescriptor () const
 
epics::pvData::PVStructurePtr getTimeStamp () const
 
epics::pvData::PVStructurePtr getAlarm () const
 
epics::pvData::PVStringPtr getName () const
 
epics::pvData::PVUnionPtr getValue () const
 
epics::pvData::PVStringArrayPtr getTags () const
 

Static Public Member Functions

static shared_pointer wrap (epics::pvData::PVStructurePtr const &pvStructure)
 
static shared_pointer wrapUnsafe (epics::pvData::PVStructurePtr const &pvStructure)
 
static bool is_a (epics::pvData::StructureConstPtr const &structure)
 
static bool is_a (epics::pvData::PVStructurePtr const &pvStructure)
 
static bool isCompatible (epics::pvData::StructureConstPtr const &structure)
 
static bool isCompatible (epics::pvData::PVStructurePtr const &pvStructure)
 
static NTAttributeBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTAttributeBuilder
 

Detailed Description

Convenience Class for NTAttribute.

Author
dgh

Definition at line 124 of file ntattribute.h.

Constructor & Destructor Documentation

epics::nt::NTAttribute::~NTAttribute ( )
inline

Destructor.

Definition at line 225 of file ntattribute.h.

225 {}

Member Function Documentation

bool epics::nt::NTAttribute::attachAlarm ( epics::pvData::PVAlarm pvAlarm) const

Attaches a PVAlarm to the wrapped PVStructure. Does nothing if no alarm field.

Parameters
pvAlarmthe PVAlarm that will be attached.
Returns
true if the operation was successfull (i.e. this instance has an alarm field), otherwise false.

Definition at line 177 of file ntattribute.cpp.

178 {
179  PVStructurePtr al = getAlarm();
180  if (al)
181  return pvAlarm.attach(al);
182  else
183  return false;
184 }
bool attach(PVFieldPtr const &pvField)
Definition: pvAlarm.cpp:26
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::PVStructurePtr getAlarm() const
bool epics::nt::NTAttribute::attachTimeStamp ( epics::pvData::PVTimeStamp pvTimeStamp) const

Attaches a PVTimeStamp to the wrapped PVStructure. Does nothing if no timeStamp field.

Parameters
pvTimeStampthe PVTimeStamp that will be attached.
Returns
true if the operation was successfull (i.e. this instance has a timeStamp field), otherwise false.

Definition at line 168 of file ntattribute.cpp.

169 {
171  if (ts)
172  return pvTimeStamp.attach(ts);
173  else
174  return false;
175 }
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::PVStructurePtr getTimeStamp() const
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
NTAttributeBuilderPtr epics::nt::NTAttribute::createBuilder ( )
static

Creates an NTAttribute builder instance.

Returns
builder instance.

Definition at line 163 of file ntattribute.cpp.

164 {
165  return NTAttributeBuilderPtr(new detail::NTAttributeBuilder());
166 }
std::tr1::shared_ptr< detail::NTAttributeBuilder > NTAttributeBuilderPtr
Definition: ntattribute.h:115
PVStructurePtr epics::nt::NTAttribute::getAlarm ( ) const

Returns the alarm field.

Returns
the alarm field or null if no such field.

Definition at line 201 of file ntattribute.cpp.

202 {
203  return pvNTAttribute->getSubField<PVStructure>("alarm");
204 }
Data interface for a structure,.
Definition: pvData.h:712
PVStringPtr epics::nt::NTAttribute::getDescriptor ( ) const

Returns the descriptor field.

Returns
the descriptor field or null if no such field.

Definition at line 191 of file ntattribute.cpp.

192 {
193  return pvNTAttribute->getSubField<PVString>("descriptor");
194 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVStringPtr epics::nt::NTAttribute::getName ( ) const

Returns the name field.

Returns
the name field.

Definition at line 207 of file ntattribute.cpp.

208 {
209  return pvNTAttribute->getSubField<PVString>("name");
210 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVStructurePtr epics::nt::NTAttribute::getPVStructure ( ) const

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 186 of file ntattribute.cpp.

187 {
188  return pvNTAttribute;
189 }
PVStringArrayPtr epics::nt::NTAttribute::getTags ( ) const

Returns the tags field.

Returns
the tags field or null if no such field.

Definition at line 217 of file ntattribute.cpp.

218 {
219  return pvNTAttribute->getSubField<PVStringArray>("tags");
220 }
template class for all extensions of PVArray.
Definition: pvData.h:55
PVStructurePtr epics::nt::NTAttribute::getTimeStamp ( ) const

Returns the timeStamp field.

Returns
the timStamp field or null if no such field.

Definition at line 196 of file ntattribute.cpp.

197 {
198  return pvNTAttribute->getSubField<PVStructure>("timeStamp");
199 }
Data interface for a structure,.
Definition: pvData.h:712
PVUnionPtr epics::nt::NTAttribute::getValue ( ) const

Returns the value field.

Returns
the value field.

Definition at line 212 of file ntattribute.cpp.

213 {
214  return pvValue;
215 }
bool epics::nt::NTAttribute::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure reports to be a compatible NTAttribute.

Checks if the specified Structure reports compatibility with this version of NTAttribute through its type ID, including checking version numbers. The return value does not depend on whether the structure is actually compatible in terms of its introspection type.

Parameters
structurethe Structure to test
Returns
(false,true) if the specified Structure (is not, is) a compatible NTAttribute

Definition at line 123 of file ntattribute.cpp.

124 {
125  return NTUtils::is_a(structure->getID(), URI);
126 }
static const std::string URI
Definition: ntattribute.h:129
static bool is_a(const std::string &u1, const std::string &u2)
Definition: ntutils.cpp:14
bool epics::nt::NTAttribute::is_a ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure reports to be a compatible NTAttribute.

Checks if the specified PVStructure reports compatibility with this version of NTAttribute through its type ID, including checking version numbers. The return value does not depend on whether the structure is actually compatible in terms of its introspection type.

Parameters
pvStructurethe PVStructure to test
Returns
(false,true) if the specified PVStructure (is not, is) a compatible NTAttribute

Definition at line 128 of file ntattribute.cpp.

129 {
130  return is_a(pvStructure->getStructure());
131 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTAttribute::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTAttribute.

Checks if the specified Structure is compatible with this version of NTAttribute through the introspection interface.

Parameters
structurethe Structure to test
Returns
(false,true) if the specified Structure (is not, is) a compatible NTAttribute

Definition at line 133 of file ntattribute.cpp.

134 {
135  if (!structure)
136  return false;
137 
138  Result result(structure);
139 
140  return result
141  .is<Structure>()
142  .has<Scalar>("name")
143  .has<Union>("value")
144  .maybeHas<ScalarArray>("tags")
145  .maybeHas<Scalar>("descriptor")
146  .maybeHas<&NTField::isAlarm, Structure>("alarm")
147  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
148  .valid();
149 }
This class implements introspection object for Scalar.
Definition: pvIntrospect.h:397
This class implements introspection object for a union.
Definition: pvIntrospect.h:866
pvac::PutEvent result
Definition: clientSync.cpp:117
This class implements introspection object for a structure.
Definition: pvIntrospect.h:697
bool isTimeStamp(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:56
bool epics::nt::NTAttribute::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTAttribute.

Checks if the specified tructure is compatible with this version of NTAttribute through the introspection interface.

Parameters
pvStructurethe PVStructure to test
Returns
(false,true) if the specified PVStructure (is not, is) a compatible NTAttribute

Definition at line 151 of file ntattribute.cpp.

152 {
153  if(!pvStructure) return false;
154 
155  return isCompatible(pvStructure->getStructure());
156 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTAttribute::isValid ( )

Returns whether the wrapped PVStructure is valid with respect to this version of NTAttribute.

Unlike isCompatible(), isValid() may perform checks on the value data as well as the introspection data.

Returns
(false,true) if the wrapped PVStructure (is not, is) a valid NTAttribute

Definition at line 158 of file ntattribute.cpp.

159 {
160  return true;
161 }
epics::nt::NTAttribute::POINTER_DEFINITIONS ( NTAttribute  )
NTAttribute::shared_pointer epics::nt::NTAttribute::wrap ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Creates an NTAttribute wrapping the specified PVStructure if the latter is compatible.

Checks the supplied PVStructure is compatible with NTAttribute and if so returns an NTAttribute which wraps it. This method will return null if the structure is is not compatible or is null.

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTAttribute instance wrapping pvStructure on success, null otherwise

Definition at line 112 of file ntattribute.cpp.

113 {
114  if(!isCompatible(pvStructure)) return shared_pointer();
115  return wrapUnsafe(pvStructure);
116 }
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
NTAttribute::shared_pointer epics::nt::NTAttribute::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Creates an NTAttribute wrapping the specified PVStructure, regardless of the latter's compatibility.

No checks are made as to whether the specified PVStructure is compatible with NTAttribute or is non-null.

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTAttribute instance wrapping pvStructure

Definition at line 118 of file ntattribute.cpp.

119 {
120  return shared_pointer(new NTAttribute(pvStructure));
121 }

Friends And Related Function Documentation

friend class detail::NTAttributeBuilder
friend

Definition at line 290 of file ntattribute.h.

Member Data Documentation

const std::string epics::nt::NTAttribute::URI
static

Definition at line 129 of file ntattribute.h.


The documentation for this class was generated from the following files: