00001
00010 #include <map>
00011 #include <stdexcept>
00012 #include "arts.h"
00013 #include "mystring.h"
00014 #include "array.h"
00015
00017
00028 void MethodListDefine(
00029 ArrayOfIndex& ml,
00030
00031 const String& ,
00032
00033 const ArrayOfString& methods)
00034 {
00035
00036
00037 extern const std::map<String, Index> MdMap;
00038
00039
00040 ml.resize(methods.nelem());
00041
00042
00043 for ( Index i=0; i<methods.nelem(); ++i )
00044 {
00045
00046 const map<String, Index>::const_iterator im = MdMap.find(methods[i]);
00047 if ( im == MdMap.end() )
00048 {
00049 ostringstream os;
00050 os << "\"" << methods[i] << "\" is not a valid method. "
00051 << "Try \"arts -m all\" to\n"
00052 << "get a list of all ARTS methods.";
00053 throw runtime_error( os.str() );
00054 }
00055
00056
00057 ml[i] = im->second;
00058 }
00059 }