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

Convenience Class for NTScalarArray. More...

#include "ntscalarArray.h"

Public Member Functions

 POINTER_DEFINITIONS (NTScalarArray)
 
bool isValid ()
 
 ~NTScalarArray ()
 
bool attachTimeStamp (epics::pvData::PVTimeStamp &pvTimeStamp) const
 
bool attachAlarm (epics::pvData::PVAlarm &pvAlarm) const
 
bool attachDisplay (epics::pvData::PVDisplay &pvDisplay) const
 
bool attachControl (epics::pvData::PVControl &pvControl) const
 
epics::pvData::PVStructurePtr getPVStructure () const
 
epics::pvData::PVStringPtr getDescriptor () const
 
epics::pvData::PVStructurePtr getTimeStamp () const
 
epics::pvData::PVStructurePtr getAlarm () const
 
epics::pvData::PVStructurePtr getDisplay () const
 
epics::pvData::PVStructurePtr getControl () const
 
epics::pvData::PVFieldPtr getValue () const
 
template<typename PVT >
std::tr1::shared_ptr< PVT > getValue () 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 NTScalarArrayBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTScalarArrayBuilder
 

Detailed Description

Convenience Class for NTScalarArray.

Author
mrk

Definition at line 153 of file ntscalarArray.h.

Constructor & Destructor Documentation

epics::nt::NTScalarArray::~NTScalarArray ( )
inline

Destructor.

Definition at line 253 of file ntscalarArray.h.

253 {}

Member Function Documentation

bool epics::nt::NTScalarArray::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 208 of file ntscalarArray.cpp.

209 {
210  PVStructurePtr al = getAlarm();
211  if (al)
212  return pvAlarm.attach(al);
213  else
214  return false;
215 }
epics::pvData::PVStructurePtr getAlarm() const
bool attach(PVFieldPtr const &pvField)
Definition: pvAlarm.cpp:26
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool epics::nt::NTScalarArray::attachControl ( epics::pvData::PVControl pvControl) const

Attaches an pvControl.

Parameters
pvControlThe pvControl that will be attached. Does nothing if no control field.
Returns
true if the operation was successfull (i.e. this instance has a control field), otherwise false.

Definition at line 226 of file ntscalarArray.cpp.

227 {
228  PVStructurePtr ctrl = getControl();
229  if (ctrl)
230  return pvControl.attach(ctrl);
231  else
232  return false;
233 }
epics::pvData::PVStructurePtr getControl() const
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool attach(PVFieldPtr const &pvField)
Definition: pvControl.cpp:26
bool epics::nt::NTScalarArray::attachDisplay ( epics::pvData::PVDisplay pvDisplay) const

Attaches a PVDisplay to the wrapped PVStructure. Does nothing if no display field.

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

Definition at line 217 of file ntscalarArray.cpp.

218 {
219  PVStructurePtr dp = getDisplay();
220  if (dp)
221  return pvDisplay.attach(dp);
222  else
223  return false;
224 }
bool attach(PVFieldPtr const &pvField)
Definition: pvDisplay.cpp:26
epics::pvData::PVStructurePtr getDisplay() const
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool epics::nt::NTScalarArray::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 199 of file ntscalarArray.cpp.

200 {
202  if (ts)
203  return pvTimeStamp.attach(ts);
204  else
205  return false;
206 }
epics::pvData::PVStructurePtr getTimeStamp() const
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
NTScalarArrayBuilderPtr epics::nt::NTScalarArray::createBuilder ( )
static

Creates an NTScalarArray builder instance.

Returns
builder instance.

Definition at line 194 of file ntscalarArray.cpp.

195 {
196  return NTScalarArrayBuilderPtr(new detail::NTScalarArrayBuilder());
197 }
std::tr1::shared_ptr< detail::NTScalarArrayBuilder > NTScalarArrayBuilderPtr
PVStructurePtr epics::nt::NTScalarArray::getAlarm ( ) const

Returns the alarm field.

Returns
the alarm field or null if no alarm field.

Definition at line 250 of file ntscalarArray.cpp.

251 {
252  return pvNTScalarArray->getSubField<PVStructure>("alarm");
253 }
Data interface for a structure,.
Definition: pvData.h:712
PVStructurePtr epics::nt::NTScalarArray::getControl ( ) const

Returns the control.

Returns
PVStructurePtr which may be null.

Definition at line 260 of file ntscalarArray.cpp.

261 {
262  return pvNTScalarArray->getSubField<PVStructure>("control");
263 }
Data interface for a structure,.
Definition: pvData.h:712
PVStringPtr epics::nt::NTScalarArray::getDescriptor ( ) const

Returns the descriptor field.

Returns
the descriptor field or null if no descriptor field.

Definition at line 240 of file ntscalarArray.cpp.

241 {
242  return pvNTScalarArray->getSubField<PVString>("descriptor");
243 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVStructurePtr epics::nt::NTScalarArray::getDisplay ( ) const

Returns the display.

Returns
PVStructurePtr which may be null.

Definition at line 255 of file ntscalarArray.cpp.

256 {
257  return pvNTScalarArray->getSubField<PVStructure>("display");
258 }
Data interface for a structure,.
Definition: pvData.h:712
PVStructurePtr epics::nt::NTScalarArray::getPVStructure ( ) const

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 235 of file ntscalarArray.cpp.

236 {
237  return pvNTScalarArray;
238 }
PVStructurePtr epics::nt::NTScalarArray::getTimeStamp ( ) const

Returns the timeStamp field.

Returns
the timStamp field or null if no timeStamp field.

Definition at line 245 of file ntscalarArray.cpp.

246 {
247  return pvNTScalarArray->getSubField<PVStructure>("timeStamp");
248 }
Data interface for a structure,.
Definition: pvData.h:712
PVFieldPtr epics::nt::NTScalarArray::getValue ( ) const

Returns the value field.

Returns
The PVField for the values.

Definition at line 265 of file ntscalarArray.cpp.

266 {
267  return pvValue;
268 }
template<typename PVT >
std::tr1::shared_ptr<PVT> epics::nt::NTScalarArray::getValue ( ) const
inline

Returns the value field of a specified type (e.g. PVDoubleArray).

Template Parameters
PVTthe expected type of the value field which should be be PVScalarArray or a derived class.
Returns
the value field or null if it is not of the expected type.

Definition at line 336 of file ntscalarArray.h.

337  {
338  return std::tr1::dynamic_pointer_cast<PVT>(pvValue);
339  }
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
bool epics::nt::NTScalarArray::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

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

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

Definition at line 154 of file ntscalarArray.cpp.

155 {
156  return NTUtils::is_a(structure->getID(), URI);
157 }
static const std::string URI
static bool is_a(const std::string &u1, const std::string &u2)
Definition: ntutils.cpp:14
bool epics::nt::NTScalarArray::is_a ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 159 of file ntscalarArray.cpp.

160 {
161  return is_a(pvStructure->getStructure());
162 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTScalarArray::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTScalarArray.

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

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

Definition at line 164 of file ntscalarArray.cpp.

165 {
166  if (!structure)
167  return false;
168 
169  Result result(structure);
170 
171  return result
172  .is<Structure>()
173  .has<ScalarArray>("value")
174  .maybeHas<Scalar>("descriptor")
175  .maybeHas<&NTField::isAlarm, Structure>("alarm")
176  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
177  .maybeHas<&NTField::isDisplay, Structure>("display")
178  .maybeHas<&NTField::isControl, Structure>("control")
179  .valid();
180 }
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
bool isControl(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:122
bool isTimeStamp(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:56
bool epics::nt::NTScalarArray::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTScalarArray.

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

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

Definition at line 182 of file ntscalarArray.cpp.

183 {
184  if(!pvStructure) return false;
185 
186  return isCompatible(pvStructure->getStructure());
187 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTScalarArray::isValid ( )

Returns whether the wrapped PVStructure is a valid NTScalarArray.

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 NTScalarArray.

Definition at line 189 of file ntscalarArray.cpp.

190 {
191  return true;
192 }
epics::nt::NTScalarArray::POINTER_DEFINITIONS ( NTScalarArray  )
NTScalarArray::shared_pointer epics::nt::NTScalarArray::wrap ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 143 of file ntscalarArray.cpp.

144 {
145  if(!isCompatible(pvStructure)) return shared_pointer();
146  return wrapUnsafe(pvStructure);
147 }
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
NTScalarArray::shared_pointer epics::nt::NTScalarArray::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTScalarArray instance wrapping pvStructure

Definition at line 149 of file ntscalarArray.cpp.

150 {
151  return shared_pointer(new NTScalarArray(pvStructure));
152 }

Friends And Related Function Documentation

friend class detail::NTScalarArrayBuilder
friend

Definition at line 346 of file ntscalarArray.h.

Member Data Documentation

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

Definition at line 158 of file ntscalarArray.h.


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