libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
ServerFunction.h
Go to the documentation of this file.
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 <D4Function.h>
38#include <expr.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) { d_bool_func = bf; }
121
122 void setFunction(btp_func btp) { d_btp_func = btp; }
123
124 void setFunction(proj_func pf) { d_proj_func = pf; }
125
126 void setFunction(D4Function pf) { d_d4_function = pf; }
127
128 std::string getTypeString() {
129 if (d_bool_func)
130 return "boolean";
131 if (d_btp_func)
132 return "basetype";
133 if (d_proj_func)
134 return "projection";
135 if (d_d4_function)
136 return "D4Function";
137 return "null";
138 }
139
140 bool_func get_bool_func() { return d_bool_func; }
141 btp_func get_btp_func() { return d_btp_func; }
142 proj_func get_proj_func() { return d_proj_func; }
143 D4Function get_d4_function() { return d_d4_function; }
144};
145
146} /* namespace libdap */
147#endif /* SERVER_FUNCTION_H_ */
void setFunction(proj_func pf)
void setUsageString(const std::string &u)
void setRole(const std::string &r)
std::string getTypeString()
void setVersion(const std::string &ver)
void setFunction(bool_func bf)
virtual bool canOperateOn(DDS &)
void setFunction(D4Function pf)
void setName(const std::string &n)
void setDocUrl(const std::string &url)
void setFunction(btp_func btp)
virtual bool canOperateOn(DMR &)
void setDescriptionString(const std::string &desc)
std::string getDescriptionString()
std::string getUsageString()
top level DAP object to house generic methods
Definition AISConnect.cc:30
BaseType *(* D4Function)(D4RValueList *, DMR &)
Definition D4Function.h:41