A base class for PvaClientGetData, PvaClientPutData, and PvaClientMonitorData.
More...
#include "pvaClient.h"
epics::pvaClient::PvaClientData::~PvaClientData |
( |
| ) |
|
|
inline |
void epics::pvaClient::PvaClientData::checkValue |
( |
| ) |
|
|
protected |
Definition at line 84 of file pvaClientData.cpp.
std::string messagePrefix
static bool getDebug()
Is debug set?
Factory method for creating an instance of PvaClientData.
NOTE: Not normally called by clients
- Parameters
-
structure | Introspection interface |
- Exceptions
-
Definition at line 48 of file pvaClientData.cpp.
PvaClientData(epics::pvData::StructureConstPtr const &structure)
static bool getDebug()
Is debug set?
std::tr1::shared_ptr< PvaClientData > PvaClientDataPtr
Alarm epics::pvaClient::PvaClientData::getAlarm |
( |
| ) |
|
Get the alarm. If the pvStructure has an alarm field it's values are returned. Otherwise an exception is thrown.
- Returns
- The alarm.
- Exceptions
-
Definition at line 270 of file pvaClientData.cpp.
273 if(!pvStructure)
throw new std::runtime_error(
messagePrefix + noStructure);
Methods for manipulating alarm.
bool attach(PVFieldPtr const &pvField)
void get(Alarm &alarm) const
Data interface for a structure,.
std::tr1::shared_ptr< PVStructure > PVStructurePtr
std::string messagePrefix
static bool getDebug()
Is debug set?
PVArrayPtr epics::pvaClient::PvaClientData::getArrayValue |
( |
| ) |
|
Get the interface to an array value field.
- Returns
- The interface.
- Exceptions
-
Definition at line 182 of file pvaClientData.cpp.
186 Type type = pvValue->getField()->getType();
190 return pvStructure->getSubField<
PVArray>(
"value");
pvd::StructureConstPtr type
std::string messagePrefix
PVArray is the base class for all array types.
static bool getDebug()
Is debug set?
BitSetPtr epics::pvaClient::PvaClientData::getChangedBitSet |
( |
| ) |
|
Get the changed BitSet for the pvStructure.
This shows which fields have changed value since the last get.
- Returns
- The bitSet
- Exceptions
-
Definition at line 107 of file pvaClientData.cpp.
109 if(bitSet)
return bitSet;
std::string messagePrefix
double epics::pvaClient::PvaClientData::getDouble |
( |
| ) |
|
Get the value as a double.
- Returns
- The value.
- Exceptions
-
Definition at line 204 of file pvaClientData.cpp.
208 Type type = pvField->getField()->getType();
210 throw std::logic_error(
"PvaClientData::getDouble() did not find a scalar field");
216 return pvDouble->
get();
219 throw std::logic_error(
220 "PvaClientData::getDouble() did not find a numeric scalar field");
222 return convert->toDouble(pvScalar);
PVScalar is the base class for each scalar field.
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
pvd::StructureConstPtr type
storage_t::arg_type get() const
const ScalarConstPtr getScalar() const
epics::pvData::PVFieldPtr getSinglePVField()
bool isNumeric(ScalarType type)
std::tr1::shared_ptr< PVScalar > PVScalarPtr
Class that holds the data for each possible scalar type.
std::tr1::shared_ptr< PVField > PVFieldPtr
static bool getDebug()
Is debug set?
std::tr1::shared_ptr< PVDouble > PVDoublePtr
shared_vector< const double > epics::pvaClient::PvaClientData::getDoubleArray |
( |
| ) |
|
Get the value as a double array.
- Returns
- The value.
- Exceptions
-
Definition at line 237 of file pvaClientData.cpp.
241 Type type = pvField->getField()->getType();
243 throw std::logic_error(
"PvaClientData::getDoubleArray() did not find a scalarArray field");
248 throw std::logic_error(
249 "PvaClientData::getDoubleArray() did not find a numeric scalarArray field");
252 pvScalarArray->getAs<
const double>(retValue);
A holder for a contiguous piece of memory.
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
bool isNumeric(ScalarType type)
Base class for a scalarArray.
const ScalarArrayConstPtr getScalarArray() const
std::tr1::shared_ptr< PVField > PVFieldPtr
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
static bool getDebug()
Is debug set?
Get the pvStructure.
- Returns
- the pvStructure.
- Exceptions
-
Definition at line 101 of file pvaClientData.cpp.
103 if(pvStructure)
return pvStructure;
std::string messagePrefix
Get the interface to a scalar array value field.
- Returns
- Return the interface.
- Exceptions
-
Definition at line 193 of file pvaClientData.cpp.
197 Type type = pvValue->getField()->getType();
pvd::StructureConstPtr type
Base class for a scalarArray.
std::string messagePrefix
static bool getDebug()
Is debug set?
PVScalarPtr epics::pvaClient::PvaClientData::getScalarValue |
( |
| ) |
|
Return the interface to a scalar value field.
- Returns
- The interface for a scalar value field.
- Exceptions
-
Definition at line 172 of file pvaClientData.cpp.
176 if(pvValue->getField()->getType()!=
scalar) {
179 return pvStructure->getSubField<
PVScalar>(
"value");
PVScalar is the base class for each scalar field.
std::string messagePrefix
static bool getDebug()
Is debug set?
PVFieldPtr epics::pvaClient::PvaClientData::getSinglePVField |
( |
| ) |
|
|
protected |
Definition at line 60 of file pvaClientData.cpp.
66 if(fieldPtrArray.size()==0) {
67 throw std::logic_error(
"PvaClientData::getSinglePVField() pvRequest for empty structure");
69 if(fieldPtrArray.size()!=1) {
70 PVFieldPtr pvValue = pvStructure->getSubField(
"value");
72 Type type = pvValue->getField()->getType();
75 throw std::logic_error(
"PvaClientData::getSinglePVField() pvRequest for multiple fields");
78 Type type = pvField->getField()->getType();
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
pvd::StructureConstPtr type
std::vector< PVFieldPtr > PVFieldPtrArray
Data interface for a structure,.
std::tr1::shared_ptr< PVStructure > PVStructurePtr
std::tr1::shared_ptr< PVField > PVFieldPtr
epics::pvData::PVStructurePtr getPVStructure()
Get the pvStructure.
static bool getDebug()
Is debug set?
string epics::pvaClient::PvaClientData::getString |
( |
| ) |
|
Get the value as a string.
- Returns
- The value.
- Exceptions
-
Definition at line 225 of file pvaClientData.cpp.
229 Type type = pvField->getField()->getType();
231 throw std::logic_error(
"PvaClientData::getString() did not find a scalar field");
234 return convert->toString(pvScalar);
PVScalar is the base class for each scalar field.
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
std::tr1::shared_ptr< PVScalar > PVScalarPtr
std::tr1::shared_ptr< PVField > PVFieldPtr
static bool getDebug()
Is debug set?
shared_vector< const string > epics::pvaClient::PvaClientData::getStringArray |
( |
| ) |
|
Get the value as a string array.
- Returns
- The value.
- Exceptions
-
Definition at line 256 of file pvaClientData.cpp.
260 Type type = pvField->getField()->getType();
262 throw std::logic_error(
"PvaClientData::getStringArray() did not find a scalarArray field");
266 pvScalarArray->getAs<
const string>(retValue);
A holder for a contiguous piece of memory.
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
Base class for a scalarArray.
std::tr1::shared_ptr< PVField > PVFieldPtr
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
static bool getDebug()
Is debug set?
Get the structure.
- Returns
- The Structure
- Exceptions
-
Definition at line 96 of file pvaClientData.cpp.
TimeStamp epics::pvaClient::PvaClientData::getTimeStamp |
( |
| ) |
|
Get the timeStamp. If the pvStructure has a timeStamp field, it's values are returned. Otherwise an exception is thrown.
- Returns
- The timeStamp.
Definition at line 286 of file pvaClientData.cpp.
289 if(!pvStructure)
throw new std::runtime_error(
messagePrefix + noStructure);
291 if(!pvs)
throw std::runtime_error(
messagePrefix + noTimeStamp);
295 pvTimeStamp.
get(timeStamp);
void get(TimeStamp &timeStamp) const
Data interface for a structure,.
std::tr1::shared_ptr< PVStructure > PVStructurePtr
std::string messagePrefix
static bool getDebug()
Is debug set?
bool attach(PVFieldPtr const &pvField)
Methods for manipulating timeStamp.
PVFieldPtr epics::pvaClient::PvaClientData::getValue |
( |
| ) |
|
Get the interface to the value field.
- Returns
- The interface.
- Exceptions
-
Definition at line 165 of file pvaClientData.cpp.
static bool getDebug()
Is debug set?
bool epics::pvaClient::PvaClientData::hasValue |
( |
| ) |
|
Is there a top level field named value.
- Returns
- The answer.
Definition at line 142 of file pvaClientData.cpp.
145 if(!pvValue)
return false;
static bool getDebug()
Is debug set?
bool epics::pvaClient::PvaClientData::isValueScalar |
( |
| ) |
|
Is the value field a scalar?
- Returns
- The answer.
Definition at line 149 of file pvaClientData.cpp.
152 if(!pvValue)
return false;
153 if(pvValue->getField()->getType()==
scalar)
return true;
static bool getDebug()
Is debug set?
bool epics::pvaClient::PvaClientData::isValueScalarArray |
( |
| ) |
|
Is the value field a scalar array?
- Returns
- The answer.
Definition at line 157 of file pvaClientData.cpp.
160 if(!pvValue)
return false;
161 if(pvValue->getField()->getType()==
scalarArray)
return true;
static bool getDebug()
Is debug set?
void epics::pvaClient::PvaClientData::parse |
( |
const std::vector< std::string > & |
args | ) |
|
parse from args
Accepts arguments of the form json or field='value' where value is json syntax. field is name.name...
- Parameters
-
- Exceptions
-
Definition at line 345 of file pvaClientData.cpp.
347 if(!pvStructure)
throw std::runtime_error(
messagePrefix + noStructure);
348 if(!bitSet)
throw std::runtime_error(
messagePrefix + noStructure);
349 size_t num = args.size();
350 if(num<1)
throw std::runtime_error(
messagePrefix +
" no arguments");
351 for(
size_t i=0;
i<num; ++
i)
353 string val = args[
i];
354 size_t iequals = val.find_first_of(
'=');
357 if(iequals==std::string::npos) {
358 parse(rest,pvStructure,bitSet);
361 field = val.substr(0,iequals);
362 rest = val.substr(iequals+1);
363 if(field.size()==std::string::npos) {
364 parse(rest,pvStructure,bitSet);
367 PVFieldPtr pvField(pvStructure->getSubField(field));
368 if(!pvField)
throw std::runtime_error(
messagePrefix + field +
" does not exist");
374 for(
size_t i=0;
i<choices.size(); ++
i) {
375 if(choices[
i]==rest) {
385 bitSet->set(pvUnion->getFieldOffset());
388 parse(rest,pvField,bitSet);
void parse(const std::vector< std::string > &args)
parse from args
Methods for accessing an enumerated structure.
bool attach(PVFieldPtr const &pvField)
std::tr1::shared_ptr< PVUnion > PVUnionPtr
bool setIndex(int32 index)
PVUnion has a single subfield.
std::tr1::shared_ptr< PVField > PVFieldPtr
std::string messagePrefix
PVStringArray::const_svector getChoices()
epics::pvaClient::PvaClientData::POINTER_DEFINITIONS |
( |
PvaClientData |
| ) |
|
New data is present.
This is called by other pvaClient classes, i. e. not by client.
- Parameters
-
pvStructureFrom | The new data. |
bitSetFrom | the bitSet showing which values have changed. |
Definition at line 131 of file pvaClientData.cpp.
136 pvStructure = pvStructureFrom;
138 pvValue = pvStructure->getSubField(
"value");
static bool getDebug()
Is debug set?
void epics::pvaClient::PvaClientData::setMessagePrefix |
( |
std::string const & |
value | ) |
|
Set a prefix for throw messages.
This is called by other pvaClient classes.
- Parameters
-
Definition at line 91 of file pvaClientData.cpp.
std::string messagePrefix
std::ostream & epics::pvaClient::PvaClientData::showChanged |
( |
std::ostream & |
out | ) |
|
Show the fields that have changed value since the last get.
- Parameters
-
out | The stream that shows the changed fields. |
- Returns
- The stream that was passed as out.
Definition at line 113 of file pvaClientData.cpp.
115 if(!bitSet)
throw std::runtime_error(
messagePrefix + noStructure);
116 size_t nextSet = bitSet->nextSetBit(0);
118 while(nextSet!=string::npos) {
120 pvField = pvStructure;
122 pvField = pvStructure->getSubField(nextSet);
124 string name = pvField->getFullName();
125 out << name <<
" = " << pvField << endl;
126 nextSet = bitSet->nextSetBit(nextSet+1);
std::tr1::shared_ptr< PVField > PVFieldPtr
std::string messagePrefix
void epics::pvaClient::PvaClientData::streamJSON |
( |
std::ostream & |
strm, |
|
|
bool |
ignoreUnprintable = true , |
|
|
bool |
multiLine = false |
|
) |
| |
generate JSON output from the current PVStructure
- Parameters
-
strm | output stream |
ignoreUnprintable | false or true; default is true. |
multiline | false or true; default is false |
- Exceptions
-
Definition at line 392 of file pvaClientData.cpp.
401 printJSON(strm,*pvStructure,*bitSet,opts);
403 throw std::runtime_error(
"JSON support not built");
bool ignoreUnprintable
ignore union/union array when encountered
Options used during printing.
void printJSON(std::ostream &strm, const PVStructure &val, const BitSet &mask, const JSONPrintOptions &opts)
bool multiLine
include new lines
void epics::pvaClient::PvaClientData::zeroArrayLength |
( |
| ) |
|
set length of all array fields to 0
Definition at line 302 of file pvaClientData.cpp.
304 if(!pvStructure)
throw new std::runtime_error(
messagePrefix + noStructure);
void zeroArrayLength()
set length of all array fields to 0
std::string messagePrefix
std::string epics::pvaClient::PvaClientData::messagePrefix |
|
protected |
The documentation for this class was generated from the following files: