ARTS  1.0.222
methods.h
Go to the documentation of this file.
1 /* Copyright (C) 2000, 2001 Stefan Buehler <sbuehler@uni-bremen.de>
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 "token.h"
32 #include "make_array.h"
33 
35 class MdRecord {
36 public:
37 
40  mname( "" ),
41  mdescription( "" ),
42  moutput( 0 ),
43  minput( 0 ),
44  mgoutput( 0 ),
45  mginput( 0 ),
46  mkeywords( 0 ),
47  mtypes( 0 )
48  {};
49 
52  MdRecord(const char name[],
53  const char description[],
54  const MakeArray<Index>& output,
55  const MakeArray<Index>& input,
56  const MakeArray<Index>& goutput,
57  const MakeArray<Index>& ginput,
58  const MakeArray<String>& keywords,
59  const MakeArray<TokValType>& types) :
60  mname( name ),
61  mdescription( description ),
62  moutput( output ),
63  minput( input ),
64  mgoutput( goutput ),
65  mginput( ginput ),
66  mkeywords( keywords ),
67  mtypes( types )
68  {
69  // Initializing the various arrays with input data should now
70  // work correctly.
71 
72  // Keywords and type must have the same number of
73  // elements. (Types specifies the types associated with each
74  // keyword.)
75  assert( mkeywords.nelem() == mtypes.nelem() );
76  }
77 
78  const String& Name() const { return mname; }
79  const String& Description() const { return mdescription; }
80  const ArrayOfIndex& Output() const { return moutput; }
81  const ArrayOfIndex& Input() const { return minput; }
82  const ArrayOfIndex& GOutput() const { return mgoutput; }
83  const ArrayOfIndex& GInput() const { return mginput; }
84  const Array<String>& Keywords() const { return mkeywords; }
85  const Array<TokValType>& Types() const { return mtypes; }
86 
94  ostream& PrintTemplate(ostream& os, bool show_description=true) const;
95 
99  cout << "MdRecord cannot be assigned!\n";
100  exit(1);
101  }
102 private:
103 
106 
109 
112 
115 
118 
121 
124 
127 
128 };
129 
130 
131 // Some #defines and typedefs to make the records better readable:
132 #define NAME(x) x
133 #define DESCRIPTION(x) x
134 #define OUTPUT MakeArray<Index>
135 #define INPUT MakeArray<Index>
136 #define GOUTPUT MakeArray<Index>
137 #define GINPUT MakeArray<Index>
138 #define KEYWORDS MakeArray<String>
139 #define TYPES MakeArray<TokValType>
140 
145 void define_md_data();
146 
149 void define_md_map();
150 
153 ostream& operator<<(ostream& os, const MdRecord& mdr);
154 
155 
156 #endif // methods_h
MdRecord::operator=
MdRecord operator=(const MdRecord &)
To override the default assignment operator.
Definition: methods.h:98
MdRecord::MdRecord
MdRecord(const char name[], const char description[], const MakeArray< Index > &output, const MakeArray< Index > &input, const MakeArray< Index > &goutput, const MakeArray< Index > &ginput, const MakeArray< String > &keywords, const MakeArray< TokValType > &types)
The only non-trivial constructor, which sets all the fields.
Definition: methods.h:52
MdRecord::Types
const Array< TokValType > & Types() const
Definition: methods.h:85
MdRecord::mgoutput
ArrayOfIndex mgoutput
Generic Workspace Output.
Definition: methods.h:117
MdRecord::MdRecord
MdRecord()
Default constructor.
Definition: methods.h:39
MdRecord::Output
const ArrayOfIndex & Output() const
Definition: methods.h:80
operator<<
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
Definition: methods_aux.cc:110
MdRecord::mtypes
Array< TokValType > mtypes
Types associated with keywords.
Definition: methods.h:126
MdRecord::Keywords
const Array< String > & Keywords() const
Definition: methods.h:84
MdRecord::Input
const ArrayOfIndex & Input() const
Definition: methods.h:81
MdRecord::mginput
ArrayOfIndex mginput
Generic Workspace Input.
Definition: methods.h:120
Array< Index >
MdRecord::mname
String mname
The name of this method.
Definition: methods.h:105
MdRecord::minput
ArrayOfIndex minput
Workspace Input.
Definition: methods.h:114
MdRecord::mdescription
String mdescription
A text string describing this method.
Definition: methods.h:108
my_basic_string< char >
make_array.h
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
MdRecord::Name
const String & Name() const
Definition: methods.h:78
define_md_data
void define_md_data()
Define the lookup data for the workspace methods.
Definition: methods.cc:42
MdRecord::GInput
const ArrayOfIndex & GInput() const
Definition: methods.h:83
MdRecord::mkeywords
ArrayOfString mkeywords
Keywords.
Definition: methods.h:123
MdRecord::GOutput
const ArrayOfIndex & GOutput() const
Definition: methods.h:82
MdRecord
This class contains all information for one workspace method.
Definition: methods.h:35
MdRecord::PrintTemplate
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
Definition: methods_aux.cc:49
MakeArray
Explicit construction of Arrays.
Definition: make_array.h:52
define_md_map
void define_md_map()
Define MdMap.
Definition: methods_aux.cc:37
token.h
MdRecord::moutput
ArrayOfIndex moutput
Workspace Output.
Definition: methods.h:111
MdRecord::Description
const String & Description() const
Definition: methods.h:79
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:115