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

A class that holds data given to by PvaClientPut or PvaClientPutGet. More...

#include "pvaClient.h"

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

Public Member Functions

 POINTER_DEFINITIONS (PvaClientPutData)
 
 ~PvaClientPutData ()
 Destructor. More...
 
void putDouble (double value)
 Put the value as a double. More...
 
void putString (std::string const &value)
 Put the value as a string. More...
 
void putDoubleArray (epics::pvData::shared_vector< const double > const &value)
 Copy the array to the value field. More...
 
void putStringArray (epics::pvData::shared_vector< const std::string > const &value)
 Copy array to the value field. More...
 
void putStringArray (std::vector< std::string > const &value)
 Copy array to the value field. More...
 
- Public Member Functions inherited from epics::pvaClient::PvaClientData
 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 PvaClientPutDataPtr create (epics::pvData::StructureConstPtr const &structure)
 
- Static Public Member Functions inherited from epics::pvaClient::PvaClientData
static PvaClientDataPtr create (epics::pvData::StructureConstPtr const &structure)
 Factory method for creating an instance of PvaClientData. More...
 

Friends

class PvaClientPostHandlerPvt
 
class PvaClientPut
 
class PvaClientPutGet
 

Additional Inherited Members

- Protected Member Functions inherited from epics::pvaClient::PvaClientData
 PvaClientData (epics::pvData::StructureConstPtr const &structure)
 
epics::pvData::PVFieldPtr getSinglePVField ()
 
void checkValue ()
 
- Protected Attributes inherited from epics::pvaClient::PvaClientData
std::string messagePrefix
 

Detailed Description

A class that holds data given to by PvaClientPut or PvaClientPutGet.

Overview of PvaClientPutData

Definition at line 772 of file pvaClient.h.

Constructor & Destructor Documentation

epics::pvaClient::PvaClientPutData::~PvaClientPutData ( )
inline

Destructor.

Definition at line 779 of file pvaClient.h.

779 {}

Member Function Documentation

PvaClientPutDataPtr epics::pvaClient::PvaClientPutData::create ( epics::pvData::StructureConstPtr const &  structure)
static

Factory method for creating an instance of PvaClientGetData. NOTE: Not normally called by clients

Parameters
structureIntrospection interface

Definition at line 44 of file pvaClientPutData.cpp.

45 {
46  if(PvaClient::getDebug()) cout << "PvaClientPutData::create\n";
47  PvaClientPutDataPtr epv(new PvaClientPutData(structure));
48  return epv;
49 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
std::tr1::shared_ptr< PvaClientPutData > PvaClientPutDataPtr
Definition: pvaClient.h:52
epics::pvaClient::PvaClientPutData::POINTER_DEFINITIONS ( PvaClientPutData  )
void epics::pvaClient::PvaClientPutData::putDouble ( double  value)

Put the value as a double.

Parameters
valueThe new value. An exception is also thrown if the actualy type can cause an overflow.
Exceptions
runtime_errorif failure.

Definition at line 74 of file pvaClientPutData.cpp.

75 {
76  if(PvaClient::getDebug()) cout << "PvaClientPutData::putDouble\n";
77  PVFieldPtr pvField = getSinglePVField();
78  Type type = pvField->getField()->getType();
79  if(type!=scalar) {
80  throw std::logic_error("PvaClientData::putDouble() did not find a scalar field");
81  }
82  PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
83  ScalarType scalarType = pvScalar->getScalar()->getScalarType();
84  if(scalarType==pvDouble) {
86  pvDouble->put(value);
87  return;
88  }
89  if(!ScalarTypeFunc::isNumeric(scalarType)) {
90  throw std::logic_error(
91  "PvaClientData::putDouble() did not find a numeric scalar field");
92  }
93  convert->fromDouble(pvScalar,value);
94 }
Definition: link.h:174
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
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
void put(typename storage_t::arg_type v)
Definition: pvData.h:401
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
void epics::pvaClient::PvaClientPutData::putDoubleArray ( epics::pvData::shared_vector< const double > const &  value)

Copy the array to the value field.

Parameters
valueThe place where data is copied.
Exceptions
runtime_errorif failure.

Definition at line 108 of file pvaClientPutData.cpp.

109 {
110  if(PvaClient::getDebug()) cout << "PvaClientPutData::putDoubleArray\n";
111  PVFieldPtr pvField = getSinglePVField();
112  Type type = pvField->getField()->getType();
113  if(type!=scalarArray) {
114  throw std::logic_error("PvaClientData::putDoubleArray() did not find a scalarArray field");
115  }
116  PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
117  ScalarType scalarType = pvScalarArray->getScalarArray()->getElementType();
118  if(!ScalarTypeFunc::isNumeric(scalarType)) {
119  throw std::logic_error(
120  "PvaClientData::putDoubleArray() did not find a numeric scalarArray field");
121  }
122  pvScalarArray->putFrom<const double>(value);
123 }
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
void epics::pvaClient::PvaClientPutData::putString ( std::string const &  value)

Put the value as a string.

If value is not a scalar an exception is thrown.

Definition at line 96 of file pvaClientPutData.cpp.

97 {
98  if(PvaClient::getDebug()) cout << "PvaClientPutData::putString\n";
99  PVFieldPtr pvField = getSinglePVField();
100  Type type = pvField->getField()->getType();
101  if(type!=scalar) {
102  throw std::logic_error("PvaClientData::putString() did not find a scalar field");
103  }
104  PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
105  convert->fromString(pvScalar,value);
106 }
Definition: link.h:174
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
void epics::pvaClient::PvaClientPutData::putStringArray ( epics::pvData::shared_vector< const std::string > const &  value)

Copy array to the value field.

Parameters
valuedata source
Exceptions
runtime_errorif failure.

Definition at line 125 of file pvaClientPutData.cpp.

126 {
127  if(PvaClient::getDebug()) cout << "PvaClientPutData::putStringArray\n";
128  PVFieldPtr pvField = getSinglePVField();
129  Type type = pvField->getField()->getType();
130  if(type!=scalarArray) {
131  throw std::logic_error("PvaClientData::putStringArray() did not find a scalarArray field");
132  }
133  PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
134  pvScalarArray->putFrom<const string>(value);
135  return;
136 }
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
void putFrom(const shared_vector< const T > &inp)
Definition: pvData.h:666
std::tr1::shared_ptr< PVScalarArray > PVScalarArrayPtr
Definition: pvData.h:82
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutData::putStringArray ( std::vector< std::string > const &  value)

Copy array to the value field.

Parameters
valuedata source
Exceptions
runtime_errorif failure.

Friends And Related Function Documentation

friend class PvaClientPostHandlerPvt
friend

Definition at line 815 of file pvaClient.h.

friend class PvaClientPut
friend

Definition at line 816 of file pvaClient.h.

friend class PvaClientPutGet
friend

Definition at line 817 of file pvaClient.h.


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