ARTS  2.3.1285(git:92a29ea9-dirty)
methods.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2012 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
28 #ifndef methods_h
29 #define methods_h
30 
31 #include <iosfwd>
32 #include "matpackI.h"
33 #include "messages.h"
34 
35 #define NODEF "@@THIS_KEYWORD_HAS_NO_DEFAULT_VALUE@@"
36 
37 class MdRecord;
38 ostream& operator<<(ostream& os, const MdRecord& mdr);
39 
41 class MdRecord {
42  public:
45  : mname(""),
46  mdescription(""),
47  mauthors(0),
48  moutput(0),
49  mgout(0),
50  mgouttype(0),
51  mgoutdesc(0),
52  minput(0),
53  mgin(0),
54  mgintype(0),
55  mgindefault(0),
56  mgindesc(0),
57  mset_method(false),
58  magenda_method(false),
59  msupergeneric(false),
60  muses_templates(false),
61  mpass_workspace(true),
62  mpass_wsv_names(false),
63  mactual_groups("") {}
64 
65  // Initializing constructor. Implementation in methods_aux.cc.
66  MdRecord(const char name[],
67  const char description[],
68  const ArrayOfString& authors,
69  const ArrayOfString& output,
70  const ArrayOfString& gout,
71  const ArrayOfString& gouttype,
72  const ArrayOfString& goutdesc,
73  const ArrayOfString& input,
74  const ArrayOfString& gin,
75  const ArrayOfString& gintype,
76  const ArrayOfString& gindefault _U_,
77  const ArrayOfString& gindesc,
78  bool set_method = false,
79  bool agenda_method = false,
80  bool uses_templates = false,
81  bool pass_workspace = false,
82  bool pass_wsv_names = false);
83 
84  MdRecord(const MdRecord&) = default;
85  MdRecord(MdRecord&&) = default;
86 
87  // Methods returning the lookup information:
88  const String& Name() const { return mname; }
89  const String& Description() const { return mdescription; }
90  const ArrayOfString& Authors() const { return mauthors; }
91  const ArrayOfIndex& Out() const { return moutput; }
92  const ArrayOfString& GOut() const { return mgout; }
93  const ArrayOfIndex& GOutType() const { return mgouttype; }
94  const ArrayOfArrayOfIndex& GOutSpecType() const { return mgoutspectype; }
95  const Array<String>& GOutDescription() const { return mgoutdesc; }
96  const ArrayOfIndex& In() const { return minput; }
97  const ArrayOfString& GIn() const { return mgin; }
98  const ArrayOfIndex& GInType() const { return mgintype; }
99  const ArrayOfArrayOfIndex& GInSpecType() const { return mginspectype; }
100  const Array<String>& GInDefault() const { return mgindefault; }
101  const Array<String>& GInDescription() const { return mgindesc; }
102  const ArrayOfIndex& InOnly() const { return minonly; }
103  const ArrayOfIndex& InOut() const { return minout; }
104  const ArrayOfIndex& OutOnly() const { return moutonly; }
105  bool SetMethod() const { return mset_method; }
106  bool AgendaMethod() const { return magenda_method; }
107  bool Supergeneric() const { return msupergeneric; }
108  bool UsesTemplates() const { return muses_templates; }
109  bool PassWorkspace() const { return mpass_workspace; }
110  bool PassWsvNames() const { return mpass_wsv_names; }
111  const String& ActualGroups() const { return mactual_groups; }
113 
114  // Expand supergeneric method record to an actual group
115  // (documentation with implementation in method_aux.cc):
116  void subst_any_with_group(Index g);
118 
120 
129  ostream& PrintTemplate(ostream& os, bool show_description = true) const;
130 
132 
134  Verbosity verbosity;
135  ArtsOut0 out0(verbosity);
136  out0 << "MdRecord cannot be assigned!\n"
137  << "You tried to assign: " << m << "\n";
138  arts_exit();
139  return *this;
140  }
141 
142  // Needed by make_auto_md_h.cc. See documentation there.
143  friend void subst_any_with_group(MdRecord& mdd, Index g);
144 
145  private:
148 
151 
154 
157 
160 
163 
165  // is not completely supergeneric but only defined for these types).
167 
170 
173 
176 
179 
181  // is not completely supergeneric but only defined for these types).
183 
186 
189 
192 
195 
198 
200 
205 
207 
212 
214 
219 
221 
226 
228 
233 
235 
241 
243 
247 };
248 
249 void define_md_data_raw();
250 
252 
253 bool format_paragraph(String& s,
254  const String& indent,
255  const size_t linelen,
256  const size_t offset = 0);
257 
258 void define_md_map();
259 
260 void define_md_raw_map();
261 
262 void get_short_wsv_description(String& s, const String& desc);
263 
264 #endif // methods_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:473
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:572
String mname
The name of this method.
Definition: methods.h:147
void arts_exit(int status)
This is the exit function of ARTS.
Definition: arts.cc:42
Declarations having to do with the four output streams.
void SetPassWorkspace()
Definition: methods.h:112
bool AgendaMethod() const
Definition: methods.h:106
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:162
MdRecord()
Default constructor.
Definition: methods.h:44
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:172
bool SetMethod() const
Definition: methods.h:105
ArrayOfString mauthors
Author(s) of this method.
Definition: methods.h:153
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:648
bool muses_templates
Flag, whether method implementation relies on templates.
Definition: methods.h:225
const ArrayOfIndex & Out() const
Definition: methods.h:91
bool PassWsvNames() const
Definition: methods.h:110
const Array< String > & GInDescription() const
Definition: methods.h:101
All information for one workspace method.
Definition: methods.h:41
bool Supergeneric() const
Definition: methods.h:107
const String & Name() const
Definition: methods.h:88
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:166
ArrayOfString mgoutdesc
Generic Workspace Output Description.
Definition: methods.h:169
const ArrayOfString & GOut() const
Definition: methods.h:92
const Array< String > & GInDefault() const
Definition: methods.h:100
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:410
String mdescription
A text string describing this method.
Definition: methods.h:150
void define_md_data_raw()
Definition: methods.cc:191
const String & ActualGroups() const
Definition: methods.h:111
const ArrayOfIndex & OutOnly() const
Definition: methods.h:104
bool mpass_workspace
Flag, whether a workspace reference should be passed to the WSM.
Definition: methods.h:232
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
Definition: methods_aux.cc:364
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:197
const ArrayOfIndex & In() const
Definition: methods.h:96
MdRecord & operator=(const MdRecord &m)
To override the default assignment operator.
Definition: methods.h:133
ArrayOfString mgindesc
Generic Workspace Input Description.
Definition: methods.h:188
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:99
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:246
const ArrayOfString & Authors() const
Definition: methods.h:90
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset=0)
Definition: methods_aux.cc:518
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:175
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:159
Implementation of Matrix, Vector, and such stuff.
bool magenda_method
Flag, whether this is an agenda method.
Definition: methods.h:211
const ArrayOfIndex & InOut() const
Definition: methods.h:103
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:509
const ArrayOfIndex & InOnly() const
Definition: methods.h:102
const ArrayOfIndex & GOutType() const
Definition: methods.h:93
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:156
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:552
bool mset_method
Flag, whether this is a set method.
Definition: methods.h:204
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:194
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:185
const Array< String > & GOutDescription() const
Definition: methods.h:95
#define _U_
Definition: config.h:183
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:94
bool mpass_wsv_names
Flag, whether WSV names should be passed to the WSM.
Definition: methods.h:240
const String & Description() const
Definition: methods.h:89
const ArrayOfIndex & GInType() const
Definition: methods.h:98
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:321
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:178
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:218
const ArrayOfString & GIn() const
Definition: methods.h:97
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:182
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:191
bool UsesTemplates() const
Definition: methods.h:108
bool PassWorkspace() const
Definition: methods.h:109