creating a service

hi,

I'm creating a service, taking the rtt_dot_service as an example, and have some questions:
1) I want to get my service updated when my component which loads the service, is updated, to do so, I inherited from the executable interface and I added the runFunction:
my_service::my_service(TaskContext* owner): Service("my_service", owner), base::ExecutableInterface()
...
owner->engine()->runFunction(this);
But what is actually executed every update?: all my functions/operations? or only the "execute" function as in the rtt_dot_service?

2) is it possible to attach a function to the configureHook of the component that loads my service, so that the configure statement of the service will get executed with it
automatically?

3) how to reach the data of the component that loads my service?
is it possible to get it from a port in this way:
this->getOwner()->getPort("port_name")->connectTo(in_port.clone());

thanks!

nick

creating a service

Hi Nick,

On Thu, Jan 26, 2012 at 9:09 PM, Dominick Vanthienen
<dominick [dot] vanthienen [..] ...> wrote:
>
> hi,
>
> I'm creating a service, taking the rtt_dot_service as an example, and have some questions:
> 1) I want to get my service updated when my component which loads the service, is updated, to do so, I inherited from the executable interface and I added the runFunction:
>        my_service::my_service(TaskContext* owner): Service("my_service", owner), base::ExecutableInterface()
>        ...
>        owner->engine()->runFunction(this);
>    But what is actually executed every update?: all my functions/operations? or only the "execute" function as in the rtt_dot_service?

You'll have to read the docs for this:
http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...

There's no magic, only execute is called by the ExecutionEngine.

>
>
> 2) is it possible to attach a function to the configureHook of the component that loads my service, so that the configure statement of the service will get executed with it
> automatically?

No. You'll have to put code in configureHook which interacts with your
service. There are helper functions for this in the TaskContext API.

>
> 3) how to reach the data of the component that loads my service?
> is it possible to get it from a port in this way:
> this->getOwner()->getPort("port_name")->connectTo(in_port.clone());

If you connect to a clone, how can you get back to that port ? On the
other hand, you can create an input port in your service and connect
it in that way to an output port of your component and vice versa.

>
> thanks!
>
> nick

Peter