Turning a RF into a list of properties

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Turning a RF into a list of properties

Stéphane Lallée
Hi !

I have ResourceFinder that is created from the command line arguments. I also have a property that is created from the --from parameter of the command line as follow :

bool configure(yarp::os::ResourceFinder &rf)
{
yarp::os::Property prop; prop.fromConfigFile(rf.findFile("from"));
}

Now I want any parameter of the command line to override the potential same parameter present in the conf file. I manage to do it using "unput/put" like this :

if (prop.check("name") && rf.check("name"))
{
prop.unput("name");
prop.put("name", rf.find("name").asString());
}

However, I do not find any way to iterate among all the properties present in the resource finder to do that in a systematic way. Is there any way to do what I want ? Either by iterating through the properties of the RF or the ones of the Property prop ?

Thanks in advance,
Stéphane
 
Stéphane Lallée

*~~~~~~~~~~~~*
Synthetic, Perceptive, Cognitive and Emotive Systems (SPECS)
Universitat Pompeu Fabra
COMMUNICATION-POBLENOU CAMPUS (LA NAU building)
Roc Boronat, 138. 08018 Barcelona

http://specs.upf.edu/
*~~~~~~~~~~~~*

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Turning a RF into a list of properties

pattacini

Hi Stephane,

 

The RF object should already handle the case of param overriding done by means of command-line options.

Said that, if you create the corresponding property like that:

 

yarp::os::Property prop(rf.toString().c_str());

 

The object “prop” should be already consistent (perhaps).

It’d be worth giving it a try.

 

Ciao,

Ugo

 

 

From: Stéphane Lallée [mailto:[hidden email]]
Sent: 25 September 2014 12:57
To: Robotcub-hackers
Subject: [rc-hackers] Turning a RF into a list of properties

 

Hi !

 

I have ResourceFinder that is created from the command line arguments. I also have a property that is created from the --from parameter of the command line as follow :

 

bool configure(yarp::os::ResourceFinder &rf)
{
       yarp::os::Property prop; prop.fromConfigFile(rf.findFile("from"));
}

 

Now I want any parameter of the command line to override the potential same parameter present in the conf file. I manage to do it using "unput/put" like this :

 

if (prop.check("name") && rf.check("name"))
{
       prop.unput("name");
       prop.put("name", rf.find("name").asString());
}

 

However, I do not find any way to iterate among all the properties present in the resource finder to do that in a systematic way. Is there any way to do what I want ? Either by iterating through the properties of the RF or the ones of the Property prop ?

 

Thanks in advance,

Stéphane

 

Stéphane Lallée

*~~~~~~~~~~~~*
Synthetic, Perceptive, Cognitive and Emotive Systems (SPECS)
Universitat Pompeu Fabra
COMMUNICATION-POBLENOU CAMPUS (LA NAU building)
Roc Boronat, 138. 08018 Barcelona

http://specs.upf.edu/
*~~~~~~~~~~~~*


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Turning a RF into a list of properties

Stéphane Lallée
Perfect ! So simple I didn't think about it, thanks Ugo ! :)


Stéphane Lallée

*~~~~~~~~~~~~*
Synthetic, Perceptive, Cognitive and Emotive Systems (SPECS)
Universitat Pompeu Fabra
COMMUNICATION-POBLENOU CAMPUS (LA NAU building)
Roc Boronat, 138. 08018 Barcelona

http://specs.upf.edu/
*~~~~~~~~~~~~*

2014-09-25 13:49 GMT+02:00 Ugo Pattacini <[hidden email]>:

Hi Stephane,

 

The RF object should already handle the case of param overriding done by means of command-line options.

Said that, if you create the corresponding property like that:

 

yarp::os::Property prop(rf.toString().c_str());

 

The object “prop” should be already consistent (perhaps).

It’d be worth giving it a try.

 

Ciao,

Ugo

 

 

From: Stéphane Lallée [mailto:[hidden email]]
Sent: 25 September 2014 12:57
To: Robotcub-hackers
Subject: [rc-hackers] Turning a RF into a list of properties

 

Hi !

 

I have ResourceFinder that is created from the command line arguments. I also have a property that is created from the --from parameter of the command line as follow :

 

bool configure(yarp::os::ResourceFinder &rf)
{
       yarp::os::Property prop; prop.fromConfigFile(rf.findFile("from"));
}

 

Now I want any parameter of the command line to override the potential same parameter present in the conf file. I manage to do it using "unput/put" like this :

 

if (prop.check("name") && rf.check("name"))
{
       prop.unput("name");
       prop.put("name", rf.find("name").asString());
}

 

However, I do not find any way to iterate among all the properties present in the resource finder to do that in a systematic way. Is there any way to do what I want ? Either by iterating through the properties of the RF or the ones of the Property prop ?

 

Thanks in advance,

Stéphane

 

Stéphane Lallée

*~~~~~~~~~~~~*
Synthetic, Perceptive, Cognitive and Emotive Systems (SPECS)
Universitat Pompeu Fabra
COMMUNICATION-POBLENOU CAMPUS (LA NAU building)
Roc Boronat, 138. 08018 Barcelona

http://specs.upf.edu/
*~~~~~~~~~~~~*



------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Loading...