bes  Updated for version 3.20.6
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 <ServerFunction.h>
14 #include <dods-limits.h>
15 
16 namespace libdap {
17 class BaseType;
18 class DDS;
19 }
20 
21 namespace functions {
22 
23 struct 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
40 min_max_t find_min_max(double* data, int length, bool use_missing, double missing);
41 libdap::BaseType *range_worker(libdap::BaseType *bt, double missing, bool use_missing);
42 
53 void function_dap2_range(int argc, libdap::BaseType *argv[], libdap::DDS &dds, libdap::BaseType **btpp) ;
54 
65 libdap::BaseType *function_dap4_range(libdap::D4RValueList *args, libdap::DMR &dmr);
66 
71 class RangeFunction: public libdap::ServerFunction {
72 public:
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("http://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_ */
libdap
Definition: BESDapFunctionResponseCache.h:35
functions::RangeFunction
Definition: RangeFunction.h:71
functions::min_max_t
Definition: RangeFunction.h:23