libdap Updated for version 3.20.11
libdap4 is an implementation of OPeNDAP's DAP protocol.
ServerFunction.h
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of libdap, A C++ implementation of the OPeNDAP Data
4// Access Protocol.
5
6// Copyright (c) 2013 OPeNDAP, Inc.
7// Author: Nathan Potter <npotter@opendap.org>
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 OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25/*
26 * ServerFunction.h
27 *
28 * Created on: Feb 2, 2013
29 * Author: ndp
30 */
31
32#ifndef SERVER_FUNCTION_H_
33#define SERVER_FUNCTION_H_
34
35#include <iostream>
36
37#include <expr.h>
38#include <D4Function.h>
39
40namespace libdap {
41
43
44private:
45 std::string name;
46 std::string description;
47 std::string usage;
48 std::string doc_url;
49 std::string role;
50 std::string version;
51
52 // These are typedefs from DAP2 that are used with its CE parser
53 // and are found in expr.h. jhrg 3/10/14
54 bool_func d_bool_func;
55 btp_func d_btp_func;
56 proj_func d_proj_func;
57
58 D4Function d_d4_function;
59
60public:
62 ServerFunction(std::string name, std::string version, std::string description, std::string usage,
63 std::string doc_url, std::string role, bool_func f);
64 ServerFunction(std::string name, std::string version, std::string description, std::string usage,
65 std::string doc_url, std::string role, btp_func f);
66 ServerFunction(std::string name, std::string version, std::string description, std::string usage,
67 std::string doc_url, std::string role, proj_func f);
68 ServerFunction(std::string name, std::string version, std::string description, std::string usage,
69 std::string doc_url, std::string role, D4Function f);
70
71 virtual ~ServerFunction() { }
72
73 std::string getName() { return name; }
74 void setName(const std::string &n){ name = n; }
75
76 std::string getUsageString() { return usage; }
77 void setUsageString(const std::string &u){ usage = u; }
78
79 std::string getDocUrl() { return doc_url; }
80 void setDocUrl(const std::string &url){ doc_url = url; }
81
82 std::string getRole() { return role; }
83 void setRole(const std::string &r){ role = r; }
84
85 std::string getDescriptionString(){ return description; }
86 void setDescriptionString(const std::string &desc){ description = desc; }
87
88 std::string getVersion(){ return version; }
89 void setVersion(const std::string &ver){ version = ver; }
90
103 virtual bool canOperateOn(DDS &) { return true; }
104
110 virtual bool canOperateOn(DMR &) { return true; }
111
120 void setFunction(bool_func bf) {
121 d_bool_func = bf;
122 }
123
124 void setFunction(btp_func btp) {
125 d_btp_func = btp;
126 }
127
128 void setFunction(proj_func pf) {
129 d_proj_func = pf;
130 }
131
132 void setFunction(D4Function pf) {
133 d_d4_function = pf;
134 }
135
136 std::string getTypeString() {
137 if (d_bool_func) return "boolean";
138 if (d_btp_func) return "basetype";
139 if (d_proj_func) return "projection";
140 if (d_d4_function) return "D4Function";
141 return "null";
142 }
143
144 bool_func get_bool_func(){ return d_bool_func; }
145 btp_func get_btp_func() { return d_btp_func; }
146 proj_func get_proj_func(){ return d_proj_func; }
147 D4Function get_d4_function() { return d_d4_function; }
148};
149
150} /* namespace libdap */
151#endif /* SERVER_FUNCTION_H_ */
void setFunction(bool_func bf)
virtual bool canOperateOn(DDS &)
virtual bool canOperateOn(DMR &)
top level DAP object to house generic methods
Definition: AlarmHandler.h:36