This is Unofficial EPICS BASE Doxygen Site
epics::pvaClient::PvaClientData Class Reference

A base class for PvaClientGetData, PvaClientPutData, and PvaClientMonitorData. More...

#include "pvaClient.h"

+ Inheritance diagram for epics::pvaClient::PvaClientData:
+ Collaboration diagram for epics::pvaClient::PvaClientData:

Public Member Functions

 POINTER_DEFINITIONS (PvaClientData)
 
 ~PvaClientData ()
 Destructor. More...
 
void setMessagePrefix (std::string const &value)
 Set a prefix for throw messages. More...
 
epics::pvData::StructureConstPtr getStructure ()
 Get the structure. More...
 
epics::pvData::PVStructurePtr getPVStructure ()
 Get the pvStructure. More...
 
epics::pvData::BitSetPtr getChangedBitSet ()
 Get the changed BitSet for the pvStructure. More...
 
std::ostream & showChanged (std::ostream &out)
 Show the fields that have changed value since the last get. More...
 
void setData (epics::pvData::PVStructurePtr const &pvStructureFrom, epics::pvData::BitSetPtr const &bitSetFrom)
 New data is present. More...
 
bool hasValue ()
 Is there a top level field named value. More...
 
bool isValueScalar ()
 Is the value field a scalar? More...
 
bool isValueScalarArray ()
 Is the value field a scalar array? More...
 
epics::pvData::PVFieldPtr getValue ()
 Get the interface to the value field. More...
 
epics::pvData::PVScalarPtr getScalarValue ()
 Return the interface to a scalar value field. More...
 
std::tr1::shared_ptr< epics::pvData::PVArraygetArrayValue ()
 Get the interface to an array value field. More...
 
std::tr1::shared_ptr< epics::pvData::PVScalarArraygetScalarArrayValue ()
 Get the interface to a scalar array value field. More...
 
double getDouble ()
 Get the value as a double. More...
 
std::string getString ()
 
epics::pvData::shared_vector< const double > getDoubleArray ()
 Get the value as a double array. More...
 
epics::pvData::shared_vector< const std::string > getStringArray ()
 Get the value as a string array. More...
 
epics::pvData::Alarm getAlarm ()
 Get the alarm. If the pvStructure has an alarm field it's values are returned. Otherwise an exception is thrown. More...
 
epics::pvData::TimeStamp getTimeStamp ()
 Get the timeStamp. If the pvStructure has a timeStamp field, it's values are returned. Otherwise an exception is thrown. More...
 
void parse (const std::vector< std::string > &args)
 parse from args More...
 
void streamJSON (std::ostream &strm, bool ignoreUnprintable=true, bool multiLine=false)
 generate JSON output from the current PVStructure More...
 
void zeroArrayLength ()
 set length of all array fields to 0 More...
 

Static Public Member Functions

static PvaClientDataPtr create (epics::pvData::StructureConstPtr const &structure)
 Factory method for creating an instance of PvaClientData. More...
 

Protected Member Functions

 PvaClientData (epics::pvData::StructureConstPtr const &structure)
 
epics::pvData::PVFieldPtr getSinglePVField ()
 
void checkValue ()
 

Protected Attributes

std::string messagePrefix
 

Friends

class PvaClientGet
 
class PvaClientPutGet
 

Detailed Description

Constructor & Destructor Documentation

epics::pvaClient::PvaClientData::~PvaClientData ( )
inline

Destructor.

Definition at line 576 of file pvaClient.h.

576 {}
epics::pvaClient::PvaClientData::PvaClientData ( epics::pvData::StructureConstPtr const &  structure)
protected

Definition at line 55 of file pvaClientData.cpp.

Member Function Documentation

void epics::pvaClient::PvaClientData::checkValue ( )
protected

Definition at line 84 of file pvaClientData.cpp.

85 {
86  if(PvaClient::getDebug()) cout << "PvaClientData::checkValue\n";
87  if(pvValue) return;
88  throw std::runtime_error(messagePrefix + noValue);
89 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientDataPtr epics::pvaClient::PvaClientData::create ( epics::pvData::StructureConstPtr const &  structure)
static

Factory method for creating an instance of PvaClientData.

NOTE: Not normally called by clients

Parameters
structureIntrospection interface
Exceptions
runtime_errorif failure.

Definition at line 48 of file pvaClientData.cpp.

49 {
50  if(PvaClient::getDebug()) cout << "PvaClientData::create\n";
52  return epv;
53 }
PvaClientData(epics::pvData::StructureConstPtr const &structure)
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
std::tr1::shared_ptr< PvaClientData > PvaClientDataPtr
Definition: pvaClient.h:48
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
runtime_errorif failure.

Definition at line 270 of file pvaClientData.cpp.

271 {
272  if(PvaClient::getDebug()) cout << "PvaClientData::getAlarm\n";
273  if(!pvStructure) throw new std::runtime_error(messagePrefix + noStructure);
274  PVStructurePtr pvs = pvStructure->getSubField<PVStructure>("alarm");
275  if(!pvs) throw std::runtime_error(messagePrefix + noAlarm);
276  pvAlarm.attach(pvs);
277  if(pvAlarm.isAttached()) {
278  Alarm alarm;
279  pvAlarm.get(alarm);
280  pvAlarm.detach();
281  return alarm;
282  }
283  throw std::runtime_error(messagePrefix + noAlarm);
284 }
Methods for manipulating alarm.
Definition: alarm.h:105
bool attach(PVFieldPtr const &pvField)
Definition: pvAlarm.cpp:26
void get(Alarm &alarm) const
Definition: pvAlarm.cpp:59
Data interface for a structure,.
Definition: pvData.h:712
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PVArrayPtr epics::pvaClient::PvaClientData::getArrayValue ( )

Get the interface to an array value field.

Returns
The interface.
Exceptions
runtime_errorif failure.

Definition at line 182 of file pvaClientData.cpp.

183 {
184  if(PvaClient::getDebug()) cout << "PvaClientData::getArrayValue\n";
185  checkValue();
186  Type type = pvValue->getField()->getType();
187  if(type!=scalarArray && type!=structureArray && type!=unionArray) {
188  throw std::runtime_error(messagePrefix + noArray);
189  }
190  return pvStructure->getSubField<PVArray>("value");
191 }
pvd::StructureConstPtr type
PVArray is the base class for all array types.
Definition: pvData.h:551
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
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
runtime_errorif failure

Definition at line 107 of file pvaClientData.cpp.

108 {
109  if(bitSet)return bitSet;
110  throw std::runtime_error(messagePrefix + noStructure);
111 }
double epics::pvaClient::PvaClientData::getDouble ( )

Get the value as a double.

Returns
The value.
Exceptions
runtime_errorif failure.

Definition at line 204 of file pvaClientData.cpp.

205 {
206  if(PvaClient::getDebug()) cout << "PvaClientData::getDouble\n";
207  PVFieldPtr pvField = getSinglePVField();
208  Type type = pvField->getField()->getType();
209  if(type!=scalar) {
210  throw std::logic_error("PvaClientData::getDouble() did not find a scalar field");
211  }
212  PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
213  ScalarType scalarType = pvScalar->getScalar()->getScalarType();
214  if(scalarType==pvDouble) {
216  return pvDouble->get();
217  }
218  if(!ScalarTypeFunc::isNumeric(scalarType)) {
219  throw std::logic_error(
220  "PvaClientData::getDouble() did not find a numeric scalar field");
221  }
222  return convert->toDouble(pvScalar);
223 }
PVScalar is the base class for each scalar field.
Definition: pvData.h:272
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
pvd::StructureConstPtr type
storage_t::arg_type get() const
Definition: pvData.h:396
const ScalarConstPtr getScalar() const
Definition: PVScalar.cpp:27
epics::pvData::PVFieldPtr getSinglePVField()
bool isNumeric(ScalarType type)
Definition: TypeFunc.cpp:53
std::tr1::shared_ptr< PVScalar > PVScalarPtr
Definition: pvData.h:77
Class that holds the data for each possible scalar type.
Definition: pvData.h:54
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
std::tr1::shared_ptr< PVDouble > PVDoublePtr
Definition: pvData.h:514
shared_vector< const double > epics::pvaClient::PvaClientData::getDoubleArray ( )

Get the value as a double array.

Returns
The value.
Exceptions
runtime_errorif failure.

Definition at line 237 of file pvaClientData.cpp.

238 {
239  if(PvaClient::getDebug()) cout << "PvaClientData::getDoubleArray\n";
240  PVFieldPtr pvField = getSinglePVField();
241  Type type = pvField->getField()->getType();
242  if(type!=scalarArray) {
243  throw std::logic_error("PvaClientData::getDoubleArray() did not find a scalarArray field");
244  }
245  PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
246  ScalarType scalarType = pvScalarArray->getScalarArray()->getElementType();
247  if(!ScalarTypeFunc::isNumeric(scalarType)) {
248  throw std::logic_error(
249  "PvaClientData::getDoubleArray() did not find a numeric scalarArray field");
250  }
252  pvScalarArray->getAs<const double>(retValue);
253  return retValue;
254 }
A holder for a contiguous piece of memory.
Definition: sharedVector.h:27
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
bool isNumeric(ScalarType type)
Definition: TypeFunc.cpp:53
Base class for a scalarArray.
Definition: pvData.h:618
const ScalarArrayConstPtr getScalarArray() const
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PVStructurePtr epics::pvaClient::PvaClientData::getPVStructure ( )

Get the pvStructure.

Returns
the pvStructure.
Exceptions
runtime_errorif failure.

Definition at line 101 of file pvaClientData.cpp.

102 {
103  if(pvStructure) return pvStructure;
104  throw std::runtime_error(messagePrefix + noStructure);
105 }
PVScalarArrayPtr epics::pvaClient::PvaClientData::getScalarArrayValue ( )

Get the interface to a scalar array value field.

Returns
Return the interface.
Exceptions
runtime_errorif failure.

Definition at line 193 of file pvaClientData.cpp.

194 {
195  if(PvaClient::getDebug()) cout << "PvaClientData::getScalarArrayValue\n";
196  checkValue();
197  Type type = pvValue->getField()->getType();
198  if(type!=scalarArray) {
199  throw std::runtime_error(messagePrefix + noScalarArray);
200  }
201  return pvStructure->getSubField<PVScalarArray>("value");
202 }
pvd::StructureConstPtr type
Base class for a scalarArray.
Definition: pvData.h:618
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PVScalarPtr epics::pvaClient::PvaClientData::getScalarValue ( )

Return the interface to a scalar value field.

Returns
The interface for a scalar value field.
Exceptions
runtime_errorif failure.

Definition at line 172 of file pvaClientData.cpp.

173 {
174  if(PvaClient::getDebug()) cout << "PvaClientData::getScalarValue\n";
175  checkValue();
176  if(pvValue->getField()->getType()!=scalar) {
177  throw std::runtime_error(messagePrefix + noScalar);
178  }
179  return pvStructure->getSubField<PVScalar>("value");
180 }
PVScalar is the base class for each scalar field.
Definition: pvData.h:272
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PVFieldPtr epics::pvaClient::PvaClientData::getSinglePVField ( )
protected

Definition at line 60 of file pvaClientData.cpp.

61 {
62  if(PvaClient::getDebug()) cout << "PvaClientData::getSinglePVField\n";
63  PVStructurePtr pvStructure = getPVStructure();
64  while(true) {
65  const PVFieldPtrArray fieldPtrArray(pvStructure->getPVFields());
66  if(fieldPtrArray.size()==0) {
67  throw std::logic_error("PvaClientData::getSinglePVField() pvRequest for empty structure");
68  }
69  if(fieldPtrArray.size()!=1) {
70  PVFieldPtr pvValue = pvStructure->getSubField("value");
71  if(pvValue) {
72  Type type = pvValue->getField()->getType();
73  if(type!=epics::pvData::structure) return pvValue;
74  }
75  throw std::logic_error("PvaClientData::getSinglePVField() pvRequest for multiple fields");
76  }
77  PVFieldPtr pvField(fieldPtrArray[0]);
78  Type type = pvField->getField()->getType();
79  if(type!=epics::pvData::structure) return pvField;
80  pvStructure = static_pointer_cast<PVStructure>(pvField);
81  }
82 }
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
pvd::StructureConstPtr type
std::vector< PVFieldPtr > PVFieldPtrArray
Definition: pvData.h:70
Data interface for a structure,.
Definition: pvData.h:712
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
epics::pvData::PVStructurePtr getPVStructure()
Get the pvStructure.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
string epics::pvaClient::PvaClientData::getString ( )

Get the value as a string.

Returns
The value.
Exceptions
runtime_errorif failure.

Definition at line 225 of file pvaClientData.cpp.

226 {
227  if(PvaClient::getDebug()) cout << "PvaClientData::getString\n";
228  PVFieldPtr pvField = getSinglePVField();
229  Type type = pvField->getField()->getType();
230  if(type!=scalar) {
231  throw std::logic_error("PvaClientData::getString() did not find a scalar field");
232  }
233  PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
234  return convert->toString(pvScalar);
235 }
PVScalar is the base class for each scalar field.
Definition: pvData.h:272
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
std::tr1::shared_ptr< PVScalar > PVScalarPtr
Definition: pvData.h:77
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
shared_vector< const string > epics::pvaClient::PvaClientData::getStringArray ( )

Get the value as a string array.

Returns
The value.
Exceptions
runtime_errorif failure.

Definition at line 256 of file pvaClientData.cpp.

257 {
258  if(PvaClient::getDebug()) cout << "PvaClientData::getStringArray\n";
259  PVFieldPtr pvField = getSinglePVField();
260  Type type = pvField->getField()->getType();
261  if(type!=scalarArray) {
262  throw std::logic_error("PvaClientData::getStringArray() did not find a scalarArray field");
263  }
264  PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
266  pvScalarArray->getAs<const string>(retValue);
267  return retValue;
268 }
A holder for a contiguous piece of memory.
Definition: sharedVector.h:27
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
pvd::StructureConstPtr type
epics::pvData::PVFieldPtr getSinglePVField()
Base class for a scalarArray.
Definition: pvData.h:618
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
StructureConstPtr epics::pvaClient::PvaClientData::getStructure ( )

Get the structure.

Returns
The Structure
Exceptions
runtime_errorif failure.

Definition at line 96 of file pvaClientData.cpp.

97 {
98  return structure;
99 }
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.

287 {
288  if(PvaClient::getDebug()) cout << "PvaClientData::getTimeStamp\n";
289  if(!pvStructure) throw new std::runtime_error(messagePrefix + noStructure);
290  PVStructurePtr pvs = pvStructure->getSubField<PVStructure>("timeStamp");
291  if(!pvs) throw std::runtime_error(messagePrefix + noTimeStamp);
292  pvTimeStamp.attach(pvs);
293  if(pvTimeStamp.isAttached()) {
294  TimeStamp timeStamp;
295  pvTimeStamp.get(timeStamp);
296  pvTimeStamp.detach();
297  return timeStamp;
298  }
299  throw std::runtime_error(messagePrefix + noTimeStamp);
300 }
void get(TimeStamp &timeStamp) const
Definition: pvTimeStamp.cpp:61
Data interface for a structure,.
Definition: pvData.h:712
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
bool attach(PVFieldPtr const &pvField)
Definition: pvTimeStamp.cpp:26
Methods for manipulating timeStamp.
Definition: timeStamp.h:43
PVFieldPtr epics::pvaClient::PvaClientData::getValue ( )

Get the interface to the value field.

Returns
The interface.
Exceptions
runtime_errorif failure.

Definition at line 165 of file pvaClientData.cpp.

166 {
167  if(PvaClient::getDebug()) cout << "PvaClientData::getValue\n";
168  checkValue();
169  return pvValue;
170 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
bool epics::pvaClient::PvaClientData::hasValue ( )

Is there a top level field named value.

Returns
The answer.

Definition at line 142 of file pvaClientData.cpp.

143 {
144  if(PvaClient::getDebug()) cout << "PvaClientData::hasValue\n";
145  if(!pvValue) return false;
146  return true;
147 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
bool epics::pvaClient::PvaClientData::isValueScalar ( )

Is the value field a scalar?

Returns
The answer.

Definition at line 149 of file pvaClientData.cpp.

150 {
151  if(PvaClient::getDebug()) cout << "PvaClientData::isValueScalar\n";
152  if(!pvValue) return false;
153  if(pvValue->getField()->getType()==scalar) return true;
154  return false;
155 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
bool epics::pvaClient::PvaClientData::isValueScalarArray ( )

Is the value field a scalar array?

Returns
The answer.

Definition at line 157 of file pvaClientData.cpp.

158 {
159  if(PvaClient::getDebug()) cout << "PvaClientData::isValueScalarArray\n";
160  if(!pvValue) return false;
161  if(pvValue->getField()->getType()==scalarArray) return true;
162  return false;
163 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
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
argsThe arguments
Exceptions
runtime_errorif failure.

Definition at line 345 of file pvaClientData.cpp.

346 {
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)
352  {
353  string val = args[i];
354  size_t iequals = val.find_first_of('=');
355  string field;
356  string rest(val);
357  if(iequals==std::string::npos) {
358  parse(rest,pvStructure,bitSet);
359  continue;
360  }
361  field = val.substr(0,iequals);
362  rest = val.substr(iequals+1);
363  if(field.size()==std::string::npos) {
364  parse(rest,pvStructure,bitSet);
365  continue;
366  }
367  PVFieldPtr pvField(pvStructure->getSubField(field));
368  if(!pvField) throw std::runtime_error(messagePrefix + field +" does not exist");
369  // look for enumerated structure
370  PVEnumerated pvEnumerated;
371  bool result = pvEnumerated.attach(pvField);
372  if(result) {
373  PVStringArray::const_svector choices(pvEnumerated.getChoices());
374  for(size_t i=0; i<choices.size(); ++i) {
375  if(choices[i]==rest) {
376  pvEnumerated.setIndex(i);
377  return;
378  }
379  }
380  }
381  // look for union
382  PVUnionPtr pvUnion(pvStructure->getSubField<PVUnion>(field));
383  if(pvUnion) {
384  parse(rest,pvUnion);
385  bitSet->set(pvUnion->getFieldOffset());
386  return;
387  }
388  parse(rest,pvField,bitSet);
389  }
390 }
pvac::PutEvent result
Definition: clientSync.cpp:117
void parse(const std::vector< std::string > &args)
parse from args
int i
Definition: scan.c:967
Methods for accessing an enumerated structure.
Definition: pvEnumerated.h:34
bool attach(PVFieldPtr const &pvField)
std::tr1::shared_ptr< PVUnion > PVUnionPtr
Definition: pvData.h:107
bool setIndex(int32 index)
PVUnion has a single subfield.
Definition: pvData.h:940
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
PVStringArray::const_svector getChoices()
Definition: pvEnumerated.h:91
epics::pvaClient::PvaClientData::POINTER_DEFINITIONS ( PvaClientData  )
void epics::pvaClient::PvaClientData::setData ( epics::pvData::PVStructurePtr const &  pvStructureFrom,
epics::pvData::BitSetPtr const &  bitSetFrom 
)

New data is present.

This is called by other pvaClient classes, i. e. not by client.

Parameters
pvStructureFromThe new data.
bitSetFromthe bitSet showing which values have changed.

Definition at line 131 of file pvaClientData.cpp.

134 {
135  if(PvaClient::getDebug()) cout << "PvaClientData::setData\n";
136  pvStructure = pvStructureFrom;
137  bitSet = bitSetFrom;
138  pvValue = pvStructure->getSubField("value");
139 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientData::setMessagePrefix ( std::string const &  value)

Set a prefix for throw messages.

This is called by other pvaClient classes.

Parameters
valueThe prefix.

Definition at line 91 of file pvaClientData.cpp.

92 {
93  messagePrefix = value + " ";
94 }
Definition: link.h:174
std::ostream & epics::pvaClient::PvaClientData::showChanged ( std::ostream &  out)

Show the fields that have changed value since the last get.

Parameters
outThe stream that shows the changed fields.
Returns
The stream that was passed as out.

Definition at line 113 of file pvaClientData.cpp.

114 {
115  if(!bitSet) throw std::runtime_error(messagePrefix + noStructure);
116  size_t nextSet = bitSet->nextSetBit(0);
117  PVFieldPtr pvField;
118  while(nextSet!=string::npos) {
119  if(nextSet==0) {
120  pvField = pvStructure;
121  } else {
122  pvField = pvStructure->getSubField(nextSet);
123  }
124  string name = pvField->getFullName();
125  out << name << " = " << pvField << endl;
126  nextSet = bitSet->nextSetBit(nextSet+1);
127  }
128  return out;
129 }
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
void epics::pvaClient::PvaClientData::streamJSON ( std::ostream &  strm,
bool  ignoreUnprintable = true,
bool  multiLine = false 
)

generate JSON output from the current PVStructure

Parameters
strmoutput stream
ignoreUnprintablefalse or true; default is true.
multilinefalse or true; default is false
Exceptions
runtime_errorif failure.

Definition at line 392 of file pvaClientData.cpp.

396 {
397 #ifdef USE_JSON
398  JSONPrintOptions opts;
399  opts.ignoreUnprintable = ignoreUnprintable;
400  opts.multiLine = multiLine;
401  printJSON(strm,*pvStructure,*bitSet,opts);
402 #else
403  throw std::runtime_error("JSON support not built");
404 #endif
405 }
bool ignoreUnprintable
ignore union/union array when encountered
Definition: json.h:45
Options used during printing.
Definition: json.h:42
void printJSON(std::ostream &strm, const PVStructure &val, const BitSet &mask, const JSONPrintOptions &opts)
Definition: print.cpp:211
bool multiLine
include new lines
Definition: json.h:44
void epics::pvaClient::PvaClientData::zeroArrayLength ( )

set length of all array fields to 0

Definition at line 302 of file pvaClientData.cpp.

303 {
304  if(!pvStructure) throw new std::runtime_error(messagePrefix + noStructure);
305  zeroArrayLength(pvStructure);
306 }
void zeroArrayLength()
set length of all array fields to 0

Friends And Related Function Documentation

friend class PvaClientGet
friend

Definition at line 736 of file pvaClient.h.

friend class PvaClientPutGet
friend

Definition at line 737 of file pvaClient.h.

Member Data Documentation

std::string epics::pvaClient::PvaClientData::messagePrefix
protected

Definition at line 718 of file pvaClient.h.


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