DataFile.cpp

Go to the documentation of this file.
00001 #include "DataFile.h"
00002 
00003 namespace ICLIB {
00004 
00005 const std::vector< double >& DataFile::getValues(const std::string& key) const /*throw(Tango::DevFailed)*/ {
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                 /*Tango::Except::throw_exception( 
00018                         static_cast<const char*>("TANGO_DEVICE_ERROR"), 
00019                         static_cast<const char*>(err.str().c_str()),
00020                         static_cast<const char*>("DataFile::getValues"));*/
00021         }
00022         else
00023                 return it->second;
00024 }
00025 
00026 void DataFile::setValues(const std::string& key,const std::vector< double >& data) /*throw(Tango::DevFailed) */{
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 } // namespace

Generated on Tue Apr 14 09:50:27 2009 for Interpolator Library by  doxygen 1.4.5