diff --git a/Code/Core/otbWrapperParameterGroup.cxx b/Code/Core/otbWrapperParameterGroup.cxx index 7568b05c98fe778e22e78b7b3615247ec2b72a8e..47bf4a81216cfdcf1335ee8681152c2fc9207e84 100644 --- a/Code/Core/otbWrapperParameterGroup.cxx +++ b/Code/Core/otbWrapperParameterGroup.cxx @@ -43,41 +43,38 @@ ParameterGroup::~ParameterGroup() { } -std::list<std::string> -ParameterGroup::GetParametersKeys() +std::vector<std::string> +ParameterGroup::GetParametersKeys(bool recursive) { - std::list<std::string> parameters; + std::vector<std::string> parameters; ParameterListType::iterator pit; for (pit = m_ParameterList.begin(); pit != m_ParameterList.end(); ++pit) { Parameter* param = *pit; - if (dynamic_cast<ParameterGroup*>(param)) + parameters.push_back( param->GetKey() ); + + if (recursive && dynamic_cast<ParameterGroup*>(param)) { ParameterGroup* paramAsGroup = dynamic_cast<ParameterGroup*>(param); - std::list<std::string> subparams = paramAsGroup->GetParametersKeys(); - for (std::list<std::string>::const_iterator it = subparams.begin(); + std::vector<std::string> subparams = paramAsGroup->GetParametersKeys(); + for (std::vector<std::string>::const_iterator it = subparams.begin(); it != subparams.end(); ++it) { parameters.push_back( std::string(paramAsGroup->GetKey()) + "." + *it ); } } - else if (dynamic_cast<ChoiceParameter*>(param)) + else if (recursive && dynamic_cast<ChoiceParameter*>(param)) { ChoiceParameter* paramAsChoice = dynamic_cast<ChoiceParameter*>(param); - parameters.push_back( param->GetKey() ); - std::list<std::string> subparams = paramAsChoice->GetParametersKeys(); - for (std::list<std::string>::const_iterator it = subparams.begin(); + std::vector<std::string> subparams = paramAsChoice->GetParametersKeys(); + for (std::vector<std::string>::const_iterator it = subparams.begin(); it != subparams.end(); ++it) { parameters.push_back( std::string(paramAsChoice->GetKey()) + "." + *it ); } } - else - { - parameters.push_back( param->GetKey() ); - } } return parameters; } diff --git a/Code/Core/otbWrapperParameterGroup.h b/Code/Core/otbWrapperParameterGroup.h index 9a58ac149b655ff747dcc58abcaff6f52854d2e7..bfdde995ff047b1a2ede487b8e50c9959330a527 100644 --- a/Code/Core/otbWrapperParameterGroup.h +++ b/Code/Core/otbWrapperParameterGroup.h @@ -59,7 +59,7 @@ public: unsigned int GetNumberOfParameters(); - std::list<std::string> GetParametersKeys(); + std::vector<std::string> GetParametersKeys(bool recursive = true); protected: ParameterGroup();