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

Convenience Class for NTContinuum. More...

#include "ntcontinuum.h"

Public Member Functions

 POINTER_DEFINITIONS (NTContinuum)
 
bool isValid ()
 
 ~NTContinuum ()
 
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::PVDoubleArrayPtr getBase () const
 
epics::pvData::PVDoubleArrayPtr getValue () const
 
epics::pvData::PVStringArrayPtr getUnits () 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 NTContinuumBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTContinuumBuilder
 

Detailed Description

Convenience Class for NTContinuum.

Author
dgh

Definition at line 118 of file ntcontinuum.h.

Constructor & Destructor Documentation

epics::nt::NTContinuum::~NTContinuum ( )
inline

Destructor.

Definition at line 219 of file ntcontinuum.h.

219 {}

Member Function Documentation

bool epics::nt::NTContinuum::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 170 of file ntcontinuum.cpp.

171 {
172  PVStructurePtr al = getAlarm();
173  if (al)
174  return pvAlarm.attach(al);
175  else
176  return false;
177 }
bool attach(PVFieldPtr const &pvField)
Definition: pvAlarm.cpp:26
epics::pvData::PVStructurePtr getAlarm() const
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool epics::nt::NTContinuum::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 161 of file ntcontinuum.cpp.

162 {
164  if (ts)
165  return pvTimeStamp.attach(ts);
166  else
167  return false;
168 }
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::PVStructurePtr getTimeStamp() const
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
NTContinuumBuilderPtr epics::nt::NTContinuum::createBuilder ( )
static

Creates an NTContinuum builder instance.

Returns
builder instance.

Definition at line 156 of file ntcontinuum.cpp.

157 {
158  return NTContinuumBuilderPtr(new detail::NTContinuumBuilder());
159 }
std::tr1::shared_ptr< detail::NTContinuumBuilder > NTContinuumBuilderPtr
Definition: ntcontinuum.h:109
PVStructurePtr epics::nt::NTContinuum::getAlarm ( ) const

Returns the alarm field.

Returns
the alarm field or null if no such field.

Definition at line 194 of file ntcontinuum.cpp.

195 {
196  return pvNTContinuum->getSubField<PVStructure>("alarm");
197 }
Data interface for a structure,.
Definition: pvData.h:712
PVDoubleArrayPtr epics::nt::NTContinuum::getBase ( ) const

Returns the base field.

Returns
the base field.

Definition at line 199 of file ntcontinuum.cpp.

200 {
201  return pvNTContinuum->getSubField<PVDoubleArray>("base");
202 }
template class for all extensions of PVArray.
Definition: pvData.h:55
PVStringPtr epics::nt::NTContinuum::getDescriptor ( ) const

Returns the descriptor field.

Returns
the descriptor field or null if no such field.

Definition at line 184 of file ntcontinuum.cpp.

185 {
186  return pvNTContinuum->getSubField<PVString>("descriptor");
187 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVStructurePtr epics::nt::NTContinuum::getPVStructure ( ) const

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 179 of file ntcontinuum.cpp.

180 {
181  return pvNTContinuum;
182 }
PVStructurePtr epics::nt::NTContinuum::getTimeStamp ( ) const

Returns the timeStamp field.

Returns
the timStamp field or null if no such field.

Definition at line 189 of file ntcontinuum.cpp.

190 {
191  return pvNTContinuum->getSubField<PVStructure>("timeStamp");
192 }
Data interface for a structure,.
Definition: pvData.h:712
PVStringArrayPtr epics::nt::NTContinuum::getUnits ( ) const

Returns the units field.

Returns
the units field.

Definition at line 209 of file ntcontinuum.cpp.

210 {
211  return pvNTContinuum->getSubField<PVStringArray>("units");
212 }
template class for all extensions of PVArray.
Definition: pvData.h:55
PVDoubleArrayPtr epics::nt::NTContinuum::getValue ( ) const

Returns the value field.

Returns
the value field.

Definition at line 204 of file ntcontinuum.cpp.

205 {
206  return pvValue;
207 }
bool epics::nt::NTContinuum::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

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

Checks if the specified Structure reports compatibility with this version of NTContinuum 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 NTContinuum

Definition at line 115 of file ntcontinuum.cpp.

116 {
117  return NTUtils::is_a(structure->getID(), URI);
118 }
static const std::string URI
Definition: ntcontinuum.h:123
static bool is_a(const std::string &u1, const std::string &u2)
Definition: ntutils.cpp:14
bool epics::nt::NTContinuum::is_a ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

Checks if the specified Structure reports compatibility with this version of NTContinuum 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 NTContinuum

Definition at line 120 of file ntcontinuum.cpp.

121 {
122  return is_a(pvStructure->getStructure());
123 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTContinuum::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTContinuum.

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

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

Definition at line 125 of file ntcontinuum.cpp.

126 {
127  if (!structure)
128  return false;
129 
130  Result result(structure);
131 
132  return result
133  .is<Structure>()
134  .has<ScalarArray>("base")
135  .has<ScalarArray>("value")
136  .has<ScalarArray>("units")
137  .maybeHas<Scalar>("descriptor")
138  .maybeHas<&NTField::isAlarm, Structure>("alarm")
139  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
140  .valid();
141 }
This class implements introspection object for Scalar.
Definition: pvIntrospect.h:397
pvac::PutEvent result
Definition: clientSync.cpp:117
This class implements introspection object for a structure.
Definition: pvIntrospect.h:697
This class implements introspection object for scalar array.
Definition: pvIntrospect.h:497
bool isTimeStamp(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:56
bool epics::nt::NTContinuum::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTContinuum.

Checks if the specified PVStructure is compatible with this version of NTContinuum through the introspection interface.

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

Definition at line 143 of file ntcontinuum.cpp.

144 {
145  if(!pvStructure) return false;
146 
147  return isCompatible(pvStructure->getStructure());
148 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTContinuum::isValid ( )

Returns whether the wrapped structure is valid with respect to this version of NTContinuum.

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 NTContinuum

Definition at line 150 of file ntcontinuum.cpp.

151 {
152  return ((getUnits()->getLength()-1)*getBase()->getLength() ==
153  getValue()->getLength());
154 }
epics::pvData::PVDoubleArrayPtr getBase() const
epics::pvData::PVDoubleArrayPtr getValue() const
epics::pvData::PVStringArrayPtr getUnits() const
epics::nt::NTContinuum::POINTER_DEFINITIONS ( NTContinuum  )
NTContinuum::shared_pointer epics::nt::NTContinuum::wrap ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

Checks the supplied structure is compatible with NTContinuum and if so returns an NTContinuum 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
NTContinuum instance wrapping pvStructure on success, null otherwise

Definition at line 104 of file ntcontinuum.cpp.

105 {
106  if(!isCompatible(pvStructure)) return shared_pointer();
107  return wrapUnsafe(pvStructure);
108 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
NTContinuum::shared_pointer epics::nt::NTContinuum::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTContinuum instance wrapping pvStructure.

Definition at line 110 of file ntcontinuum.cpp.

111 {
112  return shared_pointer(new NTContinuum(pvStructure));
113 }

Friends And Related Function Documentation

friend class detail::NTContinuumBuilder
friend

Definition at line 284 of file ntcontinuum.h.

Member Data Documentation

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

Definition at line 123 of file ntcontinuum.h.


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