robotology / yarp

YARP - Yet Another Robot Platform
http://www.yarp.it
Other
529 stars 195 forks source link

New class for return values of interface methods. #3051

Open randaz81 opened 1 year ago

randaz81 commented 1 year ago

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:

update-docs[bot] commented 1 year ago

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.

traversaro commented 1 year ago

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?

randaz81 commented 1 year ago

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?

Still not sure about the class name, but I like the idea of moving it to yarp::dev!