ARTS  2.4.0(git:4fb77825)
quantum_parser.h
Go to the documentation of this file.
1 /* Copyright (C) 2015, The ARTS Developers.
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 
25 #ifndef quantum_parser_h
26 #define quantum_parser_h
27 
28 #include "quantum.h"
29 
31 typedef void (*QuantumParseFunction)(Rational& qn,
32  String& s,
33  const Index species);
34 
37  public:
39 
41  QuantumParseFunction qpfunc)
42  : mquantum_id(quantum_id), mqpfunc(qpfunc) {}
43 
44  void Parse(QuantumNumbers& qnr, String& s, const Index species) const {
45  Rational qn;
46  mqpfunc(qn, s, species);
47  if (!qn.isUndefined()) qnr.Set(mquantum_id, qn);
48  }
49 
50  private:
53 };
54 
55 #endif /* quantum_parser_h */
QuantumFieldDescription::mquantum_id
QuantumNumberType mquantum_id
Definition: quantum_parser.h:51
QuantumNumbers
Container class for Quantum Numbers.
Definition: quantum.h:222
QuantumNumberType
QuantumNumberType
Enum for Quantum Numbers used for indexing.
Definition: quantum.h:48
QuantumFieldDescription::QuantumFieldDescription
QuantumFieldDescription()
Definition: quantum_parser.h:38
quantum.h
QuantumParseFunction
void(* QuantumParseFunction)(Rational &qn, String &s, const Index species)
Function pointer type for quantum number parsing routines.
Definition: quantum_parser.h:31
my_basic_string< char >
QuantumFieldDescription
Class mapping quantum numbers to parsing functions.
Definition: quantum_parser.h:36
QuantumFieldDescription::Parse
void Parse(QuantumNumbers &qnr, String &s, const Index species) const
Definition: quantum_parser.h:44
QuantumFieldDescription::mqpfunc
QuantumParseFunction mqpfunc
Definition: quantum_parser.h:52
Rational::isUndefined
constexpr bool isUndefined() const
Is the object not defined.
Definition: rational.h:110
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
QuantumFieldDescription::QuantumFieldDescription
QuantumFieldDescription(QuantumNumberType quantum_id, QuantumParseFunction qpfunc)
Definition: quantum_parser.h:40
QuantumNumbers::Set
void Set(Index qn, Rational r)
Set quantum number at position.
Definition: quantum.h:310
Rational
Implements rational numbers to work with other ARTS types.
Definition: rational.h:54