WSL/SLF GitLab Repository

Commit 8f8ed803 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

code cleanup

parent 18f4e14a
......@@ -45,7 +45,7 @@ size_t MeteoProcessor::get_parameters(const Config& cfg, std::set<std::string>&
std::vector<std::string> vec_keys;
cfg.findKeys(vec_keys, std::string(), "Filters");
for (size_t ii=0; ii<vec_keys.size(); ii++){
for (size_t ii=0; ii<vec_keys.size(); ++ii){
const size_t found = vec_keys[ii].find_first_of(":");
if (found != std::string::npos){
const string tmp = vec_keys[ii].substr(0,found);
......
......@@ -180,10 +180,11 @@ ProcessingBlock::ProcessingBlock(const std::string& name) : properties(), block_
void ProcessingBlock::convert_args(const size_t& min_nargs, const size_t& max_nargs,
const std::vector<std::string>& vec_args, std::vector<double>& dbl_args) const
{
if ((vec_args.size() < min_nargs) || (vec_args.size() > max_nargs))
const size_t nr_of_args = vec_args.size();
if ((nr_of_args < min_nargs) || (nr_of_args > max_nargs))
throw InvalidArgumentException("Wrong number of arguments for filter/processing element \"" + getName() + "\"", AT);
for (size_t ii=0; ii<vec_args.size(); ii++){
for (size_t ii=0; ii<nr_of_args; ii++){
double tmp = IOUtils::nodata;
IOUtils::convertString(tmp, vec_args[ii]);
dbl_args.push_back(tmp);
......
......@@ -77,9 +77,9 @@ void ProcessingStack::getArgumentsForFilter(const Config& cfg, const std::string
void ProcessingStack::process(const std::vector< std::vector<MeteoData> >& ivec,
std::vector< std::vector<MeteoData> >& ovec, const bool& second_pass)
{
ovec.resize( ivec.size() );
const size_t nr_of_filters = filter_stack.size();
const size_t nr_stations = ivec.size();
ovec.resize( nr_stations );
for (size_t ii=0; ii<nr_stations; ii++){ //for every station
if( ivec[ii].empty() ) continue; //no data, nothing to do!
......@@ -92,18 +92,14 @@ void ProcessingStack::process(const std::vector< std::vector<MeteoData> >& ivec,
//Now call the filters in a row
bool appliedFilter = false;
for (size_t jj=0; jj<nr_of_filters; jj++){
if (second_pass){
if ((*filter_stack[jj]).getProperties().stage==ProcessingProperties::first
|| (*filter_stack[jj]).getProperties().stage==ProcessingProperties::none)
continue;
}
if (!second_pass){
if ((*filter_stack[jj]).getProperties().stage==ProcessingProperties::second
|| (*filter_stack[jj]).getProperties().stage==ProcessingProperties::none)
continue;
}
appliedFilter = true;
const ProcessingProperties::proc_stage& filter_stage = filter_stack[jj]->getProperties().stage;
if ( second_pass && ((filter_stage==ProcessingProperties::first) || (filter_stage==ProcessingProperties::none)) )
continue;
if ( !second_pass && ((filter_stage==ProcessingProperties::second) || (filter_stage==ProcessingProperties::none)) )
continue;
appliedFilter = true;
(*filter_stack[jj]).process(static_cast<unsigned int>(param), tmp, ovec[ii]);
if (tmp.size() == ovec[ii].size()){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment