[libpc] property tree / options
Michael P. Gerlek
mpg at flaxen.com
Fri Mar 25 12:11:36 EDT 2011
Sorry, I don't quite understand... Here's a start, can you flesh it out a
bit for me?
class libpc::Stage
{
public:
Stage() // default ctor doesn't take a ptree
{ ... }
Stage(ptree& tree) // alternate ctor, which uses the ptree system
{
Initialize(tree)
...
}
protected:
virtual Initialize(ptree& tree) {} // user can implement
};
class MyStage : Stage
{
public:
MyStage(ptree& tree) :
Stage(tree)
{...}
private:
Initialize(ptree& tree)
{
// do something with the options
}
};
> -----Original Message-----
> From: Howard Butler [mailto:hobu.inc at gmail.com]
> Sent: Friday, March 25, 2011 6:14 AM
> To: mpg at flaxen.com
> Cc: libpc at lists.osgeo.org
> Subject: Re: [libpc] property tree / options
>
>
> On Mar 24, 2011, at 11:07 PM, Michael P. Gerlek wrote:
>
> > At the sprint, we came up with a plan for using property trees to pass
> > options to Stages -- or something like that. I can't make heads or
> > tails of my notes. Can someone pls summarize the plan we made?
>
> I believe the plan was something like:
>
> * Give each stage a public Initialize(boost::property_tree::ptree& tree)
> method that each stage's constructor can choose to call or not in its
ctors
> * Give each stage a public ValidateOptions() method that throws
> libpc::validation_errors if something isn't right.
> * Give each stage a public boost::property_tree::ptree GetDefaultOptions()
> that fills out a default tree that the user can then tweak values of and
set on
> Initialize
>
> I'm not sure this is the way to go even though I lean this way...
>
> Howard=
More information about the pdal
mailing list