ARTS  1.0.222
m_method_list.cc
Go to the documentation of this file.
1 
10 #include <map>
11 #include <stdexcept>
12 #include "arts.h"
13 #include "mystring.h"
14 #include "array.h"
15 
17 
28 void MethodListDefine(// WS Generic Output:
29  ArrayOfIndex& ml,
30  // WS Generic Output Names:
31  const String& /* ml_name */,
32  // Control Parameters:
33  const ArrayOfString& methods)
34 {
35  // The method data map. We can use this to find out the index of
36  // each method.
37  extern const std::map<String, Index> MdMap;
38 
39  // Make ml the right size:
40  ml.resize(methods.nelem());
41 
42  // Loop through the given method names:
43  for ( Index i=0; i<methods.nelem(); ++i )
44  {
45  // Find method id:
46  const map<String, Index>::const_iterator im = MdMap.find(methods[i]);
47  if ( im == MdMap.end() )
48  {
49  ostringstream os;
50  os << "\"" << methods[i] << "\" is not a valid method. "
51  << "Try \"arts -m all\" to\n"
52  << "get a list of all ARTS methods.";
53  throw runtime_error( os.str() );
54  }
55 
56  // Assign to our method list:
57  ml[i] = im->second;
58  }
59 }
MethodListDefine
void MethodListDefine(ArrayOfIndex &ml, const String &, const ArrayOfString &methods)
Set up a method list.
Definition: m_method_list.cc:28
array.h
This file contains the definition of Array.
Array< Index >
MdMap
std::map< String, Index > MdMap
The map associated with md_data.
Definition: globals_2.cc:56
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:61
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: arts.h:153
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:115
mystring.h
This file contains the definition of String, the ARTS string class.
arts.h
The global header file for ARTS.