Create component library if constructor takes more than 1 argument

Hi,

Looks like the macro ORO_CREATE_COMPONENT(component_name) does not
like components with an extra argument in their constructor.

For example:

class FileReader(std:string name, std:string FileName)
: public TaskContext(name)

I know that I can replace the extra argument by using a property. But
if this is the only component that requires such a property, I have to
write a property file that contains only one line and I have to write
extra code in the constructor of my component in order to read the
property.

In this case, It would be much easier to use the extra argument in the
constructor of the component and add an extra line in the .cpf file
that specifies that argument.

Possible example of a .cpf:

<struct name="component" type="component_name">
<struct name="arg1" type="string"><value>"my_file"<value><simple>
...
<struct>

Is this a possible feature of RTT2.0?

Regards,

Steven

Create component library if constructor takes more than 1 argume

Hi Steven,

On Fri, May 15, 2009 at 15:19, Steven Kauffmann
<steven [dot] kauffmann [..] ...> wrote:
> Hi,
>
> Looks like the macro ORO_CREATE_COMPONENT(component_name) does not
> like components with an extra argument in their constructor.
>
> For example:
>
> class FileReader(std:string name, std:string FileName)
> : public TaskContext(name)
>
> I know that I can replace the extra argument by using a property. But
> if this is the only component that requires such a property, I have to
> write a property file that contains only one line and I have to write
> extra code in the constructor of my component in order to read the
> property.

Maybe you should consider then static application deployment if you
don't want the effort to make your component configurable. Nevertheless
I would recommend to make it a real property of your component and
use the steps below...

>
> In this case, It would be much easier to use the extra argument in the
> constructor of the component and add an extra line in the .cpf file
> that specifies that argument.
>
> Possible example of a .cpf:
>
> <struct name="component" type="component_name">
> <struct name="arg1" type="string"><value>"my_file"<value><simple>

You can already specify something similar in RTT 1.8, see the
DeploymentComponent
manual for the detail. You can add in your deployment XML file this section:

 <struct name="component" type="component_type">
  <struct name="Properties" type="PropertyBag">
    <simple name="Filename" type="string"><value>my_file</value></simple>
  </struct>
 ...
 </struct>

Where your component has a property with the name "Filename".

Peter