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

Convenience Class for NTNDArray. More...

#include "ntndarray.h"

Public Member Functions

 POINTER_DEFINITIONS (NTNDArray)
 
bool isValid ()
 
 ~NTNDArray ()
 
bool attachTimeStamp (epics::pvData::PVTimeStamp &pvTimeStamp) const
 
bool attachDataTimeStamp (epics::pvData::PVTimeStamp &pvTimeStamp) const
 
bool attachAlarm (epics::pvData::PVAlarm &pvAlarm) const
 
epics::pvData::PVStructurePtr getPVStructure () const
 
epics::pvData::PVUnionPtr getValue () const
 
epics::pvData::PVStructurePtr getCodec () const
 
epics::pvData::PVLongPtr getCompressedDataSize () const
 
epics::pvData::PVLongPtr getUncompressedDataSize () const
 
epics::pvData::PVStructureArrayPtr getDimension () const
 
epics::pvData::PVIntPtr getUniqueId () const
 
epics::pvData::PVStructurePtr getDataTimeStamp () const
 
epics::pvData::PVStructureArrayPtr getAttribute () const
 
epics::pvData::PVStringPtr getDescriptor () const
 
epics::pvData::PVStructurePtr getTimeStamp () const
 
epics::pvData::PVStructurePtr getAlarm () const
 
bool attachDisplay (epics::pvData::PVDisplay &pvDisplay) const
 
epics::pvData::PVStructurePtr getDisplay () 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 NTNDArrayBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTNDArrayBuilder
 

Detailed Description

Convenience Class for NTNDArray.

Author
dgh

Definition at line 128 of file ntndarray.h.

Constructor & Destructor Documentation

epics::nt::NTNDArray::~NTNDArray ( )
inline

Destructor.

Definition at line 228 of file ntndarray.h.

228 {}

Member Function Documentation

bool epics::nt::NTNDArray::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 399 of file ntndarray.cpp.

400 {
401  PVStructurePtr al = getAlarm();
402  if (al)
403  return pvAlarm.attach(al);
404  else
405  return false;
406 }
epics::pvData::PVStructurePtr getAlarm() const
Definition: ntndarray.cpp:472
bool attach(PVFieldPtr const &pvField)
Definition: pvAlarm.cpp:26
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool epics::nt::NTNDArray::attachDataTimeStamp ( epics::pvData::PVTimeStamp pvTimeStamp) const

Attaches a pvTimeStamp to dataTimeStamp field.

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

Definition at line 390 of file ntndarray.cpp.

391 {
393  if (ts)
394  return pvTimeStamp.attach(ts);
395  else
396  return false;
397 }
epics::pvData::PVStructurePtr getDataTimeStamp() const
Definition: ntndarray.cpp:452
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
bool epics::nt::NTNDArray::attachDisplay ( epics::pvData::PVDisplay pvDisplay) const

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

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 408 of file ntndarray.cpp.

409 {
410  PVStructurePtr dp = getDisplay();
411  if (dp)
412  return pvDisplay.attach(dp);
413  else
414  return false;
415 }
bool attach(PVFieldPtr const &pvField)
Definition: pvDisplay.cpp:26
epics::pvData::PVStructurePtr getDisplay() const
Definition: ntndarray.cpp:477
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool epics::nt::NTNDArray::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 381 of file ntndarray.cpp.

382 {
384  if (ts)
385  return pvTimeStamp.attach(ts);
386  else
387  return false;
388 }
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::PVStructurePtr getTimeStamp() const
Definition: ntndarray.cpp:467
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
NTNDArrayBuilderPtr epics::nt::NTNDArray::createBuilder ( )
static

Creates an NTNDArrayBuilder instance

Returns
builder instance.

Definition at line 375 of file ntndarray.cpp.

376 {
377  return NTNDArrayBuilderPtr(new detail::NTNDArrayBuilder());
378 }
std::tr1::shared_ptr< detail::NTNDArrayBuilder > NTNDArrayBuilderPtr
Definition: ntndarray.h:121
PVStructurePtr epics::nt::NTNDArray::getAlarm ( ) const

Returns the alarm field.

Returns
the alarm field or null if no alarm field.

Definition at line 472 of file ntndarray.cpp.

473 {
474  return pvNTNDArray->getSubField<PVStructure>("alarm");
475 }
Data interface for a structure,.
Definition: pvData.h:712
PVStructureArrayPtr epics::nt::NTNDArray::getAttribute ( ) const

Returns the attribute field.

Returns
the attribute field.

Definition at line 457 of file ntndarray.cpp.

458 {
459  return pvNTNDArray->getSubField<PVStructureArray>("attribute");
460 }
Data class for a structureArray.
Definition: pvData.h:1236
PVStructurePtr epics::nt::NTNDArray::getCodec ( ) const

Returns the codec field.

Returns
the codec field.

Definition at line 427 of file ntndarray.cpp.

428 {
429  return pvNTNDArray->getSubField<PVStructure>("codec");
430 }
Data interface for a structure,.
Definition: pvData.h:712
PVLongPtr epics::nt::NTNDArray::getCompressedDataSize ( ) const

Returns the compressedDataSize field.

Returns
the compressedDataSize field.

Definition at line 432 of file ntndarray.cpp.

433 {
434  return pvNTNDArray->getSubField<PVLong>("compressedSize");
435 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVStructurePtr epics::nt::NTNDArray::getDataTimeStamp ( ) const

Returns the dataTimeStamp field.

Returns
the dataTimeStamp field.

Definition at line 452 of file ntndarray.cpp.

453 {
454  return pvNTNDArray->getSubField<PVStructure>("dataTimeStamp");
455 }
Data interface for a structure,.
Definition: pvData.h:712
PVStringPtr epics::nt::NTNDArray::getDescriptor ( ) const

Returns the descriptor field.

Returns
the descriptor field or null if no descriptor field.

Definition at line 462 of file ntndarray.cpp.

463 {
464  return pvNTNDArray->getSubField<PVString>("descriptor");
465 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVStructureArrayPtr epics::nt::NTNDArray::getDimension ( ) const

Returns the dimension field.

Returns
the dimension field.

Definition at line 442 of file ntndarray.cpp.

443 {
444  return pvNTNDArray->getSubField<PVStructureArray>("dimension");
445 }
Data class for a structureArray.
Definition: pvData.h:1236
PVStructurePtr epics::nt::NTNDArray::getDisplay ( ) const

Returns the display field.

Returns
PVStructurePtr or null if no alarm field.

Definition at line 477 of file ntndarray.cpp.

478 {
479  return pvNTNDArray->getSubField<PVStructure>("display");
480 }
Data interface for a structure,.
Definition: pvData.h:712
PVStructurePtr epics::nt::NTNDArray::getPVStructure ( ) const

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 417 of file ntndarray.cpp.

418 {
419  return pvNTNDArray;
420 }
PVStructurePtr epics::nt::NTNDArray::getTimeStamp ( ) const

Returns the timeStamp field.

Returns
the timStamp field or null if no timeStamp field.

Definition at line 467 of file ntndarray.cpp.

468 {
469  return pvNTNDArray->getSubField<PVStructure>("timeStamp");
470 }
Data interface for a structure,.
Definition: pvData.h:712
PVLongPtr epics::nt::NTNDArray::getUncompressedDataSize ( ) const

Returns the uncompressedDataSize field.

Returns
the uncompressedDataSize field.

Definition at line 437 of file ntndarray.cpp.

438 {
439  return pvNTNDArray->getSubField<PVLong>("uncompressedSize");
440 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVIntPtr epics::nt::NTNDArray::getUniqueId ( ) const

Returns the uniqueId field.

Returns
the uniqueId field.

Definition at line 447 of file ntndarray.cpp.

448 {
449  return pvNTNDArray->getSubField<PVInt>("uniqueId");
450 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVUnionPtr epics::nt::NTNDArray::getValue ( ) const

Returns the value field. Returns the value field.

Definition at line 422 of file ntndarray.cpp.

423 {
424  return pvNTNDArray->getSubField<PVUnion>("value");
425 }
PVUnion has a single subfield.
Definition: pvData.h:940
bool epics::nt::NTNDArray::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

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

Checks if the specified Structure reports compatibility with this version of NTNDArray 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 pvStructure to test
Returns
(false,true) if the specified Structure (is not, is) a compatible NTNDArray

Definition at line 211 of file ntndarray.cpp.

212 {
213  return NTUtils::is_a(structure->getID(), URI);
214 }
static const std::string URI
Definition: ntndarray.h:133
static bool is_a(const std::string &u1, const std::string &u2)
Definition: ntutils.cpp:14
bool epics::nt::NTNDArray::is_a ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 216 of file ntndarray.cpp.

217 {
218  return is_a(pvStructure->getStructure());
219 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
Definition: ntndarray.cpp:211
bool epics::nt::NTNDArray::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTNDArray.

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

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

Definition at line 255 of file ntndarray.cpp.

256 {
257  if (!structure)
258  return false;
259 
260  Result result(structure);
261 
262  return result
263  .is<Structure>()
264  .has<&isValue>("value")
265  .has<&isCodec>("codec")
266  .has<Scalar>("compressedSize")
267  .has<Scalar>("uncompressedSize")
268  .has<&isDimension>("dimension")
269  .has<Scalar>("uniqueId")
270  .has<&NTField::isTimeStamp, Structure>("dataTimeStamp")
271  .has<&NTNDArrayAttribute::isAttribute, StructureArray>("attribute")
272  .maybeHas<Scalar>("descriptor")
273  .maybeHas<&NTField::isAlarm, Structure>("alarm")
274  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
275  .maybeHas<&NTField::isDisplay, Structure>("display")
276  .valid();
277 }
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 isDisplay(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:87
bool isAlarm(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:70
This class implements introspection object for a structureArray.
Definition: pvIntrospect.h:607
bool epics::nt::NTNDArray::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTNDArray.

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

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

Definition at line 280 of file ntndarray.cpp.

281 {
282  if(!pvStructure.get()) return false;
283 
284  return isCompatible(pvStructure->getStructure());
285 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
Definition: ntndarray.cpp:255
bool epics::nt::NTNDArray::isValid ( )

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

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 NTNDArray

Definition at line 287 of file ntndarray.cpp.

288 {
289  int64 valueSize = getValueSize();
290  int64 compressedSize = getCompressedDataSize()->get();
291  if (valueSize != compressedSize)
292  return false;
293 
294  long expectedUncompressed = getExpectedUncompressedSize();
295  long uncompressedSize = getUncompressedDataSize()->get();
296  if (uncompressedSize != expectedUncompressed)
297  return false;
298 
299  std::string codecName = getCodec()->getSubField<PVString>("name")->get();
300  if (codecName == "" && valueSize < uncompressedSize)
301  return false;
302 
303  return true;
304 }
epics::pvData::PVLongPtr getCompressedDataSize() const
Definition: ntndarray.cpp:432
epics::pvData::PVLongPtr getUncompressedDataSize() const
Definition: ntndarray.cpp:437
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
epics::pvData::PVStructurePtr getCodec() const
Definition: ntndarray.cpp:427
int64_t int64
Definition: pvType.h:87
epics::nt::NTNDArray::POINTER_DEFINITIONS ( NTNDArray  )
NTNDArray::shared_pointer epics::nt::NTNDArray::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 200 of file ntndarray.cpp.

201 {
202  if(!isCompatible(pvStructure)) return shared_pointer();
203  return wrapUnsafe(pvStructure);
204 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
Definition: ntndarray.cpp:255
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
Definition: ntndarray.cpp:206
NTNDArray::shared_pointer epics::nt::NTNDArray::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTNDArray instance wrapping pvStructure

Definition at line 206 of file ntndarray.cpp.

207 {
208  return shared_pointer(new NTNDArray(pvStructure));
209 }

Friends And Related Function Documentation

friend class detail::NTNDArrayBuilder
friend

Definition at line 349 of file ntndarray.h.

Member Data Documentation

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

Definition at line 133 of file ntndarray.h.


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