bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
RangeFunction.h
1/*
2 * RangeFunction.h
3 *
4 * Created on: Jun 8, 2016
5 * Author: ndp
6 */
7
8#ifndef FUNCTIONS_RANGEFUNCTION_H_
9#define FUNCTIONS_RANGEFUNCTION_H_
10
11#include <iostream>
12
13#include <libdap/ServerFunction.h>
14#include <libdap/dods-limits.h>
15
16namespace libdap {
17class BaseType;
18class DDS;
19}
20
21namespace functions {
22
23struct min_max_t {
24 double max_val;
25 double min_val;
26 bool monotonic;
27
28 min_max_t() : max_val(-DODS_DBL_MAX), min_val(DODS_DBL_MAX), monotonic(true) { }
29
30 friend std::ostream& operator<< (std::ostream& stream, const min_max_t& v) {
31 stream << "min: " << v.min_val <<
32 ", max: " << v.max_val <<
33 ", monotonic: " << (v.monotonic?"true":"false") ;
34 return stream;
35 }
36};
37
38// These are declared here so they can be tested by RangeFunctionTest.cc in unit-tests.
39// jhrg 6/7/17
40min_max_t find_min_max(double* data, int length, bool use_missing, double missing);
41libdap::BaseType *range_worker(libdap::BaseType *bt, double missing, bool use_missing);
42
53void function_dap2_range(int argc, libdap::BaseType *argv[], libdap::DDS &dds, libdap::BaseType **btpp) ;
54
65libdap::BaseType *function_dap4_range(libdap::D4RValueList *args, libdap::DMR &dmr);
66
71class RangeFunction: public libdap::ServerFunction {
72public:
73 RangeFunction()
74 {
75 setName("range");
76 setDescriptionString("The range() function evaluates the passed variable and returns an array of size 2 containing the min and max values of the variable.");
77 setUsageString("range(var)");
78 setRole("http://services.opendap.org/dap4/server-side-function/range");
79 setDocUrl("https://docs.opendap.org/index.php/Server_Side_Processing_Functions#range");
80 setFunction(function_dap2_range);
81 setFunction(function_dap4_range);
82 setVersion("1.0b1");
83 }
84 virtual ~RangeFunction()
85 {
86 }
87};
88
89} // functions namespace
90
91#endif /* FUNCTIONS_RANGEFUNCTION_H_ */