bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
VersionFunction.cc
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2013 OPeNDAP, Inc.
8// Authors: Nathan Potter <npotter@opendap.org>
9// James Gallagher <jgallagher@opendap.org>
10//
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15//
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24//
25// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
26
27#include "config.h"
28
29#include <sstream>
30
31#include <libdap/BaseType.h>
32#include <libdap/Str.h>
33#include <libdap/Error.h>
34#include <libdap/debug.h>
35#include <libdap/ServerFunctionsList.h>
36
37#include "LinearScaleFunction.h"
38
39using namespace libdap;
40
41namespace functions {
42
50void
51function_dap2_version(int, BaseType *[], DDS &dds, BaseType **btpp)
52{
53 string xml_value = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
54
55 ServerFunction *sf;
56 string functionType;
57
58 ServerFunctionsList *sfList = libdap::ServerFunctionsList::TheList();
59 std::multimap<string,libdap::ServerFunction *>::iterator begin = sfList->begin();
60 std::multimap<string,libdap::ServerFunction *>::iterator end = sfList->end();
61 std::multimap<string,libdap::ServerFunction *>::iterator sfit;
62
63 xml_value += "<ds:functions xmlns:ds=\"http://xml.opendap.org/ns/DAP/4.0/dataset-services#\">\n";
64 for(sfit=begin; sfit!=end; sfit++){
65 sf = sfList->getFunction(sfit);
66 if(sf->canOperateOn(dds)){
67 xml_value += " <ds:function name=\"" + sf->getName() +"\""+
68 " version=\"" + sf->getVersion() + "\""+
69 " type=\"" + sf->getTypeString() + "\""+
70 " role=\"" + sf->getRole() + "\""+
71 " >\n" ;
72 xml_value += " <ds:Description href=\"" + sf->getDocUrl() + "\">" + sf->getDescriptionString() + "</ds:Description>\n";
73 xml_value += " </ds:function>\n";
74 }
75 }
76 xml_value += "</functions>\n";
77
78 Str *response = new Str("version");
79
80 response->set_value(xml_value);
81 *btpp = response;
82 return;
83}
84
92
93BaseType *function_dap4_version(D4RValueList *, DMR &dmr)
94{
95 string xml_value = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
96
97 ServerFunction *sf;
98 string functionType;
99
100 ServerFunctionsList *sfList = libdap::ServerFunctionsList::TheList();
101 std::multimap<string,libdap::ServerFunction *>::iterator begin = sfList->begin();
102 std::multimap<string,libdap::ServerFunction *>::iterator end = sfList->end();
103 std::multimap<string,libdap::ServerFunction *>::iterator sfit;
104
105 xml_value += "<ds:functions xmlns:ds=\"http://xml.opendap.org/ns/DAP/4.0/dataset-services#\">\n";
106 for(sfit=begin; sfit!=end; sfit++){
107 sf = sfList->getFunction(sfit);
108 if(sf->canOperateOn(dmr)){
109 xml_value += " <ds:function name=\"" + sf->getName() +"\""+
110 " version=\"" + sf->getVersion() + "\""+
111 " type=\"" + sf->getTypeString() + "\""+
112 " role=\"" + sf->getRole() + "\""+
113 " >\n" ;
114 xml_value += " <ds:Description href=\"" + sf->getDocUrl() + "\">" + sf->getDescriptionString() + "</ds:Description>\n";
115 xml_value += " </ds:function>\n";
116 }
117 }
118 xml_value += "</functions>\n";
119
120 Str *response = new Str("version");
121
122 response->set_value(xml_value);
123 return response;
124}
125
126} // namespace functions