ARTS  2.3.1285(git:92a29ea9-dirty)
wsv_aux.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 
28 #ifndef wsv_aux_h
29 #define wsv_aux_h
30 
31 #include "array.h"
32 #include "arts.h"
33 #include "exceptions.h"
34 
36 void get_wsv_group_ids(ArrayOfIndex& ids, String name);
37 
39 bool is_agenda_group_id(const Index group_id);
40 
42 Index get_wsv_group_id(const String& name);
43 
45 String get_array_groups_as_string(bool basetype_is_group = false,
46  bool return_basetype_only = false);
47 
56 class WsvRecord {
57  public:
60  : mname(),
61  mdescription(),
62  mgroup(-1),
63  mimplicit(false) { /* Nothing to do here */
64  }
65 
70  WsvRecord(const char name[],
71  const char description[],
72  const String& group,
73  const bool implicit = false)
74  : mname(name),
75  mdescription(description),
76  mgroup(-1),
77  mimplicit(implicit) {
78  // Map the group names to groups' indexes
79  mgroup = get_wsv_group_id(group);
80  if (mgroup == -1) {
81  ostringstream os;
82 
83  os << "Unknown WSV Group " << group << " WSV " << mname;
84  throw runtime_error(os.str());
85  }
86  }
87 
91  WsvRecord(const char name[],
92  const char description[],
93  const Index group,
94  const bool implicit = false)
95  : mname(name),
96  mdescription(description),
97  mgroup(group),
98  mimplicit(implicit) {
99  // Nothing to do here
100  }
102  const String& Name() const { return mname; }
104  const String& Description() const { return mdescription; }
106  Index Group() const { return mgroup; }
108  bool Implicit() const { return mimplicit; }
109 
110  private:
114  bool mimplicit;
115 };
116 
119 ostream& operator<<(ostream& os, const WsvRecord& wr);
120 
121 #endif // wsv_aux_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
bool Implicit() const
Returns true if the variable was automatically created.
Definition: wsv_aux.h:108
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:223
Index mgroup
Definition: wsv_aux.h:113
WsvRecord()
Default constructor.
Definition: wsv_aux.h:59
Index Group() const
The wsv group to which this variable belongs.
Definition: wsv_aux.h:106
String mname
Definition: wsv_aux.h:111
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
Returns list of ids of the given group names.
Definition: groups.cc:186
bool mimplicit
Definition: wsv_aux.h:114
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:102
This file contains the definition of Array.
The global header file for ARTS.
_CS_string_type str() const
Definition: sstream.h:491
WsvRecord(const char name[], const char description[], const Index group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:91
const String & Description() const
A text describing this workspace variable.
Definition: wsv_aux.h:104
The declarations of all the exception classes.
This can be used to make arrays out of anything.
Definition: array.h:40
String mdescription
Definition: wsv_aux.h:112
WsvRecord(const char name[], const char description[], const String &group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:70
ostream & operator<<(ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.
bool is_agenda_group_id(const Index group_id)
Check if group is an agenda group.
Definition: groups.cc:218
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:56
String get_array_groups_as_string(bool basetype_is_group=false, bool return_basetype_only=false)
Return string list of array types.
Definition: groups.cc:232