ARTS  2.2.66
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 "messages.h"
33 #include "make_array.h"
34 #include "matpackI.h"
35 
36 #define NODEF "@@THIS_KEYWORD_HAS_NO_DEFAULT_VALUE@@"
37 
38 class MdRecord;
39 ostream& operator<<(ostream& os, const MdRecord& mdr);
40 
42 class MdRecord {
43 public:
44 
47  mname( "" ),
48  mdescription( "" ),
49  mauthors( 0 ),
50  moutput( 0 ),
51  mgout( 0 ),
52  mgouttype( 0 ),
53  mgoutdesc( 0 ),
54  minput( 0 ),
55  mgin( 0 ),
56  mgintype( 0 ),
57  mgindefault( 0 ),
58  mgindesc( 0 ),
59  mset_method(false),
60  magenda_method(false),
61  msupergeneric(false),
62  muses_templates(false),
63  mpass_workspace(true),
64  mpass_wsv_names(false),
65  mactual_groups("")
66  {}
67 
68  // Initializing constructor. Implementation in methods_aux.cc.
69  MdRecord(const char name[],
70  const char description[],
71  const MakeArray<String>& authors,
72  const MakeArray<String>& output,
73  const MakeArray<String>& gout,
74  const MakeArray<String>& gouttype,
75  const MakeArray<String>& goutdesc,
76  const MakeArray<String>& input,
77  const MakeArray<String>& gin,
78  const MakeArray<String>& gintype,
79  const MakeArray<String>& gindefault _U_,
80  const MakeArray<String>& gindesc,
81  bool set_method = false,
82  bool agenda_method = false,
83  bool uses_templates = false,
84  bool pass_workspace = false,
85  bool pass_wsv_names = false
86  );
87 
88  // Methods returning the lookup information:
89  const String& Name() const { return mname; }
90  const String& Description() const { return mdescription; }
91  const ArrayOfString& Authors() const { return mauthors; }
92  const ArrayOfIndex& Out() const { return moutput; }
93  const ArrayOfString& GOut() const { return mgout; }
94  const ArrayOfIndex& GOutType() const { return mgouttype; }
95  const ArrayOfArrayOfIndex& GOutSpecType() const { return mgoutspectype; }
96  const Array<String>& GOutDescription()const { return mgoutdesc; }
97  const ArrayOfIndex& In() const { return minput; }
98  const ArrayOfString& GIn() const { return mgin; }
99  const ArrayOfIndex& GInType() const { return mgintype; }
100  const ArrayOfArrayOfIndex& GInSpecType() const { return mginspectype; }
101  const Array<String>& GInDefault() const { return mgindefault; }
102  const Array<String>& GInDescription() const { return mgindesc; }
103  const ArrayOfIndex& InOnly() const { return minonly; }
104  const ArrayOfIndex& InOut() const { return minout; }
105  const ArrayOfIndex& OutOnly() const { return moutonly; }
106  bool SetMethod() const { return mset_method; }
107  bool AgendaMethod() const { return magenda_method; }
108  bool Supergeneric() const { return msupergeneric; }
109  bool UsesTemplates() const { return muses_templates; }
110  bool PassWorkspace() const { return mpass_workspace; }
111  bool PassWsvNames() const { return mpass_wsv_names; }
112  const String& ActualGroups() const { return mactual_groups; }
114 
115  // Expand supergeneric method record to an actual group
116  // (documentation with implementation in method_aux.cc):
117  void subst_any_with_group( Index g );
119 
121 
130  ostream& PrintTemplate(ostream& os, bool show_description=true) const;
131 
133 
135  Verbosity verbosity;
136  ArtsOut0 out0(verbosity);
137  out0 << "MdRecord cannot be assigned!\n"
138  << "You tried to assign: " << m << "\n";
139  arts_exit ();
140  return *this;
141  }
142 
143  // Needed by make_auto_md_h.cc. See documentation there.
144  friend void subst_any_with_group( MdRecord& mdd, Index g );
145 
146 private:
147 
150 
153 
156 
159 
162 
165 
167  // is not completely supergeneric but only defined for these types).
169 
172 
175 
178 
181 
183  // is not completely supergeneric but only defined for these types).
185 
188 
191 
194 
197 
200 
202 
207 
209 
214 
216 
221 
223 
228 
230 
235 
237 
243 
245 
249 };
250 
251 void define_md_data_raw();
252 
254 
255 bool format_paragraph (String &s, const String &indent, 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:35
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:472
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:588
String mname
The name of this method.
Definition: methods.h:149
void arts_exit(int status)
This is the exit function of ARTS.
Definition: arts.cc:42
Explicit construction of Arrays.
Definition: make_array.h:51
Declarations having to do with the four output streams.
void SetPassWorkspace()
Definition: methods.h:113
bool AgendaMethod() const
Definition: methods.h:107
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:164
MdRecord()
Default constructor.
Definition: methods.h:46
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:174
bool SetMethod() const
Definition: methods.h:106
ArrayOfString mauthors
Author(s) of this method.
Definition: methods.h:155
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:673
bool muses_templates
Flag, whether method implementation relies on templates.
Definition: methods.h:227
const ArrayOfIndex & Out() const
Definition: methods.h:92
bool PassWsvNames() const
Definition: methods.h:111
const Array< String > & GInDescription() const
Definition: methods.h:102
All information for one workspace method.
Definition: methods.h:42
bool Supergeneric() const
Definition: methods.h:108
const String & Name() const
Definition: methods.h:89
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:168
ArrayOfString mgoutdesc
Generic Workspace Output Description.
Definition: methods.h:171
const ArrayOfString & GOut() const
Definition: methods.h:93
const Array< String > & GInDefault() const
Definition: methods.h:101
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:396
String mdescription
A text string describing this method.
Definition: methods.h:152
void define_md_data_raw()
Definition: methods.cc:126
const String & ActualGroups() const
Definition: methods.h:112
const ArrayOfIndex & OutOnly() const
Definition: methods.h:105
bool mpass_workspace
Flag, whether a workspace reference should be passed to the WSM.
Definition: methods.h:234
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
Definition: methods_aux.cc:345
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:199
const ArrayOfIndex & In() const
Definition: methods.h:97
MdRecord & operator=(const MdRecord &m)
To override the default assignment operator.
Definition: methods.h:134
ArrayOfString mgindesc
Generic Workspace Input Description.
Definition: methods.h:190
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:100
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:248
const ArrayOfString & Authors() const
Definition: methods.h:91
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset=0)
Definition: methods_aux.cc:526
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization...
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:177
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:161
bool magenda_method
Flag, whether this is an agenda method.
Definition: methods.h:213
const ArrayOfIndex & InOut() const
Definition: methods.h:104
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:514
const ArrayOfIndex & InOnly() const
Definition: methods.h:103
const ArrayOfIndex & GOutType() const
Definition: methods.h:94
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:158
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:565
bool mset_method
Flag, whether this is a set method.
Definition: methods.h:206
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:196
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:187
const Array< String > & GOutDescription() const
Definition: methods.h:96
#define _U_
Definition: config.h:167
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:95
bool mpass_wsv_names
Flag, whether WSV names should be passed to the WSM.
Definition: methods.h:242
const String & Description() const
Definition: methods.h:90
const ArrayOfIndex & GInType() const
Definition: methods.h:99
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:300
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:180
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:220
const ArrayOfString & GIn() const
Definition: methods.h:98
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:184
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:193
bool UsesTemplates() const
Definition: methods.h:109
bool PassWorkspace() const
Definition: methods.h:110