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

Convenience Class for NTAggregate. More...

#include "ntaggregate.h"

Public Member Functions

 POINTER_DEFINITIONS (NTAggregate)
 
bool isValid ()
 
 ~NTAggregate ()
 
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::PVDoublePtr getValue () const
 
epics::pvData::PVLongPtr getN () const
 
epics::pvData::PVDoublePtr getDispersion () const
 
epics::pvData::PVDoublePtr getFirst () const
 
epics::pvData::PVStructurePtr getFirstTimeStamp () const
 
epics::pvData::PVDoublePtr getLast () const
 
epics::pvData::PVStructurePtr getLastTimeStamp () const
 
epics::pvData::PVDoublePtr getMax () const
 
epics::pvData::PVDoublePtr getMin () 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 NTAggregateBuilderPtr createBuilder ()
 

Static Public Attributes

static const std::string URI
 

Friends

class detail::NTAggregateBuilder
 

Detailed Description

Convenience Class for NTAggregate.

Author
dgh

Definition at line 166 of file ntaggregate.h.

Constructor & Destructor Documentation

epics::nt::NTAggregate::~NTAggregate ( )
inline

Destructor.

Definition at line 267 of file ntaggregate.h.

267 {}

Member Function Documentation

bool epics::nt::NTAggregate::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 247 of file ntaggregate.cpp.

248 {
249  PVStructurePtr al = getAlarm();
250  if (al)
251  return pvAlarm.attach(al);
252  else
253  return false;
254 }
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::NTAggregate::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 238 of file ntaggregate.cpp.

239 {
241  if (ts)
242  return pvTimeStamp.attach(ts);
243  else
244  return false;
245 }
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::PVStructurePtr getTimeStamp() const
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
NTAggregateBuilderPtr epics::nt::NTAggregate::createBuilder ( )
static

Creates an NTAggregate builder instance.

Returns
builder instance.

Definition at line 233 of file ntaggregate.cpp.

234 {
235  return NTAggregateBuilderPtr(new detail::NTAggregateBuilder());
236 }
std::tr1::shared_ptr< detail::NTAggregateBuilder > NTAggregateBuilderPtr
Definition: ntaggregate.h:158
PVStructurePtr epics::nt::NTAggregate::getAlarm ( ) const

Returns the alarm field.

Returns
the alarm field or null if no such field.

Definition at line 271 of file ntaggregate.cpp.

272 {
273  return pvNTAggregate->getSubField<PVStructure>("alarm");
274 }
Data interface for a structure,.
Definition: pvData.h:712
PVStringPtr epics::nt::NTAggregate::getDescriptor ( ) const

Returns the descriptor field.

Returns
the descriptor field or null if no such field.

Definition at line 261 of file ntaggregate.cpp.

262 {
263  return pvNTAggregate->getSubField<PVString>("descriptor");
264 }
PVString is special case, since it implements SerializableArray.
Definition: pvData.h:521
PVDoublePtr epics::nt::NTAggregate::getDispersion ( ) const

Returns the dispersion field.

Returns
the dispersion or null if no such field.

Definition at line 286 of file ntaggregate.cpp.

287 {
288  return pvNTAggregate->getSubField<PVDouble>("dispersion");
289 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVDoublePtr epics::nt::NTAggregate::getFirst ( ) const

Returns the first field.

Returns
the first field or null if no such field.

Definition at line 291 of file ntaggregate.cpp.

292 {
293  return pvNTAggregate->getSubField<PVDouble>("first");
294 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVStructurePtr epics::nt::NTAggregate::getFirstTimeStamp ( ) const

Returns the firstTimeStamp field.

Returns
the firstTimeStamp field or null if no such field.

Definition at line 296 of file ntaggregate.cpp.

297 {
298  return pvNTAggregate->getSubField<PVStructure>("firstTimeStamp");
299 }
Data interface for a structure,.
Definition: pvData.h:712
PVDoublePtr epics::nt::NTAggregate::getLast ( ) const

Returns the last field.

Returns
the last field or null if no such field.

Definition at line 301 of file ntaggregate.cpp.

302 {
303  return pvNTAggregate->getSubField<PVDouble>("last");
304 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVStructurePtr epics::nt::NTAggregate::getLastTimeStamp ( ) const

Returns the lastTimeStamp field.

Returns
the lastTimeStamp field or null if no such field.

Definition at line 306 of file ntaggregate.cpp.

307 {
308  return pvNTAggregate->getSubField<PVStructure>("lastTimeStamp");
309 }
Data interface for a structure,.
Definition: pvData.h:712
PVDoublePtr epics::nt::NTAggregate::getMax ( ) const

Returns the max field.

Returns
the max field or null if no such field.

Definition at line 311 of file ntaggregate.cpp.

312 {
313  return pvNTAggregate->getSubField<PVDouble>("max");
314 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVDoublePtr epics::nt::NTAggregate::getMin ( ) const

Returns the min field.

Returns
the min field or null if no such field.

Definition at line 316 of file ntaggregate.cpp.

317 {
318  return pvNTAggregate->getSubField<PVDouble>("min");
319 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVLongPtr epics::nt::NTAggregate::getN ( ) const

Returns the N field.

Returns
the N field.

Definition at line 281 of file ntaggregate.cpp.

282 {
283  return pvNTAggregate->getSubField<PVLong>("N");
284 }
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
PVStructurePtr epics::nt::NTAggregate::getPVStructure ( ) const

Returns the PVStructure wrapped by this instance.

Returns
the PVStructure wrapped by this instance.

Definition at line 256 of file ntaggregate.cpp.

257 {
258  return pvNTAggregate;
259 }
PVStructurePtr epics::nt::NTAggregate::getTimeStamp ( ) const

Returns the timeStamp field.

Returns
the timStamp field or null if no such field.

Definition at line 266 of file ntaggregate.cpp.

267 {
268  return pvNTAggregate->getSubField<PVStructure>("timeStamp");
269 }
Data interface for a structure,.
Definition: pvData.h:712
PVDoublePtr epics::nt::NTAggregate::getValue ( ) const

Returns the value field.

Returns
the value field.

Definition at line 276 of file ntaggregate.cpp.

277 {
278  return pvValue;
279 }
bool epics::nt::NTAggregate::is_a ( epics::pvData::StructureConstPtr const &  structure)
static

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

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

Definition at line 186 of file ntaggregate.cpp.

187 {
188  return NTUtils::is_a(structure->getID(), URI);
189 }
static const std::string URI
Definition: ntaggregate.h:171
static bool is_a(const std::string &u1, const std::string &u2)
Definition: ntutils.cpp:14
bool epics::nt::NTAggregate::is_a ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 191 of file ntaggregate.cpp.

192 {
193  return is_a(pvStructure->getStructure());
194 }
static bool is_a(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTAggregate::isCompatible ( epics::pvData::StructureConstPtr const &  structure)
static

Returns whether the specified Structure is compatible with NTAggregate.

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

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

Definition at line 197 of file ntaggregate.cpp.

198 {
199  if (!structure)
200  return false;
201 
202  Result result(structure);
203 
204  return result
205  .is<Structure>()
206  .has<Scalar>("value")
207  .has<Scalar>("N")
208  .maybeHas<Scalar>("dispersion")
209  .maybeHas<Scalar>("first")
210  .maybeHas<&NTField::isTimeStamp, Structure>("firstTimeStamp")
211  .maybeHas<Scalar>("last")
212  .maybeHas<&NTField::isTimeStamp, Structure>("lastTimeStamp")
213  .maybeHas<Scalar>("max")
214  .maybeHas<Scalar>("min")
215  .maybeHas<Scalar>("descriptor")
216  .maybeHas<&NTField::isAlarm, Structure>("alarm")
217  .maybeHas<&NTField::isTimeStamp, Structure>("timeStamp")
218  .valid();
219 }
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 isTimeStamp(epics::pvData::FieldConstPtr const &field)
Definition: ntfield.cpp:56
bool epics::nt::NTAggregate::isCompatible ( epics::pvData::PVStructurePtr const &  pvStructure)
static

Returns whether the specified PVStructure is compatible with NTAggregate.

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

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

Definition at line 221 of file ntaggregate.cpp.

222 {
223  if(!pvStructure) return false;
224 
225  return isCompatible(pvStructure->getStructure());
226 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
bool epics::nt::NTAggregate::isValid ( )

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

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

Returns
(false,true) if wrapped PVStructure a valid NTAggregate

Definition at line 228 of file ntaggregate.cpp.

229 {
230  return true;
231 }
epics::nt::NTAggregate::POINTER_DEFINITIONS ( NTAggregate  )
NTAggregate::shared_pointer epics::nt::NTAggregate::wrap ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Definition at line 175 of file ntaggregate.cpp.

176 {
177  if(!isCompatible(pvStructure)) return shared_pointer();
178  return wrapUnsafe(pvStructure);
179 }
static bool isCompatible(epics::pvData::StructureConstPtr const &structure)
static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const &pvStructure)
NTAggregate::shared_pointer epics::nt::NTAggregate::wrapUnsafe ( epics::pvData::PVStructurePtr const &  pvStructure)
static

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

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

Parameters
pvStructurethe PVStructure to be wrapped
Returns
the NTAggregate instance

Definition at line 181 of file ntaggregate.cpp.

182 {
183  return shared_pointer(new NTAggregate(pvStructure));
184 }

Friends And Related Function Documentation

friend class detail::NTAggregateBuilder
friend

Definition at line 368 of file ntaggregate.h.

Member Data Documentation

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

Definition at line 171 of file ntaggregate.h.


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