ARTS  2.3.1285(git:92a29ea9-dirty)
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 */
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
QuantumNumberType mquantum_id
void(* QuantumParseFunction)(Rational &qn, String &s, const Index species)
Function pointer type for quantum number parsing routines.
QuantumNumberType
Enum for Quantum Numbers used for indexing.
Definition: quantum.h:48
Implements rational numbers to work with other ARTS types.
Definition: rational.h:54
void Parse(QuantumNumbers &qnr, String &s, const Index species) const
void Set(Index qn, Rational r)
Set quantum number at position.
Definition: quantum.h:310
Container class for Quantum Numbers.
Definition: quantum.h:222
constexpr bool isUndefined() const
Is the object not defined.
Definition: rational.h:110
QuantumFieldDescription(QuantumNumberType quantum_id, QuantumParseFunction qpfunc)
QuantumParseFunction mqpfunc
Class mapping quantum numbers to parsing functions.