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

Convenience Class for NTScalarMultiChannel. More...

#include "ntscalarMultiChannel.h"

Public Member Functions

 POINTER_DEFINITIONS (NTScalarMultiChannel)
 
bool isValid ()
 
 ~NTScalarMultiChannel ()
 
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::PVScalarArrayPtr getValue () const
 
template<typename PVT >
std::tr1::shared_ptr< PVT > getValue () const
 
epics::pvData::PVStringArrayPtr getChannelName () const
 
epics::pvData::PVBooleanArrayPtr getIsConnected () const
 
epics::pvData::PVIntArrayPtr getSeverity () const
 
epics::pvData::PVIntArrayPtr getStatus () const
 
epics::pvData::PVStringArrayPtr getMessage () const
 
epics::pvData::PVLongArrayPtr getSecondsPastEpoch () const
 
epics::pvData::PVIntArrayPtr getNanoseconds () const
 
epics::pvData::PVIntArrayPtr getUserTag () 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 NTScalarMultiChannelBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTScalarMultiChannelBuilder
 

Detailed Description

Convenience Class for NTScalarMultiChannel.

Author
dgh
mrk

Definition at line 184 of file ntscalarMultiChannel.h.

Constructor & Destructor Documentation

epics::nt::NTScalarMultiChannel::~NTScalarMultiChannel ( )
inline

Destructor

Definition at line 283 of file ntscalarMultiChannel.h.

283 {}

Member Function Documentation

bool epics::nt::NTScalarMultiChannel::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 313 of file ntscalarMultiChannel.cpp.

314 {
315  if (pvAlarm)
316  return pv.attach(pvAlarm);
317  else
318  return false;
319 }
Definition: tool_lib.h:67
bool epics::nt::NTScalarMultiChannel::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 305 of file ntscalarMultiChannel.cpp.

306 {
307  if (pvTimeStamp)
308  return pv.attach(pvTimeStamp);
309  else
310  return false;
311 }
Definition: tool_lib.h:67
NTScalarMultiChannelBuilderPtr epics::nt::NTScalarMultiChannel::createBuilder ( )
static

Creates an NTScalarMultiChannelBuilder instance

Returns
builder instance.

Definition at line 281 of file ntscalarMultiChannel.cpp.

282 {
283  return NTScalarMultiChannelBuilderPtr(new detail::NTScalarMultiChannelBuilder());
284 }
std::tr1::shared_ptr< detail::NTScalarMultiChannelBuilder > NTScalarMultiChannelBuilderPtr
epics::pvData::PVStructurePtr epics::nt::NTScalarMultiChannel::getAlarm ( ) const
inline

Returns the alarm field.

Returns
the alarm field or null if no such field.

Definition at line 325 of file ntscalarMultiChannel.h.

326  {return pvAlarm;}
epics::pvData::PVStringArrayPtr epics::nt::NTScalarMultiChannel::getChannelName ( ) const
inline

Returns the field with the channelName of each channel.

Returns
the channelName field

Definition at line 352 of file ntscalarMultiChannel.h.

353  { return pvChannelName;};
epics::pvData::PVStringPtr epics::nt::NTScalarMultiChannel::getDescriptor ( ) const
inline

Return the descriptor field.

Returns
the descriptor field or null if no descriptor field.

Definition at line 311 of file ntscalarMultiChannel.h.

312  {return pvDescriptor;}
epics::pvData::PVBooleanArrayPtr epics::nt::NTScalarMultiChannel::getIsConnected ( ) const
inline

Returns the field with the connection state of each channel.

Returns
the isConnected field or null if no such field

Definition at line 359 of file ntscalarMultiChannel.h.

360  { return pvIsConnected;};
epics::pvData::PVStringArrayPtr epics::nt::NTScalarMultiChannel::getMessage ( ) const
inline

Returns the field with the message of each channel.

Returns
message field or null if no such field.

Definition at line 380 of file ntscalarMultiChannel.h.

381  {return pvMessage;}
epics::pvData::PVIntArrayPtr epics::nt::NTScalarMultiChannel::getNanoseconds ( ) const
inline

Returns the field with the nanoseconds of each channel.

Returns
nanoseconds field or null if no such field.

Definition at line 394 of file ntscalarMultiChannel.h.

395  {return pvNanoseconds;}
epics::pvData::PVStructurePtr epics::nt::NTScalarMultiChannel::getPVStructure ( ) const
inline

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 304 of file ntscalarMultiChannel.h.

305  {return pvNTScalarMultiChannel;}
epics::pvData::PVLongArrayPtr epics::nt::NTScalarMultiChannel::getSecondsPastEpoch ( ) const
inline

Returns the field with the secondsPastEpoch of each channel.

Returns
the secondsPastEpoch field or null if no such field.

Definition at line 387 of file ntscalarMultiChannel.h.

388  {return pvSecondsPastEpoch;}
epics::pvData::PVIntArrayPtr epics::nt::NTScalarMultiChannel::getSeverity ( ) const
inline

Returns the field with the severity of each channel.

Returns
the severity field or null if no such field

Definition at line 366 of file ntscalarMultiChannel.h.

367  {return pvSeverity;}
epics::pvData::PVIntArrayPtr epics::nt::NTScalarMultiChannel::getStatus ( ) const
inline

Returns the field with the status of each channel.

Returns
the status field or null if no such field

Definition at line 373 of file ntscalarMultiChannel.h.

374  {return pvStatus;}
epics::pvData::PVStructurePtr epics::nt::NTScalarMultiChannel::getTimeStamp ( ) const
inline

Returns the timeStamp field.

Returns
the timeStamp field or null if no such field.

Definition at line 318 of file ntscalarMultiChannel.h.

319  {return pvTimeStamp;}
epics::pvData::PVIntArrayPtr epics::nt::NTScalarMultiChannel::getUserTag ( ) const
inline

Returns the field with the userTag of each channel.

Returns
the userTag field or null if no such field.

Definition at line 401 of file ntscalarMultiChannel.h.

402  {return pvUserTag;}
epics::pvData::PVScalarArrayPtr epics::nt::NTScalarMultiChannel::getValue ( ) const
inline

Returns the field with the value of each channel.

Returns
the value field.

Definition at line 332 of file ntscalarMultiChannel.h.

333  {return pvValue;}
template<typename PVT >
std::tr1::shared_ptr<PVT> epics::nt::NTScalarMultiChannel::getValue ( ) const
inline

Returns the value of each channel of a specified expected type (for example, 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 343 of file ntscalarMultiChannel.h.

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

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

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

Definition at line 220 of file ntscalarMultiChannel.cpp.

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

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

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

Definition at line 225 of file ntscalarMultiChannel.cpp.

226 {
227  return is_a(pvStructure->getStructure());
228 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTScalarMultiChannel::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTScalarMultiChannel.

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

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

Definition at line 230 of file ntscalarMultiChannel.cpp.

231 {
232  if (!structure)
233  return false;
234 
235  Result result(structure);
236 
237  return result
238  .is<Structure>()
239  .has<ScalarArray>("value")
240  .has<ScalarArray>("channelName")
241  .maybeHas<ScalarArray>("severity")
242  .maybeHas<ScalarArray>("status")
243  .maybeHas<ScalarArray>("message")
244  .maybeHas<ScalarArray>("secondsPastEpoch")
245  .maybeHas<ScalarArray>("nanoseconds")
246  .maybeHas<ScalarArray>("userTag")
247  .maybeHas<Scalar>("descriptor")
248  .maybeHas<&NTField::isAlarm, Structure>("alarm")
249  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
250  .valid();
251 }
pvac::PutEvent result
Definition: clientSync.cpp:117
This class implements introspection object for a structure.
Definition: pvIntrospect.h:697
bool isAlarm(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:70
This class implements introspection object for scalar array.
Definition: pvIntrospect.h:497
bool epics::nt::NTScalarMultiChannel::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the wrapped PVStructure is a valid NTScalarMultiChannel.

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

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

Definition at line 253 of file ntscalarMultiChannel.cpp.

254 {
255  if(!pvStructure.get()) return false;
256 
257  return isCompatible(pvStructure->getStructure());
258 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTScalarMultiChannel::isValid ( )

Returns whether the specified PVStructure is a valid NTScalarMultiChannel.

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

Returns
(false,true) if wrapped PVStructure (is not, is) a valid NTScalarMultiChannel.

Definition at line 260 of file ntscalarMultiChannel.cpp.

261 {
262  size_t valueLength = getValue()->getLength();
263  if (getChannelName()->getLength() != valueLength) return false;
264 
265  PVScalarArrayPtr arrayFields[] = {
268  };
269  size_t N = sizeof(arrayFields)/sizeof(arrayFields[0]);
270 
271  PVScalarArrayPtr arrayField;
272  for (PVScalarArrayPtr * pa = arrayFields; pa != arrayFields+N; ++pa)
273  {
274  arrayField = *pa;
275  if (arrayField.get() && arrayField->getLength() != valueLength)
276  return false;
277  }
278  return true;
279 }
epics::pvData::PVScalarArrayPtr getValue() const
epics::pvData::PVIntArrayPtr getStatus() const
epics::pvData::PVStringArrayPtr getMessage() const
epics::pvData::PVIntArrayPtr getSeverity() const
epics::pvData::PVStringArrayPtr getChannelName() const
epics::pvData::PVIntArrayPtr getUserTag() const
epics::pvData::PVLongArrayPtr getSecondsPastEpoch() const
epics::pvData::PVIntArrayPtr getNanoseconds() const
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
epics::nt::NTScalarMultiChannel::POINTER_DEFINITIONS ( NTScalarMultiChannel  )
NTScalarMultiChannel::shared_pointer epics::nt::NTScalarMultiChannel::wrap ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 209 of file ntscalarMultiChannel.cpp.

210 {
211  if(!isCompatible(pvStructure)) return shared_pointer();
212  return wrapUnsafe(pvStructure);
213 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
NTScalarMultiChannel::shared_pointer epics::nt::NTScalarMultiChannel::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTScalarMultiChannel instance wrapping pvStructure

Definition at line 215 of file ntscalarMultiChannel.cpp.

216 {
217  return shared_pointer(new NTScalarMultiChannel(pvStructure));
218 }

Friends And Related Function Documentation

Definition at line 419 of file ntscalarMultiChannel.h.

Member Data Documentation

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

Definition at line 189 of file ntscalarMultiChannel.h.


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