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
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:68
WsvRecord::WsvRecord
WsvRecord()
Default constructor.
Definition: wsv_aux.h:58
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:215
array.h
This file contains the definition of Array.
Array< Index >
WsvRecord::Group
Index Group() const
The wsv group to which this variable belongs.
Definition: wsv_aux.h:107
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
The implementation for String, the ARTS string class.
Definition: mystring.h:64
WsvRecord::Name
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:103
operator<<
ostream & operator<<(ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.
Definition: agenda_record.cc:238
WsvRecord::mimplicit
bool mimplicit
Definition: wsv_aux.h:114
WsvRecord
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:54
WsvRecord::Description
const String & Description() const
A text describing this workspace variable.
Definition: wsv_aux.h:105
get_wsv_group_id
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:205
WsvRecord::Implicit
bool Implicit() const
Returns true if the variable was automatically created.
Definition: wsv_aux.h:109
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:35
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:168
arts.h
The global header file for ARTS.