area.cpp
/*
  TODO: Area::setMeasure(codename, measure)

  Add a particular Measure to this Area object. Note that the Measure's
  codename should be converted to lowercase.

  If a Measure already exists with the same codename in this Area, overwrite any
  values contained within the existing Measure with those in the new Measure
  passed into this function. The resulting Measure stored inside the Area
  instance should be a combination of the two Measures instances.

  @param codename
    The codename for the Measure

  @param measure
    The Measure object

  @return
    void

  @example
    Area area("W06000023");

    std::string codename = "Pop";
    std::string label = "Population";
    Measure measure(codename, label);

    double value = 12345678.9;
    measure.setValue(1999, value);

    area.setMeasure(codename, measure);
*/
:setMeasure(codename, measure)
Add a particular Measure to this Area object. Note that the Measure's
codename should be converted to lowercase.

If a Measure already exists with the same codename in this Area, overwrite any
values contained within the existing Measure with those in the new Measure
passed into this function. The resulting Measure stored inside the Area
instance should be a combination of the two Measures instances.
: setMeasure ( codename measure ) Add a particular Measure to this Area object . Note that the Measure ' s codename should be converted to lowercase . If a Measure already exists with the same codename in this Area overwrite any values contained within the existing Measure with those in the new Measure passed into this function . The resulting Measure stored inside the Area instance should be a combination of the two Measures instances .
void Area::setMeasure(std::string codename, Measure measure){
  transform(codename.begin(), codename.end(), codename.begin(), ::tolower);
  if(measures.count(codename) > 0){
    Measure& existingMeasure = this->getMeasure(codename);
    std::map<int, double> newValues = measure.getAll();
    for (auto const& x : newValues){
      existingMeasure.setValue(x.first,x.second);
    }
  }
    measures.emplace(codename, measure);
}
void Area :: setMeasure ( std :: string codename , Measure measure ) { transform ( codename . begin ( ) , codename . end ( ) , codename . begin ( ) , :: tolower ) ; if ( measures . count ( codename ) > 0 ) { Measure & existingMeasure = this -> getMeasure ( codename ) ; std :: map < int , double > newValues = measure . getAll ( ) ; for ( auto const & x : newValues ) { existingMeasure . setValue ( x . first , x . second ) ; } } measures . emplace ( codename , measure ) ; }
TODO: Area::setMeasure(codename, measure)
Add a particular Measure to this Area object.
TODO : Area :: setMeasure ( codename measure ) Add a particular Measure to this Area object .
//changing codename to lower case //merging existing measure with new measure