epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

pvCopy: implement plugin filters #46

Closed mrkraimer closed 6 years ago

mrkraimer commented 7 years ago

Implement plugin filters for copy facility. This is modeled after the plugin filters that were introduced in epics base 3.15.

anjohnson commented 7 years ago

@mrkraimer Regarding your latest pair of commits, strtol() and strtod() don't throw, so your try wrappers around these calls don't make much sense.

Note that from Base-3.15 onwards epicsStdlib.h provides a series of epicsParse*() functions which do string to number conversions and check that the value is within the legal range for the type (they return a status code).

mdavidsaver commented 7 years ago

On 04/10/2017 03:55 PM, Andrew Johnson wrote:

@mrkraimer https://github.com/mrkraimer Regarding your latest pair of commits, |strtol()| and |strtod()| don't throw, so your |try| wrappers around these calls don't make much sense.

Note that from Base-3.15 onwards epicsStdlib.h provides a series of |epicsParse*()| functions which do string to number conversions and check that the value is within the legal range for the type (they return a status code).

Have a look at typeCast.h and castUnsafe(someString)

anjohnson commented 7 years ago

To translate from michael-speak that would be the header pv/typeCast.h and the functions epics::pvData::castUnsafe<epicsType>(someString), which wrap the epicsParse*() functions (and do throw).

mdavidsaver commented 7 years ago

Hey, I wasn't going to type an essay with a smartphone.

mrkraimer commented 7 years ago

I removed the try/catch around the calls to strtol. I did not use the new features from epicsStdlib.h because I think it is important that pvDataCPP still work with 3.14 releases.

Also note that std::stol does trap exceptions;

Exceptions std::invalid_argument if no conversion could be performed std::out_of_range if the converted value would fall out of the range of the result type or if the underlying function (std::strtol or std::strtoll) sets errno to ERANGE.

But this requires c++11. Again I will ask when we can make epics base c++11 compatible?

mrkraimer commented 6 years ago

I am closing this pull request. It was decided that plugin support would not be implemented until there are users requests for it.