Hi Orocos,
In our Orocos 1.0 implementation, we had made a handy macro so components could easily publish their methods:
#define ADD_METHOD(SIG, CLASS, NAME, ARGS...) \
methods()->addMethod(Method<SIG>(#NAME, &CLASS::NAME, this), ARGS)
provides()->addOperation(Operation<SIG>(#NAME, &CLASS::NAME, this), ARGS)
BTW, the 1.0->2.0 conversion script changed my macro to:
provides()->addOperationCaller(OperationCaller<SIG>(#NAME, &CLASS::NAME, this), ARGS)
But that, along with everything I've tried returns compiler errors along the lines of:
"error: no matching function for call to ‘RTT::OperationCaller<void()>::OperationCaller(const char [18],..."
Bill.
Migrating from Orocos 1.0 to 2.0, how does addOperation work?
On Fri, Jan 11, 2013 at 1:07 AM, <William [dot] L [dot] West [..] ...> wrote:
> Hi Orocos,
>
> In our Orocos 1.0 implementation, we had made a handy macro so components
> could easily publish their methods:
>
> #define ADD_METHOD(SIG, CLASS, NAME, ARGS...) \
> methods()->addMethod(Method(#NAME, &CLASS::NAME, this), ARGS)
>
> .. and I can't figure out how to rewrite it for Orocos 2.0. I've tried
> things like:
>
> provides()->addOperation(Operation(#NAME, &CLASS::NAME, this), ARGS)
>
> But nothing seems to work. Specifically, there doesn't seem to be any way
> to
> include the ARGS parameters, and I confess, I have no idea what should be
> in
> the Service parameter of one of the versions of addOperation().
>
> BTW, the 1.0->2.0 conversion script changed my macro to:
>
> provides()->addOperationCaller(OperationCaller(#NAME, &CLASS::NAME,
> this), ARGS)
>
>
> But that, along with everything I've tried returns compiler errors along
> the
> lines of:
>
> "error: no matching function for call to
> ‘RTT::OperationCaller::OperationCaller(const char [18],..."
>
The script 'interpretes' your .hpp and .cpp file to decide if you want to
call an operation or define it. Macro's confuse it since it tries to match
#NAME to something, which clearly does not exist.
The manual states that adding operations is done like this:
http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
So *no* need to add the word 'OperationCaller' and the arguments are
provided with .arg("name","description").arg(...) etc. Now I don't know how
to do this with your macro such that it turns "name","description" pairs
into .arg(...) statements.
Cheers,
Peter