ARTS  2.2.66
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 "arts.h"
32 #include "array.h"
33 #include "exceptions.h"
34 
35 
37 void get_wsv_group_ids(ArrayOfIndex& ids, String name);
38 
40 Index get_wsv_group_id(const String& name);
41 
43 String get_array_groups_as_string(bool basetype_is_group = false, bool return_basetype_only = false);
44 
45 
54 class WsvRecord {
55 public:
56 
59  mdescription(),
60  mgroup(-1),
61  mimplicit(false)
62  { /* Nothing to do here */ }
63 
68  WsvRecord(const char name[],
69  const char description[],
70  const String& group,
71  const bool implicit = false)
72  : mname(name),
73  mdescription(description),
74  mgroup(-1),
75  mimplicit(implicit)
76  {
77  // Map the group names to groups' indexes
78  mgroup = get_wsv_group_id(group);
79  if (mgroup == -1)
80  {
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  {
100  // Nothing to do here
101  }
103  const String& Name() const { return mname; }
105  const String& Description() const { return mdescription; }
107  Index Group() const { return mgroup; }
109  bool Implicit() const { return mimplicit; }
110 private:
114  bool mimplicit;
115 };
116 
117 
120 ostream& operator<<(ostream& os, const WsvRecord& wr);
121 
122 #endif // wsv_aux_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
bool Implicit() const
Returns true if the variable was automatically created.
Definition: wsv_aux.h:109
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:205
Index mgroup
Definition: wsv_aux.h:113
WsvRecord()
Default constructor.
Definition: wsv_aux.h:58
Index Group() const
The wsv group to which this variable belongs.
Definition: wsv_aux.h:107
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:168
bool mimplicit
Definition: wsv_aux.h:114
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:103
This file contains the definition of Array.
The implementation for String, the ARTS string class.
Definition: mystring.h:63
The global header file for ARTS.
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:105
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:68
ostream & operator<<(ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:54
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:215