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

Convenience Class for NTMultiChannel. More...

#include "ntmultiChannel.h"

Public Member Functions

 POINTER_DEFINITIONS (NTMultiChannel)
 
bool isValid ()
 
 ~NTMultiChannel ()
 
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::PVUnionArrayPtr 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 NTMultiChannelBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTMultiChannelBuilder
 

Detailed Description

Convenience Class for NTMultiChannel.

Author
mrk

Definition at line 181 of file ntmultiChannel.h.

Constructor & Destructor Documentation

epics::nt::NTMultiChannel::~NTMultiChannel ( )
inline

Destructor

Definition at line 282 of file ntmultiChannel.h.

282 {}

Member Function Documentation

bool epics::nt::NTMultiChannel::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 319 of file ntmultiChannel.cpp.

320 {
321  if (pvAlarm)
322  return pv.attach(pvAlarm);
323  else
324  return false;
325 }
Definition: tool_lib.h:67
bool epics::nt::NTMultiChannel::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 311 of file ntmultiChannel.cpp.

312 {
313  if (pvTimeStamp)
314  return pv.attach(pvTimeStamp);
315  else
316  return false;
317 }
Definition: tool_lib.h:67
NTMultiChannelBuilderPtr epics::nt::NTMultiChannel::createBuilder ( )
static

Creates an NTMultiChannelBuilder instance

Returns
builder instance.

Definition at line 288 of file ntmultiChannel.cpp.

289 {
290  return NTMultiChannelBuilderPtr(new detail::NTMultiChannelBuilder());
291 }
std::tr1::shared_ptr< detail::NTMultiChannelBuilder > NTMultiChannelBuilderPtr
epics::pvData::PVStructurePtr epics::nt::NTMultiChannel::getAlarm ( ) const
inline

Returns the alarm field.

Returns
the alarm field or null if no such field.

Definition at line 324 of file ntmultiChannel.h.

325  {return pvAlarm;}
epics::pvData::PVStringArrayPtr epics::nt::NTMultiChannel::getChannelName ( ) const
inline

Returns the field with the channelName of each channel.

Returns
the channelName field

Definition at line 338 of file ntmultiChannel.h.

339  { return pvChannelName;};
epics::pvData::PVStringPtr epics::nt::NTMultiChannel::getDescriptor ( ) const
inline

Return the descriptor field.

Returns
the descriptor field or null if no descriptor field.

Definition at line 310 of file ntmultiChannel.h.

311  {return pvDescriptor;}
epics::pvData::PVBooleanArrayPtr epics::nt::NTMultiChannel::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 345 of file ntmultiChannel.h.

346  { return pvIsConnected;};
epics::pvData::PVStringArrayPtr epics::nt::NTMultiChannel::getMessage ( ) const
inline

Returns the field with the message of each channel.

Returns
message field or null if no such field.

Definition at line 366 of file ntmultiChannel.h.

367  {return pvMessage;}
epics::pvData::PVIntArrayPtr epics::nt::NTMultiChannel::getNanoseconds ( ) const
inline

Returns the field with the nanoseconds of each channel.

Returns
nanoseconds field or null if no such field.

Definition at line 380 of file ntmultiChannel.h.

381  {return pvNanoseconds;}
epics::pvData::PVStructurePtr epics::nt::NTMultiChannel::getPVStructure ( ) const
inline

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 303 of file ntmultiChannel.h.

304  {return pvNTMultiChannel;}
epics::pvData::PVLongArrayPtr epics::nt::NTMultiChannel::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 373 of file ntmultiChannel.h.

374  {return pvSecondsPastEpoch;}
epics::pvData::PVIntArrayPtr epics::nt::NTMultiChannel::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 352 of file ntmultiChannel.h.

353  {return pvSeverity;}
epics::pvData::PVIntArrayPtr epics::nt::NTMultiChannel::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 359 of file ntmultiChannel.h.

360  {return pvStatus;}
epics::pvData::PVStructurePtr epics::nt::NTMultiChannel::getTimeStamp ( ) const
inline

Returns the timeStamp field.

Returns
the timeStamp field or null if no such field.

Definition at line 317 of file ntmultiChannel.h.

318  {return pvTimeStamp;}
epics::pvData::PVIntArrayPtr epics::nt::NTMultiChannel::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 387 of file ntmultiChannel.h.

388  {return pvUserTag;}
epics::pvData::PVUnionArrayPtr epics::nt::NTMultiChannel::getValue ( ) const
inline

Returns the field with the value of each channel.

Returns
the value field.

Definition at line 331 of file ntmultiChannel.h.

332  {return pvValue;}
bool epics::nt::NTMultiChannel::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

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

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

Definition at line 225 of file ntmultiChannel.cpp.

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

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

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

Definition at line 230 of file ntmultiChannel.cpp.

231 {
232  return is_a(pvStructure->getStructure());
233 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTMultiChannel::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTMultiChannel.

Checks whether the specified Structure is compatible with this version of NTMultiChannel through the introspection interface.

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

Definition at line 235 of file ntmultiChannel.cpp.

236 {
237  if (!structure)
238  return false;
239 
240  Result result(structure);
241 
242  return result
243  .is<Structure>()
244  .has<UnionArray>("value")
245  .has<ScalarArray>("channelName")
246  .maybeHas<ScalarArray>("severity")
247  .maybeHas<ScalarArray>("status")
248  .maybeHas<ScalarArray>("message")
249  .maybeHas<ScalarArray>("secondsPastEpoch")
250  .maybeHas<ScalarArray>("nanoseconds")
251  .maybeHas<ScalarArray>("userTag")
252  .maybeHas<Scalar>("descriptor")
253  .maybeHas<&NTField::isAlarm, Structure>("alarm")
254  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
255  .valid();
256 }
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::NTMultiChannel::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTMultiChannel.

Checks whether the specified PVStructure is compatible with this version of NTMultiChannel through the introspection interface.

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

Definition at line 258 of file ntmultiChannel.cpp.

259 {
260  if(!pvStructure.get()) return false;
261 
262  return isCompatible(pvStructure->getStructure());
263 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTMultiChannel::isValid ( )

Checks whether the wrapped PVStructure is valid with respect to this version of NTMultiChannel.

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 NTMultiChannel

Definition at line 266 of file ntmultiChannel.cpp.

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

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

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

Definition at line 214 of file ntmultiChannel.cpp.

215 {
216  if(!isCompatible(pvStructure)) return shared_pointer();
217  return wrapUnsafe(pvStructure);
218 }
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
NTMultiChannel::shared_pointer epics::nt::NTMultiChannel::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
NTMultiChannel instance wrapping pvStructure

Definition at line 220 of file ntmultiChannel.cpp.

221 {
222  return shared_pointer(new NTMultiChannel(pvStructure));
223 }

Friends And Related Function Documentation

friend class detail::NTMultiChannelBuilder
friend

Definition at line 405 of file ntmultiChannel.h.

Member Data Documentation

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

Definition at line 186 of file ntmultiChannel.h.


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