yarp
yarp copied to clipboard
New class for return values of interface methods.
This new class can be used in all interface methods to provide extra info about the success/failure of the method.
In this example:
bool getTemperature(int m, double* val) override;
becomes:
yarp::os::yarp_ret_value getTemperature(int m, double* val) override;
So the user can distinguish if a failure is due to missing implementation/internal error/communication error etc.
The class is also automatically converted to bool when tested by conditions.
Extra Notes:
- No need to change the user application code.
- Only devices (e.g. xxxmotioncontrol) must be updated.
- In this example, the error code is not actually propagated through the network (i.e. from the nws to the nwc).
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update the release notes by adding a file in doc/release/<target_branch>, based on your changes.
As we typically use CamelCase names for classes, and given this is return value is device-specific, could we call this type yarp::os::DeviceReturnValue ? Or perhaps we can move it to yarp::dev, unless there is some reason to keep it on yarp::os?
As we typically use
CamelCasenames for classes, and given this is return value is device-specific, could we call this typeyarp::os::DeviceReturnValue? Or perhaps we can move it toyarp::dev, unless there is some reason to keep it onyarp::os?
Still not sure about the class name, but I like the idea of moving it to yarp::dev!