ARTS  2.4.0(git:4fb77825)
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 
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
MdRecord::GOut
const ArrayOfString & GOut() const
Definition: methods.h:92
MdRecord::UsesTemplates
bool UsesTemplates() const
Definition: methods.h:108
MdRecord::Supergeneric
bool Supergeneric() const
Definition: methods.h:107
MdRecord::GOutSpecType
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:94
MdRecord::SetPassWorkspace
void SetPassWorkspace()
Definition: methods.h:112
MdRecord::GOutType
const ArrayOfIndex & GOutType() const
Definition: methods.h:93
MdRecord::mgouttype
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:162
MdRecord::subst_any_with_group
friend void subst_any_with_group(MdRecord &mdd, Index g)
MdRecord::GInType
const ArrayOfIndex & GInType() const
Definition: methods.h:98
MdRecord::PassWsvNames
bool PassWsvNames() const
Definition: methods.h:110
MdRecord::mpass_workspace
bool mpass_workspace
Flag, whether a workspace reference should be passed to the WSM.
Definition: methods.h:232
MdRecord::mgoutspectype
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:166
MdRecord::mauthors
ArrayOfString mauthors
Author(s) of this method.
Definition: methods.h:153
ARTS::Var::verbosity
Verbosity verbosity(Workspace &ws) noexcept
Definition: autoarts.h:7112
MdRecord::MdRecord
MdRecord()
Default constructor.
Definition: methods.h:44
MdRecord::muses_templates
bool muses_templates
Flag, whether method implementation relies on templates.
Definition: methods.h:225
MdRecord::mgintype
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:178
MdRecord::SetMethod
bool SetMethod() const
Definition: methods.h:105
operator<<
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:648
MdRecord::OutOnly
const ArrayOfIndex & OutOnly() const
Definition: methods.h:104
matpackI.h
Implementation of Matrix, Vector, and such stuff.
Array< String >
MdRecord::minout
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:197
MdRecord::mname
String mname
The name of this method.
Definition: methods.h:147
MdRecord::ActualGroups
const String & ActualGroups() const
Definition: methods.h:111
MdRecord::mset_method
bool mset_method
Flag, whether this is a set method.
Definition: methods.h:204
MdRecord::mgoutdesc
ArrayOfString mgoutdesc
Generic Workspace Output Description.
Definition: methods.h:169
MdRecord::minput
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:172
MdRecord::operator=
MdRecord & operator=(const MdRecord &m)
To override the default assignment operator.
Definition: methods.h:133
MdRecord::mdescription
String mdescription
A text string describing this method.
Definition: methods.h:150
ArtsOut0
Definition: messages.h:138
messages.h
Declarations having to do with the four output streams.
_U_
#define _U_
Definition: config.h:183
my_basic_string< char >
MdRecord::GInDescription
const Array< String > & GInDescription() const
Definition: methods.h:101
MdRecord::AgendaMethod
bool AgendaMethod() const
Definition: methods.h:106
expand_md_data_raw_to_md_data
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:410
Verbosity
Definition: messages.h:49
get_short_wsv_description
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:552
MdRecord::magenda_method
bool magenda_method
Flag, whether this is an agenda method.
Definition: methods.h:211
MdRecord::Name
const String & Name() const
Definition: methods.h:88
define_md_data_raw
void define_md_data_raw()
Definition: methods.cc:191
MdRecord::In
const ArrayOfIndex & In() const
Definition: methods.h:96
MdRecord::mgindesc
ArrayOfString mgindesc
Generic Workspace Input Description.
Definition: methods.h:188
MdRecord::InOnly
const ArrayOfIndex & InOnly() const
Definition: methods.h:102
MdRecord::mgin
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:175
MdRecord::GOutDescription
const Array< String > & GOutDescription() const
Definition: methods.h:95
MdRecord::GInDefault
const Array< String > & GInDefault() const
Definition: methods.h:100
MdRecord::InOut
const ArrayOfIndex & InOut() const
Definition: methods.h:103
MdRecord::mgout
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:159
MdRecord::mgindefault
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:185
MdRecord::GIn
const ArrayOfString & GIn() const
Definition: methods.h:97
define_md_raw_map
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:509
MdRecord
All information for one workspace method.
Definition: methods.h:41
MdRecord::subst_any_with_specific_group
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
Definition: methods_aux.cc:364
MdRecord::MdRecord
MdRecord(MdRecord &&)=default
format_paragraph
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset=0)
Definition: methods_aux.cc:518
MdRecord::GInSpecType
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:99
MdRecord::subst_any_with_group
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:321
MdRecord::MdRecord
MdRecord(const MdRecord &)=default
MdRecord::PrintTemplate
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:572
MdRecord::mginspectype
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:182
MdRecord::mactual_groups
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:246
MdRecord::msupergeneric
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:218
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
MdRecord::Out
const ArrayOfIndex & Out() const
Definition: methods.h:91
arts_exit
void arts_exit(int status)
This is the exit function of ARTS.
Definition: arts.cc:42
define_md_map
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:473
MdRecord::minonly
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:191
MdRecord::moutput
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:156
MdRecord::Description
const String & Description() const
Definition: methods.h:89
MdRecord::PassWorkspace
bool PassWorkspace() const
Definition: methods.h:109
MdRecord::mpass_wsv_names
bool mpass_wsv_names
Flag, whether WSV names should be passed to the WSM.
Definition: methods.h:240
MdRecord::Authors
const ArrayOfString & Authors() const
Definition: methods.h:90
MdRecord::moutonly
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:194