|
PVData C++
8.0.2
|
Conversion and Copy facility for pvData. More...
#include <pv/convert.h>
Public Member Functions | |
| void | copy (PVFieldPtr const &from, PVFieldPtr const &to) |
| void | getString (std::string *buf, PVFieldPtr const &pvField) |
| void | getString (std::string *buf, PVField const *pvField, int indentLevel) |
| std::size_t | fromString (PVStructurePtr const &pv, StringArray const &from, std::size_t fromStartIndex=0) |
| void | fromString (PVScalarPtr const &pv, std::string const &from) |
| std::size_t | fromString (PVScalarArrayPtr const &pv, std::string from) |
| std::size_t | fromStringArray (PVScalarArrayPtr const &pv, std::size_t offset, std::size_t length, StringArray const &from, std::size_t fromOffset) |
| std::size_t | toStringArray (PVScalarArrayPtr const &pv, std::size_t offset, std::size_t length, StringArray &to, std::size_t toOffset) |
| int8 | toByte (PVScalarPtr const &pv) |
| int16 | toShort (PVScalarPtr const &pv) |
| int32 | toInt (PVScalarPtr const &pv) |
| int64 | toLong (PVScalarPtr const &pv) |
| uint8 | toUByte (PVScalarPtr const &pv) |
| uint16 | toUShort (PVScalarPtr const &pv) |
| uint32 | toUInt (PVScalarPtr const &pv) |
| uint64 | toULong (PVScalarPtr const &pv) |
| float | toFloat (PVScalarPtr const &pv) |
| double | toDouble (PVScalarPtr const &pv) |
| std::string | toString (PVScalarPtr const &pv) |
| void | fromByte (PVScalarPtr const &pv, int8 from) |
| void | fromShort (PVScalarPtr const &pv, int16 from) |
| void | fromInt (PVScalarPtr const &pv, int32 from) |
| void | fromLong (PVScalarPtr const &pv, int64 from) |
| void | fromUByte (PVScalarPtr const &pv, uint8 from) |
| void | fromUShort (PVScalarPtr const &pv, uint16 from) |
| void | fromUInt (PVScalarPtr const &pv, uint32 from) |
| void | fromULong (PVScalarPtr const &pv, uint64 from) |
| void | fromFloat (PVScalarPtr const &pv, float from) |
| void | fromDouble (PVScalarPtr const &pv, double from) |
Static Public Member Functions | |
| static ConvertPtr | getConvert () |
Conversion and Copy facility for pvData.
Convert between numeric types, convert any field to a string, or convert from a string to a scalar field.
Numeric conversions are between scalar numeric types or between arrays of numeric types. It is not possible to convert between a scalar and an array. Numeric conversions are between types: pvByte, pvShort, pvInt, pvLong, pvUByte, pvUShort, pvUInt, pvULong, pvFloat, or pvDouble.
getString converts any supported type to a std::string.
fromString converts a std::string to a scalar. fromStringArray converts an array of std::strings to a pvArray, which must have a scaler element type. A scalar field is a numeric field or pvBoolean or pvString.
All from methods put data into a PVField, e.g. from means where the PVField gets it's data.
|
inline |
Copy from a PVField to another PVField. This calls one on copyScalar, copyArray, copyStructure. The two arguments must be compatible.
| from | The source. |
| to | The destination |
| std::invalid_argument | if the arguments are not compatible. |
|
inline |
Convert a PV from a byte
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a double
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a float
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from an int
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a long
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a short
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
| std::size_t epics::pvData::Convert::fromString | ( | PVStructurePtr const & | pv, |
| StringArray const & | from, | ||
| std::size_t | fromStartIndex = 0 |
||
| ) |
Convert from an array of std::string to a PVStructure
| pv | The PV. |
| from | The array of std::string value to convert and put into a PV. |
| fromStartIndex | The first element if the array of strings. |
| std::logic_error | if the array of std::string does not have a valid values. |
|
inline |
Convert from a std::string to a PVScalar
| pv | The PV. |
| from | The std::string value to convert and put into a PV. |
| std::logic_error | if the std::string does not have a valid value. |
| std::size_t epics::pvData::Convert::fromString | ( | PVScalarArrayPtr const & | pv, |
| std::string | from | ||
| ) |
Convert from a std::string to a PVScalarArray. The std::string must be a comma separated set of values optionally enclosed in []
| pv | The PV. |
| from | The std::string value to convert and put into a PV. |
| std::invalid_argument | if the element Type is not a scalar. |
| std::logic_error | if the std::string does not have a valid array values. |
| std::size_t epics::pvData::Convert::fromStringArray | ( | PVScalarArrayPtr const & | pv, |
| std::size_t | offset, | ||
| std::size_t | length, | ||
| StringArray const & | from, | ||
| std::size_t | fromOffset | ||
| ) |
Convert a PVScalarArray from a std::string array. The array element type must be a scalar.
| pv | The PV. |
| offset | Starting element in a PV. |
| length | The number of elements to transfer. |
| from | The array of values to put into the PV. |
| fromOffset | Starting element in the source array. |
| std::invalid_argument | if the element Type is not a scalar. |
| std::logic_error | if the std::string does not have a valid value. |
|
inline |
Convert a PV from a ubyte
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from an uint
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a ulong
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV from a ushort
| pv | a PV |
| from | value to put into PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
| void epics::pvData::Convert::getString | ( | std::string * | buf, |
| PVField const * | pvField, | ||
| int | indentLevel | ||
| ) |
|
inline |
|
inline |
Convert a PV to a double
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to a float
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to a int.
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to an long
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to a short.
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
| std::size_t epics::pvData::Convert::toStringArray | ( | PVScalarArrayPtr const & | pv, |
| std::size_t | offset, | ||
| std::size_t | length, | ||
| StringArray & | to, | ||
| std::size_t | toOffset | ||
| ) |
Convert a PVScalarArray to a std::string array.
| pv | The PV. |
| offset | Starting element in the PV array. |
| length | Number of elements to convert to the string array. |
| to | std::string array to receive the converted PV data. |
| toOffset | Starting element in the string array. |
|
inline |
|
inline |
Convert a PV to a uint.
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to an ulong
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
|
inline |
Convert a PV to a ushort.
| pv | a PV |
| std::invalid_argument | if the Type is not a numeric scalar |
1.8.13