ARTS  2.0.49
methods.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2008 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  msuppress_header(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 suppress_header = 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 SuppressHeader() const { return msuppress_header; }
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
MdRecord::GOut
const ArrayOfString & GOut() const
Definition: methods.h:93
MdRecord::Supergeneric
bool Supergeneric() const
Definition: methods.h:108
MdRecord::GOutSpecType
const ArrayOfArrayOfIndex & GOutSpecType() const
Definition: methods.h:95
MdRecord::SetPassWorkspace
void SetPassWorkspace()
Definition: methods.h:113
MdRecord::GOutType
const ArrayOfIndex & GOutType() const
Definition: methods.h:94
MdRecord::mgouttype
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Definition: methods.h:164
MdRecord::subst_any_with_group
friend void subst_any_with_group(MdRecord &mdd, Index g)
MdRecord::GInType
const ArrayOfIndex & GInType() const
Definition: methods.h:99
MdRecord::PassWsvNames
bool PassWsvNames() const
Definition: methods.h:111
MdRecord::mpass_workspace
bool mpass_workspace
Flag, whether a workspace reference should be passed to the WSM.
Definition: methods.h:234
MdRecord::mgoutspectype
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
Definition: methods.h:168
MdRecord::mauthors
ArrayOfString mauthors
Author(s) of this method.
Definition: methods.h:155
MdRecord::MdRecord
MdRecord()
Default constructor.
Definition: methods.h:46
MdRecord::mgintype
ArrayOfIndex mgintype
Generic Workspace Input.
Definition: methods.h:180
MdRecord::SetMethod
bool SetMethod() const
Definition: methods.h:106
MdRecord::SuppressHeader
bool SuppressHeader() const
Definition: methods.h:109
operator<<
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:641
MdRecord::OutOnly
const ArrayOfIndex & OutOnly() const
Definition: methods.h:105
matpackI.h
Array< String >
MdRecord::minout
ArrayOfIndex minout
Indexes of Input-Output variables.
Definition: methods.h:199
MdRecord::mname
String mname
The name of this method.
Definition: methods.h:149
MdRecord::ActualGroups
const String & ActualGroups() const
Definition: methods.h:112
MdRecord::mset_method
bool mset_method
Flag, whether this is a set method.
Definition: methods.h:206
MdRecord::mgoutdesc
ArrayOfString mgoutdesc
Generic Workspace Output Description.
Definition: methods.h:171
MdRecord::minput
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:174
MdRecord::operator=
MdRecord & operator=(const MdRecord &m)
To override the default assignment operator.
Definition: methods.h:134
MdRecord::mdescription
String mdescription
A text string describing this method.
Definition: methods.h:152
ArtsOut0
Definition: messages.h:134
messages.h
Declarations having to do with the four output streams.
_U_
#define _U_
Definition: config.h:158
my_basic_string< char >
MdRecord::GInDescription
const Array< String > & GInDescription() const
Definition: methods.h:102
MdRecord::AgendaMethod
bool AgendaMethod() const
Definition: methods.h:107
expand_md_data_raw_to_md_data
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
Definition: methods_aux.cc:364
Verbosity
Definition: messages.h:50
get_short_wsv_description
void get_short_wsv_description(String &s, const String &desc)
Definition: methods_aux.cc:533
make_array.h
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
MdRecord::magenda_method
bool magenda_method
Flag, whether this is an agenda method.
Definition: methods.h:213
MdRecord::Name
const String & Name() const
Definition: methods.h:89
define_md_data_raw
void define_md_data_raw()
Definition: methods.cc:121
MdRecord::In
const ArrayOfIndex & In() const
Definition: methods.h:97
MdRecord::mgindesc
ArrayOfString mgindesc
Generic Workspace Input Description.
Definition: methods.h:190
MdRecord::InOnly
const ArrayOfIndex & InOnly() const
Definition: methods.h:103
MdRecord::mgin
ArrayOfString mgin
Generic Workspace Input Names.
Definition: methods.h:177
MdRecord::GOutDescription
const Array< String > & GOutDescription() const
Definition: methods.h:96
MdRecord::GInDefault
const Array< String > & GInDefault() const
Definition: methods.h:101
MdRecord::InOut
const ArrayOfIndex & InOut() const
Definition: methods.h:104
MdRecord::mgout
ArrayOfString mgout
Generic Workspace Output Names.
Definition: methods.h:161
MdRecord::mgindefault
ArrayOfString mgindefault
Generic Workspace Input Defaults.
Definition: methods.h:187
MdRecord::GIn
const ArrayOfString & GIn() const
Definition: methods.h:98
define_md_raw_map
void define_md_raw_map()
Define MdRawMap.
Definition: methods_aux.cc:482
MdRecord
All information for one workspace method.
Definition: methods.h:42
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:313
format_paragraph
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset=0)
Definition: methods_aux.cc:494
MdRecord::GInSpecType
const ArrayOfArrayOfIndex & GInSpecType() const
Definition: methods.h:100
MdRecord::msuppress_header
bool msuppress_header
Flag, whether method header should be suppressed.
Definition: methods.h:227
MdRecord::subst_any_with_group
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
Definition: methods_aux.cc:268
MdRecord::PrintTemplate
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:556
MdRecord::mginspectype
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Definition: methods.h:184
MakeArray
Explicit construction of Arrays.
Definition: make_array.h:52
MdRecord::mactual_groups
String mactual_groups
The actual groups of a supergeneric method.
Definition: methods.h:248
MdRecord::msupergeneric
bool msupergeneric
Flag, whether this method is supergeneric.
Definition: methods.h:220
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:92
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:440
MdRecord::minonly
ArrayOfIndex minonly
Indexes of Input-only variables.
Definition: methods.h:193
MdRecord::moutput
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:158
MdRecord::Description
const String & Description() const
Definition: methods.h:90
MdRecord::PassWorkspace
bool PassWorkspace() const
Definition: methods.h:110
MdRecord::mpass_wsv_names
bool mpass_wsv_names
Flag, whether WSV names should be passed to the WSM.
Definition: methods.h:242
MdRecord::Authors
const ArrayOfString & Authors() const
Definition: methods.h:91
MdRecord::moutonly
ArrayOfIndex moutonly
Indexes of Output-only variables.
Definition: methods.h:196