bes  Updated for version 3.20.6
functions_util.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of bes, A C++ implementation of the OPeNDAP
5 // Hyrax data server
6 
7 // Copyright (c) 2015 OPeNDAP, Inc.
8 // Authors: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 #ifndef FUNCTIONS_FUNCTIONS_UTIL_H_
27 #define FUNCTIONS_FUNCTIONS_UTIL_H_
28 
29 namespace libdap {
30 class BaseType;
31 class Array;
32 }
33 
34 // These functions are part of libdap. Use #include <util.h>. jhrg 4/28/15
35 //
36 //bool libdap::double_eq(double lhs, double rhs, double epsilon /* = 1.0e-5 */);
37 
38 //string libdap::extract_string_argument(BaseType *arg) ;
39 //double libdap::extract_double_value(BaseType *arg) ;
40 //double *libdap::extract_double_array(Array *a) ;
41 //void libdap::extract_double_array(Array *a, vector<double> &dest) ;
42 //void libdap::set_array_using_double(Array *dest, double *src, int src_len) ;
43 
44 namespace functions {
45 // These functions are defined here in the bes 'functions' module. jhrg 4/28/15
46 
47 std::vector<int> parse_dims(const std::string &shape);
48 
49 void check_number_type_array(libdap::BaseType *btp, unsigned int rank = 0);
50 
51 unsigned int extract_uint_value(libdap::BaseType *arg);
52 
53 #if 0
54 
57 // in LinearScaleFunction.cc
58 static double string_to_double(const char *val);
59 static double get_attribute_double_value(BaseType *var, const string &attribute);
60 static double get_attribute_double_value(BaseType *var, vector<string> &attributes);
61 static double get_missing_value(BaseType *var);
62 static double get_slope(BaseType *var);
63 static double get_y_intercept(BaseType *var);
64 
65 // in TabularFunction.cc (these are methods)
66 typedef std::vector<unsigned long> Shape;
67 static Shape array_shape(Array *a);
68 static bool shape_matches(Array *a, const Shape &shape);
69 static bool dep_indep_match(const Shape &dep_shape, const Shape &indep_shape);
70 
71 static unsigned long number_of_values(const Shape &shape);
72 
73 static void build_columns(unsigned long n, BaseType *btp, std::vector<Array*> &arrays, Shape &shape);
74 
75 static void read_values(const std::vector<Array*> &arrays);
76 
77 static void build_sequence_values(const std::vector<Array*> &arrays, SequenceValues &sv);
78 static void combine_sequence_values(SequenceValues &dep, const SequenceValues &indep);
79 static void add_index_column(const Shape &indep_shape, const Shape &dep_shape, std::vector<Array*> &dep_vars);
80 #endif
81 
82 } //namespace functions
83 
84 #endif /* FUNCTIONS_FUNCTIONS_UTIL_H_ */
libdap
Definition: BESDapFunctionResponseCache.h:35