[orocosusers] removing a service from the interface

Dear all,

How do you clean up the component interface from a service?

I added a port and an operation to a task context (pointer) tc

tc->provides(name)->addPort("in_pos",in_pos);
tc->provides(name)->addOperation("configure",
&MonitorStop::ConfigureOperation,this);

and I would like to cleanup the service named `name', but icould not
figure out which is the right function, i can remove only the port and
the operation

tc->provides(name)->removePort("in_pos");
tc->provides(name)->removeOperation("configure");

Cheers, Gianni.

[orocosusers] removing a service from the interface

Hi Gianni,

an RTT::Service has a clear()
<https://orocos-toolchain.github.io/rtt/master/api/html/classRTT_1_1Service.html#a490fc9133d21ccd6f8e2388ab07431c2>
method, which I think does exactly what you want:

tc->provides(name)->clear()

If you want to remove the whole service "name" from the TaskContext tc, you
can do that with the removeService()
<https://orocos-toolchain.github.io/rtt/master/api/html/classRTT_1_1Service.html#aaa0389e2b340c1c2b2405289eae7ff3a>
method called on the root service of tc:

tc->provides()->removeService(name)

removeService() is not exposed in the TaskContext interface, so
tc->removeService(name) would not work directly. Removal of the service
also clears and deletes the service, given that no other shared pointer
still exists.

Cheers,
Johannes

On 24 May 2017 at 17:29, Gianni Borghesan <gianni [dot] borghesan [..] ...>
wrote:

> Dear all,
>
> How do you clean up the component interface from a service?
>
> I added a port and an operation to a task context (pointer) tc
>
> tc->provides(name)->addPort("in_pos",in_pos);
> tc->provides(name)->addOperation("configure",
> &MonitorStop::ConfigureOperation,this);
>
>
> and I would like to cleanup the service named `name', but icould not
> figure out which is the right function, i can remove only the port and the
> operation
>
> tc->provides(name)->removePort("in_pos");
> tc->provides(name)->removeOperation("configure");
>
> Cheers, Gianni.
>
> --
> ------------------------------------------------
> Gianni Borghesan, PhD
> Robot Assisted Surgery group
> Robotics Research group
> KU Leuven,
> Department of Mechanical Engineering,
> Division of PMA
> Room 02.019
> Celestijnenlaan 300B, B-3001 Heverlee, Belgium.
> Tel: +32 163 29267
>
> ------------------------------------------------
>