bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESVersionInfo.cc
1// BESVersionInfo.cc
2
3// This file is part of bes, A C++ back-end server implementation framework
4// for the OPeNDAP Data Access Protocol.
5
6// Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7// Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Lesser General Public
11// License as published by the Free Software Foundation; either
12// version 2.1 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.
18//
19// You should have received a copy of the GNU Lesser General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22//
23// You can contact University Corporation for Atmospheric Research at
24// 3080 Center Green Drive, Boulder, CO 80301
25
26// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27// Please read the full copyright statement in the file COPYRIGHT_UCAR.
28//
29// Authors:
30// pwest Patrick West <pwest@ucar.edu>
31// jgarcia Jose Garcia <jgarcia@ucar.edu>
32
33#include "BESVersionInfo.h"
34#include "BESInfoList.h"
35#include "BESInternalError.h"
36
37using std::endl;
38using std::list;
39using std::string;
40using std::map;
41using std::ostream;
42
50 BESInfo(), _inbes(false), _inhandler(false), _info(0)
51{
52 _info = BESInfoList::TheList()->build_info();
53}
54
55BESVersionInfo::~BESVersionInfo()
56{
57 if (_info) delete _info;
58}
59
60void BESVersionInfo::add_library(const string &name, const string &vers)
61{
62 add_version("library", name, vers);
63}
64
65void BESVersionInfo::add_module(const string &name, const string &vers)
66{
67 add_version("module", name, vers);
68}
69
70void BESVersionInfo::add_service(const string &name, const list<string> &vers)
71{
72 map<string, string, std::less<>> props;
73 props["name"] = name;
74 begin_tag("serviceVersion", &props);
75 list<string>::const_iterator i = vers.begin();
76 list<string>::const_iterator e = vers.end();
77 for (; i != e; i++) {
78 add_tag("version", (*i));
79 }
80 end_tag("serviceVersion");
81}
82
83void BESVersionInfo::add_version(const string &type, const string &name, const string &vers)
84{
85 map<string, string, std::less<>> attrs;
86 attrs["name"] = name;
87 attrs["version"] = vers;
88 add_tag(type, "", &attrs);
89}
90
98void BESVersionInfo::dump(ostream &strm) const
99{
100 strm << BESIndent::LMarg << "BESVersionInfo::dump - (" << (void *) this << ")" << endl;
101 BESIndent::Indent();
102 strm << BESIndent::LMarg << "in BES version? " << _inbes << endl;
103 strm << BESIndent::LMarg << "in Handler version? " << _inhandler << endl;
104 if (_info) {
105 strm << BESIndent::LMarg << "redirection info object:" << endl;
106 BESIndent::Indent();
107 _info->dump(strm);
108 BESIndent::UnIndent();
109 }
110 else {
111 strm << BESIndent::LMarg << "redirection info object: null" << endl;
112 }
113 BESInfo::dump(strm);
114 BESIndent::UnIndent();
115}
116
BESInfo()
constructs a BESInfo object
Definition BESInfo.cc:52
virtual void dump(std::ostream &strm) const
Displays debug information about this object.
Definition BESInfo.cc:262
BESVersionInfo()
constructs a basic text information response object to write version information
void dump(std::ostream &strm) const override
dumps information about this object