From a7fde21300979798207bd212b59155a01eca81fd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 30 Apr 2013 14:04:24 -0400 Subject: [PATCH] replace scalar to/from in Convert --- pvDataApp/factory/Convert.cpp | 711 ---------------------------------- pvDataApp/pv/convert.h | 42 +- 2 files changed, 21 insertions(+), 732 deletions(-) diff --git a/pvDataApp/factory/Convert.cpp b/pvDataApp/factory/Convert.cpp index ced8c69..c1f01f9 100644 --- a/pvDataApp/factory/Convert.cpp +++ b/pvDataApp/factory/Convert.cpp @@ -30,307 +30,6 @@ static void newLineImpl(StringBuilder buffer, int indentLevel) for(int i=0; i -T toScalar(PVScalarPtr const &pv) -{ - ScalarConstPtr scalar = pv->getScalar(); - ScalarType scalarType = scalar->getScalarType(); - switch(scalarType) { - case pvBoolean: - throw std::logic_error(String("boolean can not be converted to scalar")); - case pvByte: { - PVBytePtr value = static_pointer_cast(pv); - return value->get(); - } - case pvShort: { - PVShortPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvInt: { - PVIntPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvLong: { - PVLongPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvUByte: { - PVUBytePtr value = static_pointer_cast(pv); - return value->get(); - } - case pvUShort: { - PVUShortPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvUInt: { - PVUIntPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvULong: { - PVULongPtr value = static_pointer_cast(pv); - return value->get(); - } - case pvFloat: { - PVFloatPtr value = static_pointer_cast(pv); - return static_cast(value->get()); - } - case pvDouble: { - PVDoublePtr value = static_pointer_cast(pv); - return static_cast(value->get()); - } - case pvString: - throw std::logic_error(String("string can not be converted to byte")); - } - throw std::logic_error("Logic error. Should never get here."); -} - -int8 Convert::toByte(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -int16 Convert::toShort(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -int32 Convert::toInt(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -int64 Convert::toLong(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -uint8 Convert::toUByte(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -uint16 Convert::toUShort(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -uint32 Convert::toUInt(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -uint64 Convert::toULong(PVScalarPtr const &pv) -{ - return toScalar(pv); -} - -float Convert::toFloat(PVScalarPtr const &pv) -{ - return toScalar(pv); -} - -double Convert::toDouble(PVScalarPtr const & pv) -{ - return toScalar(pv); -} - -template -String scalarToString(T); - -template<> -String scalarToString(int8 value) -{ - char buffer[20]; - int ival = value; - sprintf(buffer,"%d",ival); - return String(buffer); -} - -template<> -String scalarToString(int16 value) -{ - char buffer[20]; - int ival = value; - sprintf(buffer,"%d",ival); - return String(buffer); -} - -template<> -String scalarToString(int32 value) -{ - char buffer[20]; - int ival = value; - sprintf(buffer,"%d",ival); - return String(buffer); -} - -template<> -String scalarToString(int64 value) -{ - char buffer[30]; - sprintf(buffer,"%lld",(long long)value); - return String(buffer); -} - -template<> -String scalarToString(uint8 value) -{ - char buffer[20]; - unsigned int ival = value; - sprintf(buffer,"%ud",ival); - return String(buffer); -} - -template<> -String scalarToString(uint16 value) -{ - char buffer[20]; - unsigned int ival = value; - sprintf(buffer,"%iud",ival); - return String(buffer); -} - -template<> -String scalarToString(uint32 value) -{ - char buffer[20]; - sprintf(buffer,"%ud",(unsigned int)value); - return String(buffer); -} - -template<> -String scalarToString(uint64 value) -{ - char buffer[30]; - sprintf(buffer,"%llu",(unsigned long long)value); - return String(buffer); -} - -template<> -String scalarToString(float value) -{ - char buffer[40]; - sprintf(buffer,"%g",value); - return String(buffer); -} - -template<> -String scalarToString(double value) -{ - char buffer[40]; - sprintf(buffer,"%g",value); - return String(buffer); -} - -template -void fromScalar(PVScalarPtr const &pv,T from) -{ - ScalarConstPtr scalar = pv->getScalar(); - ScalarType scalarType = scalar->getScalarType(); - switch(scalarType) { - case pvBoolean: - throw std::logic_error("byte can not be converted to boolean"); - case pvByte: { - PVBytePtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvShort: { - PVShortPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvInt: { - PVIntPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvLong: { - PVLongPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvUByte: { - PVUBytePtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvUShort: { - PVUShortPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvUInt: { - PVUIntPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvULong: { - PVULongPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvFloat: { - PVFloatPtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvDouble: { - PVDoublePtr value = static_pointer_cast(pv); - value->put(static_cast(from)); return; - } - case pvString: { - PVStringPtr pvvalue = static_pointer_cast(pv); - String value = scalarToString(from); - pvvalue->put(value); - return; - } - } - throw std::logic_error("Logic error. Should never get here."); -} - -void Convert::fromByte(PVScalarPtr const &pv,int8 from) -{ - fromScalar(pv,from); -} - -void Convert::fromShort(PVScalarPtr const &pv,int16 from) -{ - fromScalar(pv,from); -} - -void Convert::fromInt(PVScalarPtr const &pv, int32 from) -{ - fromScalar(pv,from); -} - -void Convert::fromLong(PVScalarPtr const &pv, int64 from) -{ - fromScalar(pv,from); -} - -void Convert::fromUByte(PVScalarPtr const &pv,uint8 from) -{ - fromScalar(pv,from); -} - -void Convert::fromUShort(PVScalarPtr const &pv,uint16 from) -{ - fromScalar(pv,from); -} - -void Convert::fromUInt(PVScalarPtr const &pv, uint32 from) -{ - fromScalar(pv,from); -} - -void Convert::fromULong(PVScalarPtr const &pv, uint64 from) -{ - fromScalar(pv,from); -} - -void Convert::fromFloat(PVScalarPtr const &pv, float from) -{ - fromScalar(pv,from); -} - -void Convert::fromDouble(PVScalarPtr const &pv, double from) -{ - fromScalar(pv,from); -} - - static size_t convertFromByteArray(PVScalarArray * pv, size_t offset, size_t len,const int8 from[], size_t fromOffset); static size_t convertToByteArray(PVScalarArray *pv, size_t offset, @@ -372,9 +71,6 @@ static size_t convertFromDoubleArray(PVScalarArray *pv, size_t offset, static size_t convertToDoubleArray(PVScalarArray *pv, size_t offset, size_t len,double to[], size_t toOffset); -static size_t copyArrayDataReference(PVScalarArray *from,PVArray *to); -static size_t copyNumericArray(PVScalarArray *from, - size_t offset, PVScalarArray *to, size_t toOffset, size_t len); static std::vector split(String commaSeparatedList); @@ -751,87 +447,6 @@ void Convert::copyStructureArray( to->put(0,from->getLength(),from->getVector(),0); } -String Convert::toString(PVScalarPtr const & pv) -{ - static String trueString("true"); - static String falseString("false"); - - ScalarConstPtr scalar = pv->getScalar(); - ScalarType scalarType = scalar->getScalarType(); - switch(scalarType) { - case pvBoolean: { - PVBooleanPtr pvalue = static_pointer_cast(pv); - boolean value = pvalue->get(); - return value ? trueString : falseString; - } - case pvByte: { - PVBytePtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%d",(int)value->get()); - return String(buffer); - } - case pvShort: { - PVShortPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%d",(int)value->get()); - return String(buffer); - } - case pvInt: { - PVIntPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%d",(int)value->get()); - return String(buffer); - } - case pvLong: { - PVLongPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%lli",(long long int)value->get()); - return String(buffer); - } - case pvUByte: { - PVUBytePtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%u",(unsigned int)value->get()); - return String(buffer); - } - case pvUShort: { - PVUShortPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%u",(unsigned int)value->get()); - return String(buffer); - } - case pvUInt: { - PVUIntPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%u",(unsigned int)value->get()); - return String(buffer); - } - case pvULong: { - PVULongPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%llu",(unsigned long long int)value->get()); - return String(buffer); - } - case pvFloat: { - PVFloatPtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%g",value->get()); - return String(buffer); - } - case pvDouble: { - PVDoublePtr value = static_pointer_cast(pv); - char buffer[30]; - sprintf(buffer,"%g",value->get()); - return String(buffer); - } - case pvString: { - PVStringPtr value = static_pointer_cast(pv); - return value->get(); - } - } - throw std::logic_error("Logic error. Should never get here."); -} - size_t Convert::toByteArray(PVScalarArrayPtr const &pv, size_t offset, size_t length, int8 to[], size_t toOffset) { @@ -1505,332 +1120,6 @@ size_t convertToDoubleArray(PVScalarArray * pv, return convertToScalarArray(pv,offset,len,to,toOffset); } -size_t copyArrayDataReference(PVScalarArray *from,PVArray *to) -{ - ScalarType scalarType = from->getScalarArray()->getElementType(); - switch (scalarType) { - case pvBoolean: { - PVBooleanArray *pvfrom = (PVBooleanArray*) from; - PVBooleanArray *pvto = (PVBooleanArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvByte: { - PVByteArray *pvfrom = (PVByteArray*) from; - PVByteArray *pvto = (PVByteArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvShort: { - PVShortArray *pvfrom = (PVShortArray*) from; - PVShortArray *pvto = (PVShortArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvInt: { - PVIntArray *pvfrom = (PVIntArray*) from; - PVIntArray *pvto = (PVIntArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvLong: { - PVLongArray *pvfrom = (PVLongArray*) from; - PVLongArray *pvto = (PVLongArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvUByte: { - PVUByteArray *pvfrom = (PVUByteArray*) from; - PVUByteArray *pvto = (PVUByteArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvUShort: { - PVUShortArray *pvfrom = (PVUShortArray*) from; - PVUShortArray *pvto = (PVUShortArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvUInt: { - PVUIntArray *pvfrom = (PVUIntArray*) from; - PVUIntArray *pvto = (PVUIntArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvULong: { - PVULongArray *pvfrom = (PVULongArray*) from; - PVULongArray *pvto = (PVULongArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvFloat: { - PVFloatArray *pvfrom = (PVFloatArray*) from; - PVFloatArray *pvto = (PVFloatArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvDouble: { - PVDoubleArray *pvfrom = (PVDoubleArray*) from; - PVDoubleArray *pvto = (PVDoubleArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - case pvString: { - PVStringArray *pvfrom = (PVStringArray*) from; - PVStringArray *pvto = (PVStringArray*) to; - pvto->shareData( - pvfrom->getSharedVector(),pvfrom->getCapacity(),pvfrom->getLength()); - break; - } - } - to->setImmutable(); - return from->getLength(); -} - -size_t copyNumericArray(PVScalarArray *from, size_t offset, PVScalarArray *to, size_t toOffset, size_t len) -{ - ScalarType fromElementType = from->getScalarArray()->getElementType(); - size_t ncopy = 0; - switch (fromElementType) { - case pvBoolean: - throw std::logic_error(String("PVBooleanArray is not a numeric array")); - case pvByte: { - PVByteArray *pvfrom = (PVByteArray*) from; - while (len > 0) { - size_t num = 0; - ByteArrayData arrayData = ByteArrayData(); - num = pvfrom->get(offset, len, arrayData); - int8 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromByteArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvShort: { - PVShortArray *pvfrom = (PVShortArray*) from; - while (len > 0) { - size_t num = 0; - ShortArrayData arrayData = ShortArrayData(); - num = pvfrom->get(offset, len, arrayData); - int16 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromShortArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvInt: { - PVIntArray *pvfrom = (PVIntArray*) from; - while (len > 0) { - size_t num = 0; - IntArrayData arrayData = IntArrayData(); - num = pvfrom->get(offset, len, arrayData); - int32 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromIntArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvLong: { - PVLongArray *pvfrom = (PVLongArray*) from; - while (len > 0) { - size_t num = 0; - LongArrayData arrayData = LongArrayData(); - num = pvfrom->get(offset, len, arrayData); - int64 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromLongArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvUByte: { - PVUByteArray *pvfrom = (PVUByteArray*) from; - while (len > 0) { - size_t num = 0; - UByteArrayData arrayData = UByteArrayData(); - num = pvfrom->get(offset, len, arrayData); - uint8 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromUByteArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvUShort: { - PVUShortArray *pvfrom = (PVUShortArray*) from; - while (len > 0) { - size_t num = 0; - UShortArrayData arrayData = UShortArrayData(); - num = pvfrom->get(offset, len, arrayData); - uint16 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromUShortArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvUInt: { - PVUIntArray *pvfrom = (PVUIntArray*) from; - while (len > 0) { - size_t num = 0; - UIntArrayData arrayData = UIntArrayData(); - num = pvfrom->get(offset, len, arrayData); - uint32 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromUIntArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvULong: { - PVULongArray *pvfrom = (PVULongArray*) from; - while (len > 0) { - size_t num = 0; - ULongArrayData arrayData = ULongArrayData(); - num = pvfrom->get(offset, len, arrayData); - uint64 * data = get(arrayData.data); - size_t dataOffset = arrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromULongArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvFloat: { - PVFloatArray *pvfrom = (PVFloatArray*) from; - while (len > 0) { - size_t num = 0; - FloatArrayData floatArrayData = FloatArrayData(); - num = pvfrom->get(offset, len, floatArrayData); - float * data = get(floatArrayData.data); - size_t dataOffset = floatArrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromFloatArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvDouble: { - PVDoubleArray *pvfrom = (PVDoubleArray*) from; - while (len > 0) { - size_t num = 0; - DoubleArrayData doubleArrayData = DoubleArrayData(); - num = pvfrom->get(offset, len, doubleArrayData); - double * data = get(doubleArrayData.data); - size_t dataOffset = doubleArrayData.offset; - if (num <= 0) break; - while (num > 0) { - size_t n = convertFromDoubleArray( - to, toOffset, num, data, dataOffset); - if (n <= 0) break; - len -= n; - num -= n; - ncopy += n; - offset += n; - toOffset += n; - } - } - break; - } - case pvString: - throw std::logic_error(String("PVStringArray is not a numeric array")); - } - return ncopy; -} - ConvertPtr Convert::getConvert() { static ConvertPtr convert; diff --git a/pvDataApp/pv/convert.h b/pvDataApp/pv/convert.h index b06c6b8..14532f4 100644 --- a/pvDataApp/pv/convert.h +++ b/pvDataApp/pv/convert.h @@ -297,145 +297,145 @@ public: * @param pv a PV * @return converted value */ - int8 toByte(PVScalarPtr const & pv); + inline int8 toByte(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a short. * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - int16 toShort(PVScalarPtr const & pv); + inline int16 toShort(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a int. * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - int32 toInt(PVScalarPtr const & pv); + inline int32 toInt(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to an long * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - int64 toLong(PVScalarPtr const & pv); + inline int64 toLong(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a ubyte. * @param pv a PV * @return converted value */ - uint8 toUByte(PVScalarPtr const & pv); + inline uint8 toUByte(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a ushort. * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - uint16 toUShort(PVScalarPtr const & pv); + inline uint16 toUShort(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a uint. * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - uint32 toUInt(PVScalarPtr const & pv); + inline uint32 toUInt(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to an ulong * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - uint64 toULong(PVScalarPtr const & pv); + inline uint64 toULong(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a float * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - float toFloat(PVScalarPtr const & pv); + inline float toFloat(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a double * @param pv a PV * @return converted value * @throws std::invalid_argument if the Type is not a numeric scalar */ - double toDouble(PVScalarPtr const & pv); + inline double toDouble(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV to a String * @param pv a PV * @return converted value */ - String toString(PVScalarPtr const & pv); + inline String toString(PVScalarPtr const & pv) { return pv->getAs();} /** * Convert a PV from a byte * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromByte(PVScalarPtr const & pv,int8 from); + inline void fromByte(PVScalarPtr const & pv,int8 from) { pv->putFrom(from); } /** * Convert a PV from a short * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromShort(PVScalarPtr const & pv,int16 from); + inline void fromShort(PVScalarPtr const & pv,int16 from) { pv->putFrom(from); } /** * Convert a PV from an int * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromInt(PVScalarPtr const & pv, int32 from); + inline void fromInt(PVScalarPtr const & pv, int32 from) { pv->putFrom(from); } /** * Convert a PV from a long * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromLong(PVScalarPtr const & pv, int64 from); + inline void fromLong(PVScalarPtr const & pv, int64 from) { pv->putFrom(from); } /** * Convert a PV from a ubyte * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromUByte(PVScalarPtr const & pv,uint8 from); + inline void fromUByte(PVScalarPtr const & pv,uint8 from) { pv->putFrom(from); } /** * Convert a PV from a ushort * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromUShort(PVScalarPtr const & pv,uint16 from); + inline void fromUShort(PVScalarPtr const & pv,uint16 from) { pv->putFrom(from); } /** * Convert a PV from an uint * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromUInt(PVScalarPtr const & pv, uint32 from); + inline void fromUInt(PVScalarPtr const & pv, uint32 from) { pv->putFrom(from); } /** * Convert a PV from a ulong * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromULong(PVScalarPtr const & pv, uint64 from); + inline void fromULong(PVScalarPtr const & pv, uint64 from) { pv->putFrom(from); } /** * Convert a PV from a float * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromFloat(PVScalarPtr const & pv, float from); + inline void fromFloat(PVScalarPtr const & pv, float from) { pv->putFrom(from); } /** * Convert a PV from a double * @param pv a PV * @param from value to put into PV * @throws std::invalid_argument if the Type is not a numeric scalar */ - void fromDouble(PVScalarPtr const & pv, double from); + inline void fromDouble(PVScalarPtr const & pv, double from) { pv->putFrom(from); } /** * Convert a PV array to a byte array. * @param pv a PV