bethyw.cpp
/*
  Import datasets from `datasetsToImport` as files in `dir` into areas, and
  filtering them with the `areasFilter`, `measuresFilter`, and `yearsFilter`.

  The actual filtering will be done by the Areas::populate() function, thus 
  you need to merely pass pointers on to these flters.

  This function should promise not to throw an exception. If there is an
  error/exception thrown in any function called by thus function, catch it and
  output 'Error importing dataset:', followed by a new line and then the output
  of the what() function on the exception.

  @param areas
    An Areas instance that should be modified (i.e. datasets loaded into it)

  @param dir
    The directory where the datasets are

  @param datasetsToImport
    A vector of InputFileSource objects

  @param areasFilter
    An unordered set of areas (as authority codes encoded in std::strings)
    to filter, or empty to import all areas

  @param measuresFilter
    An unordered set of measures (as measure codes encoded in std::strings)
    to filter, or empty to import all measures

  @param yearsFilter
    An two-pair tuple of unsigned ints corresponding to the range of years 
    to import, which should both be 0 to import all years.

  @return
    void

  @example
    Areas areas();

    BethYw::loadDatasets(
      areas,
      "data",
      BethYw::parseDatasetsArgument(args),
      BethYw::parseAreasArg(args),
      BethYw::parseMeasuresArg(args),
      BethYw::parseYearsArg(args));
*/


The actual filtering will be done by the Areas::populate() function, thus
you need to merely pass pointers on to these flters.

This function should promise not to throw an exception. If there is an
error/exception thrown in any function called by thus function, catch it and
output 'Error importing dataset:', followed by a new line and then the output
of the what() function on the exception.
The actual filtering will be done by the Areas :: populate () function thus you need to merely pass pointers on to these flters . This function should promise not to throw an exception . If there is an error / exception thrown in any function called by thus function catch it and output ' Error importing dataset : ' followed by a new line and then the output of the what () function on the exception .
void BethYw::loadDatasets(Areas &areas,
                        std::string dir,
                        std::vector<InputFileSource>  datasetsToImport,
                          const StringFilterSet areasFilter,
                          const StringFilterSet measuresFilter,
                          const YearFilterTuple yearsFilter){
        for(auto const& dataset : datasetsToImport) {
            InputFile areasFile(dir + dataset.FILE);
            try{
                areas.populate(areasFile.open(), dataset.PARSER, dataset.COLS, &areasFilter, &measuresFilter, &yearsFilter);
            }catch(const std::runtime_error & error) {
                std::cerr << "Error importing dataset: " << std::endl << error.what();
                exit(0);
            }
        }
}
void BethYw :: loadDatasets ( Areas & areas , std :: string dir , std :: vector < InputFileSource > datasetsToImport , const StringFilterSet areasFilter , const StringFilterSet measuresFilter , const YearFilterTuple yearsFilter ) { for ( auto const & dataset : datasetsToImport ) { InputFile areasFile ( dir + dataset . FILE ) ; try { areas . populate ( areasFile . open ( ) , dataset . PARSER , dataset . COLS , & areasFilter , & measuresFilter , & yearsFilter ) ; } catch ( const std :: runtime_error & error ) { std :: cerr << " " << std :: endl << error . what ( ) ; exit ( 0 ) ; } } }
Import datasets from `datasetsToImport` as files in `dir` into areas, and
filtering them with the `areasFilter`, `measuresFilter`, and `yearsFilter`.
Import datasets from ` datasetsToImport ` as files in ` dir ` into areas and filtering them with the ` areasFilter ` ` measuresFilter ` and ` yearsFilter ` .