ARTS  2.3.1285(git:92a29ea9-dirty)
token.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 
18 #ifndef token_h
19 #define token_h
20 
21 #include "array.h"
22 #include "matpackI.h"
23 #include "mystring.h"
24 
27 enum TokValType {
36 };
37 
40 class TokVal {
41  public:
44  : mtype(undefined_t), ms(), mn(-1), mx(0.), msv(), mnv(), mxv(), mm() {}
45 
47  TokVal(const char s[])
48  : mtype(String_t), ms(s), mn(-1), mx(0.), msv(), mnv(), mxv(), mm() {}
49 
51  TokVal(const String& s)
52  : mtype(String_t), ms(s), mn(-1), mx(0.), msv(), mnv(), mxv(), mm() {}
53 
56  : mtype(Index_t), ms(), mn(n), mx(0.), msv(), mnv(), mxv(), mm() {}
57 
60  : mtype(Numeric_t), ms(), mn(-1), mx(x), msv(), mnv(), mxv(), mm() {}
61 
65  ms(),
66  mn(-1),
67  mx(0.),
68  msv(sv),
69  mnv(),
70  mxv(),
71  mm() {}
72 
76  ms(),
77  mn(-1),
78  mx(0.),
79  msv(),
80  mnv(nv),
81  mxv(),
82  mm() {}
83 
86  : mtype(Vector_t), ms(), mn(-1), mx(0.), msv(), mnv(), mxv(xv), mm() {}
87 
90  : mtype(Matrix_t), ms(), mn(-1), mx(0.), msv(), mnv(), mxv(), mm(m) {}
91 
92  // Conversion functions to return TokVal for the 6 different types:
93 
95  operator String() const;
97  operator Index() const;
99  operator Numeric() const;
100 
102  operator ArrayOfString() const;
104  operator ArrayOfIndex() const;
106  operator Vector() const;
108  operator Matrix() const;
109 
111  friend std::ostream& operator<<(std::ostream& os, const TokVal& a);
112 
113  private:
122 };
123 
124 // typedef Array<TokValType> TokValTypeVector;
125 // typedef Array<TokVal> TokValVector;
126 
127 #endif // token_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Index mn
Definition: token.h:116
Numeric mx
Definition: token.h:117
The Vector class.
Definition: matpackI.h:860
TokValType
The different token value types.
Definition: token.h:27
ArrayOfIndex mnv
Definition: token.h:119
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Definition: oem.h:32
TokVal(ArrayOfString sv)
To set TokVal from an array of Strings.
Definition: token.h:63
TokVal(Numeric x)
To set TokVal from a Numeric.
Definition: token.h:59
TokVal(const String &s)
To set TokVal from String (C++ - style).
Definition: token.h:51
Array< Index > ArrayOfIndex
An array of Index.
Definition: array.h:40
This file contains the definition of Array.
TokVal(const char s[])
To set TokVal from String (C - style).
Definition: token.h:47
TokVal(Index n)
To set TokVal from an integer.
Definition: token.h:55
String ms
Definition: token.h:115
TokVal(Matrix m)
To set TokVal from a Matrix.
Definition: token.h:89
Definition: token.h:29
Vector mxv
Definition: token.h:120
Definition: token.h:34
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
The Matrix class.
Definition: matpackI.h:1193
TokVal(ArrayOfIndex nv)
To set TokVal from an array of integers.
Definition: token.h:74
Array< String > ArrayOfString
An array of Strings.
Definition: mystring.h:283
Implementation of Matrix, Vector, and such stuff.
friend std::ostream & operator<<(std::ostream &os, const TokVal &a)
Output operator.
Matrix mm
Definition: token.h:121
ArrayOfString msv
Definition: token.h:118
TokValType mtype
Definition: token.h:114
TokVal()
Default Constructor.
Definition: token.h:43
Definition: token.h:33
TokVal(Vector xv)
To set TokVal from a Vector.
Definition: token.h:85
This stores arbitrary token values and remembers the type.
Definition: token.h:40
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
Definition: oem.h:34
Definition: token.h:28
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:280
This file contains the definition of String, the ARTS string class.