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:

&#10; &lt;struct name=&quot;component&quot; type=&quot;component_type&quot;&gt;&#10;  &lt;struct name=&quot;Properties&quot; type=&quot;PropertyBag&quot;&gt;&#10;    &lt;simple name=&quot;Filename&quot; type=&quot;string&quot;&gt;&lt;value&gt;my_file&lt;/value&gt;&lt;/simple&gt;&#10;  &lt;/struct&gt;&#10; ...&#10; &lt;/struct&gt;&#10;

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

Peter