ARTS  2.0.49
wsv_aux.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2008 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 // Global functions
36 void get_wsv_group_ids(ArrayOfIndex& ids, String name);
37 Index get_wsv_group_id(const String& name);
39 
40 
49 class WsvRecord {
50 public:
51 
54  mdescription(),
55  mgroup(-1),
56  mimplicit(false)
57  { /* Nothing to do here */ }
58 
63  WsvRecord(const char name[],
64  const char description[],
65  const String& group,
66  const bool implicit = false)
67  : mname(name),
68  mdescription(description),
69  mgroup(-1),
70  mimplicit(implicit)
71  {
72  // Map the group names to groups' indexes
73  mgroup = get_wsv_group_id(group);
74  if (mgroup == -1)
75  {
76  ostringstream os;
77 
78  os << "Unknown WSV Group " << group << " WSV " << mname;
79  throw runtime_error( os.str() );
80  }
81  }
82 
86  WsvRecord(const char name[],
87  const char description[],
88  const Index group,
89  const bool implicit = false)
90  : mname(name),
91  mdescription(description),
92  mgroup(group),
93  mimplicit(implicit)
94  {
95  // Nothing to do here
96  }
98  const String& Name() const { return mname; }
100  const String& Description() const { return mdescription; }
102  Index Group() const { return mgroup; }
104  bool Implicit() const { return mimplicit; }
105 private:
109  bool mimplicit;
110 };
111 
112 
115 ostream& operator<<(ostream& os, const WsvRecord& wr);
116 
117 #endif // wsv_aux_h
WsvRecord::mgroup
Index mgroup
Definition: wsv_aux.h:108
WsvRecord::WsvRecord
WsvRecord(const char name[], const char description[], const String &group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:63
WsvRecord::WsvRecord
WsvRecord()
Default constructor.
Definition: wsv_aux.h:53
exceptions.h
The declarations of all the exception classes.
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:102
WsvRecord::mdescription
String mdescription
Definition: wsv_aux.h:107
WsvRecord::WsvRecord
WsvRecord(const char name[], const char description[], const Index group, const bool implicit=false)
Initializing constructor.
Definition: wsv_aux.h:86
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
WsvRecord::Name
const String & Name() const
Name of this workspace variable.
Definition: wsv_aux.h:98
operator<<
ostream & operator<<(ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.
Definition: agenda_record.cc:236
WsvRecord::mimplicit
bool mimplicit
Definition: wsv_aux.h:109
WsvRecord
This class contains all static information for one workspace variable.
Definition: wsv_aux.h:49
get_array_groups_as_string
String get_array_groups_as_string()
Definition: groups.cc:201
WsvRecord::Description
const String & Description() const
A text describing this workspace variable.
Definition: wsv_aux.h:100
get_wsv_group_id
Index get_wsv_group_id(const String &name)
Definition: groups.cc:192
WsvRecord::Implicit
bool Implicit() const
Returns true if the variable was automatically created.
Definition: wsv_aux.h:104
WsvRecord::mname
String mname
Definition: wsv_aux.h:106
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)
Definition: groups.cc:155
arts.h
The global header file for ARTS.