ARTS 2.5.0 (git: 9ee3ac6c)
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 "species_tags.h"
23#include "matpackI.h"
24#include "mystring.h"
25
38};
39
42class TokVal {
43 public:
46 : mtype(undefined_t), ms(), mn(-1), mx(0.), msv(), mnv(), mnst(), mxv(), mm() {}
47
49 TokVal(const char s[])
50 : mtype(String_t), ms(s), mn(-1), mx(0.), msv(), mnv(), mnst(), mxv(), mm() {}
51
53 TokVal(const String& s)
54 : mtype(String_t), ms(s), mn(-1), mx(0.), msv(), mnv(), mnst(), mxv(), mm() {}
55
58 : mtype(Index_t), ms(), mn(n), mx(0.), msv(), mnv(), mnst(), mxv(), mm() {}
59
62 : mtype(Numeric_t), ms(), mn(-1), mx(x), msv(), mnv(), mnst(), mxv(), mm() {}
63
67 ms(),
68 mn(-1),
69 mx(0.),
70 msv(sv),
71 mnv(),
72 mnst(),
73 mxv(),
74 mm() {}
75
79 ms(),
80 mn(-1),
81 mx(0.),
82 msv(),
83 mnv(nv),
84 mnst(),
85 mxv(),
86 mm() {}
87
91 ms(),
92 mn(-1),
93 mx(0.),
94 msv(),
95 mnv(),
96 mnst(nst),
97 mxv(),
98 mm() {}
99
102 : mtype(Vector_t), ms(), mn(-1), mx(0.), msv(), mnv(), mnst(), mxv(xv), mm() {}
103
106 : mtype(Matrix_t), ms(), mn(-1), mx(0.), msv(), mnv(), mnst(), mxv(), mm(m) {}
107
108 // Conversion functions to return TokVal for the 6 different types:
109
111 operator String() const;
113 operator Index() const;
115 operator Numeric() const;
116
118 operator ArrayOfString() const;
120 operator ArrayOfIndex() const;
122 operator ArrayOfSpeciesTag() const;
124 operator Vector() const;
126 operator Matrix() const;
127
129 friend std::ostream& operator<<(std::ostream& os, const TokVal& a);
130
131 private:
141};
142
143// typedef Array<TokValType> TokValTypeVector;
144// typedef Array<TokVal> TokValVector;
145
146#endif // token_h
This file contains the definition of Array.
Array< Index > ArrayOfIndex
An array of Index.
Definition: array.h:39
The Matrix class.
Definition: matpackI.h:1225
This stores arbitrary token values and remembers the type.
Definition: token.h:42
TokVal()
Default Constructor.
Definition: token.h:45
TokVal(Index n)
To set TokVal from an integer.
Definition: token.h:57
String ms
Definition: token.h:133
ArrayOfIndex mnv
Definition: token.h:137
ArrayOfString msv
Definition: token.h:136
TokVal(const String &s)
To set TokVal from String (C++ - style).
Definition: token.h:53
TokVal(ArrayOfString sv)
To set TokVal from an array of Strings.
Definition: token.h:65
Matrix mm
Definition: token.h:140
TokVal(const char s[])
To set TokVal from String (C - style).
Definition: token.h:49
Index mn
Definition: token.h:134
Numeric mx
Definition: token.h:135
TokVal(ArrayOfSpeciesTag nst)
To set TokVal from an array of species tags.
Definition: token.h:89
TokValType mtype
Definition: token.h:132
ArrayOfSpeciesTag mnst
Definition: token.h:138
TokVal(Numeric x)
To set TokVal from a Numeric.
Definition: token.h:61
TokVal(Matrix m)
To set TokVal from a Matrix.
Definition: token.h:105
TokVal(ArrayOfIndex nv)
To set TokVal from an array of integers.
Definition: token.h:77
Vector mxv
Definition: token.h:139
TokVal(Vector xv)
To set TokVal from a Vector.
Definition: token.h:101
friend std::ostream & operator<<(std::ostream &os, const TokVal &a)
Output operator.
The Vector class.
Definition: matpackI.h:876
Implementation of Matrix, Vector, and such stuff.
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
This file contains the definition of String, the ARTS string class.
Array< String > ArrayOfString
An array of Strings.
Definition: mystring.h:290
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:287
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
Definition: oem.h:33
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Definition: oem.h:31
#define a
TokValType
The different token value types.
Definition: token.h:28
@ String_t
Definition: token.h:29
@ Index_t
Definition: token.h:30
@ Vector_t
Definition: token.h:35
@ Array_String_t
Definition: token.h:32
@ Array_Index_t
Definition: token.h:33
@ Array_SpeciesTag_t
Definition: token.h:34
@ Matrix_t
Definition: token.h:36
@ Numeric_t
Definition: token.h:31
@ undefined_t
Definition: token.h:37