ARTS 2.5.11 (git: 725533f0)
wsv_aux.cc
Go to the documentation of this file.
1
9#include "wsv_aux.h"
10
12WsvRecord::WsvRecord() : mname(), mdescription(), defval() { /* Nothing to do here */
13}
14
19WsvRecord::WsvRecord(const char* name,
20 const char* description,
21 const String& group,
22 const TokVal& val)
23 : mname(name), mdescription(description), defval(val) {
24 // Map the group names to groups' indexes
25 mgroup = get_wsv_group_id(group);
26 if (mgroup == -1) {
27 ostringstream os;
28
29 os << "Unknown WSV Group " << group << " WSV " << mname;
30 throw runtime_error(os.str());
31 }
32}
33
37WsvRecord::WsvRecord(const char* name,
38 const char* description,
39 const Index group,
40 const TokVal& val)
41 : mname(name), mdescription(description), mgroup(group), defval(val) {
42 // Nothing to do here
43}
44
49WsvRecord::WsvRecord(const char* name, const char* description, const String& group)
50 : mname(name), mdescription(description), defval() {
51 // Map the group names to groups' indexes
52 mgroup = get_wsv_group_id(group);
53 if (mgroup == -1) {
54 ostringstream os;
55
56 os << "Unknown WSV Group " << group << " WSV " << mname;
57 throw runtime_error(os.str());
58 }
59}
60
64WsvRecord::WsvRecord(const char* name, const char* description, const Index group)
65 : mname(name), mdescription(description), mgroup(group), defval() {
66 // Nothing to do here
67}
68
70 return not defval.holdsAny();
71}
72
73std::shared_ptr<void> WsvRecord::get_copy() const {
74 if (has_defaults())
75 return defval.copy_value();
76 return nullptr;
77}
bool holdsAny() const
Definition tokval.cc:205
std::shared_ptr< void > copy_value() const
Definition tokval.cc:804
String mname
Definition wsv_aux.h:91
bool has_defaults() const
Definition wsv_aux.cc:69
WsvRecord()
Default constructor.
Definition wsv_aux.cc:12
Index mgroup
Definition wsv_aux.h:95
TokVal defval
Definition wsv_aux.h:97
std::shared_ptr< void > get_copy() const
Definition wsv_aux.cc:73
Auxiliary header stuff related to workspace variable groups.
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition groups.cc:350