ARTS 2.5.11 (git: 725533f0)
wsv_aux_operator.cc
Go to the documentation of this file.
1
10#include "wsv_aux_operator.h"
11
12#include "tokval_io.h"
13
14#include <iostream>
15#include <map>
16
17#include "global_data.h"
18#include "workspace_ng.h"
19
21
30std::ostream& operator<<(std::ostream& os, const WsvRecord& wr) {
32
33 // We need a special treatment for the case that the WSV is an agenda.
34
35 if (get_wsv_group_id("Agenda") != wr.Group() &&
36 get_wsv_group_id("ArrayOfAgenda") != wr.Group()) {
37 // No agenda.
38
39 os << "\n*-------------------------------------------------------------------*\n"
40 << "Workspace variable = " << wr.Name()
41 << "\n---------------------------------------------------------------------\n"
42 << "\n"
43 << wr.Description() << "\n";
44 if (wr.has_defaults()) {
45 os << "Default: ";
46 std::ostringstream ostr;
47 ostr << TokValPrinter{wr.default_value()};
48 if (ostr.str().empty()) ostr << "[]";
49 if (ostr.str().find('\n') != std::string::npos) os << "\n";
50 os << ostr.str() << "\n";
51 }
52 os << "\n---------------------------------------------------------------------\n"
53 << "Group = " << wsv_groups[wr.Group()]
54 << "\n*-------------------------------------------------------------------*\n";
55 } else {
56 // Agenda.
57
59
60 // AgendaMap is constant here and should never be changed
62
63 auto j = AgendaMap.find(wr.Name());
64
65 // Just for added safety, check that we really found something:
66 ARTS_ASSERT(j != AgendaMap.end());
67
68 cout << agenda_data[j->second] << "\n";
69 }
70
71 return os;
72}
This class contains all static information for one workspace variable.
Definition wsv_aux.h:41
bool has_defaults() const
Definition wsv_aux.cc:69
const String & Name() const
Name of this workspace variable.
Definition wsv_aux.h:75
const TokVal & default_value() const
Definition wsv_aux.h:87
const String & Description() const
A text describing this workspace variable.
Definition wsv_aux.h:78
Index Group() const
The wsv group to which this variable belongs.
Definition wsv_aux.h:81
#define ARTS_ASSERT(condition,...)
Definition debug.h:86
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition groups.cc:350
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
Definition global_data.h:74
const Array< AgRecord > agenda_data
The lookup information for the agendas.
Definition agendas.cc:24
map< String, Index > AgendaMap
The map associated with agenda_data.
This file contains the Workspace class.
std::ostream & operator<<(std::ostream &os, const WsvRecord &wr)
Output operator for WsvRecord.