00001 #include "DataFile.h"
00002
00003 namespace ICLIB {
00004
00005 const std::vector< double >& DataFile::getValues(const std::string& key) const {
00006 ValuesMap::const_iterator it;
00007 for(it=mValues.begin(); it!=mValues.end() && it->first!=key; ++it);
00008 if(it==mValues.end()) {
00009 std::ostringstream err;
00010 err << "Could not find data for '" << key << "' in file '" << mFilename << "'";
00011 throw ParseException ( mFilename,
00012 "DataFile::getValues",
00013 __FILE__,
00014 __LINE__);
00015
00016
00017
00018
00019
00020
00021 }
00022 else
00023 return it->second;
00024 }
00025
00026 void DataFile::setValues(const std::string& key,const std::vector< double >& data) {
00027 bool found = false;
00028 ValuesMap::iterator it;
00029 for(it=mValues.begin(); it!=mValues.end() && it->first!=key; ++it);
00030 if(it==mValues.end()) {
00031 ValuesMap::value_type empty;
00032 mValues.push_back(empty);
00033 mValues.back().first=key;
00034 mValues.back().second=data;
00035 }
00036 else
00037 it->second=data;
00038 }
00039
00040
00041 }