ARTS  2.4.0(git:4fb77825)
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
WsvRecord::mgroup
Index mgroup
Definition: wsv_aux.h:113
WsvRecord::WsvRecord
WsvRecord(const char name[], const char description[], const String &group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:70
WsvRecord::WsvRecord
WsvRecord()
Default constructor.
Definition: wsv_aux.h:59
exceptions.h
The declarations of all the exception classes.
get_array_groups_as_string
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
array.h
This file contains the definition of Array.
is_agenda_group_id
bool is_agenda_group_id(const Index group_id)
Check if group is an agenda group.
Definition: groups.cc:218
Array
This can be used to make arrays out of anything.
Definition: array.h:108
WsvRecord::Group
Index Group() const
The wsv group to which this variable belongs.
Definition: wsv_aux.h:106
WsvRecord::mdescription
String mdescription
Definition: wsv_aux.h:112
WsvRecord::WsvRecord
WsvRecord(const char name[], const char description[], const Index group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:91
my_basic_string< char >
WsvRecord::Name
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:102
operator<<
ostream & operator<<(ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.
Definition: agenda_record.cc:229
WsvRecord::mimplicit
bool mimplicit
Definition: wsv_aux.h:114
WsvRecord
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:56
WsvRecord::Description
const String & Description() const
A text describing this workspace variable.
Definition: wsv_aux.h:104
get_wsv_group_id
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:223
WsvRecord::Implicit
bool Implicit() const
Returns true if the variable was automatically created.
Definition: wsv_aux.h:108
WsvRecord::mname
String mname
Definition: wsv_aux.h:111
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
get_wsv_group_ids
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
Returns list of ids of the given group names.
Definition: groups.cc:186
arts.h
The global header file for ARTS.