ARTS 2.5.0 (git: 9ee3ac6c)
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
31typedef void (*QuantumParseFunction)(Rational& qn,
32 String& s,
33 const Species::Species species);
34
37 public:
39
40 QuantumFieldDescription(QuantumNumberType quantum_id,
42 : mquantum_id(quantum_id), mqpfunc(qpfunc) {}
43
44 void Parse(QuantumNumbers& qnr, String& s, const Species::Species species) const {
45 Rational qn;
46 mqpfunc(qn, s, species);
47 if (!qn.isUndefined()) qnr.Set(mquantum_id, qn);
48 }
49
50 private:
51 QuantumNumberType mquantum_id;
53};
54
55#endif /* quantum_parser_h */
Class mapping quantum numbers to parsing functions.
QuantumParseFunction mqpfunc
QuantumFieldDescription(QuantumNumberType quantum_id, QuantumParseFunction qpfunc)
QuantumNumberType mquantum_id
void Parse(QuantumNumbers &qnr, String &s, const Species::Species species) const
Container class for Quantum Numbers.
Definition: quantum.h:112
constexpr void Set(Index qn, Rational r)
Set quantum number at position.
Definition: quantum.h:199
Implements rational numbers to work with other ARTS types.
Definition: rational.h:52
constexpr bool isUndefined() const noexcept
Is the object not defined.
Definition: rational.h:108
void(* QuantumParseFunction)(Rational &qn, String &s, const Species::Species species)
Function pointer type for quantum number parsing routines.