libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
GSEClause.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: 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 // (c) COPYRIGHT URI/MIT 1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 
32 // The Grid Selection Expression Clause class.
33 
34 #ifndef _gseclause_h
35 #define _gseclause_h 1
36 
37 #include <string>
38 #include <sstream>
39 
40 #if 0
41 #include <BaseType.h>
42 #include <Array.h>
43 #include <Grid.h>
44 #endif
45 
46 namespace libdap {
47 class BaseType;
48 class Array;
49 class Grid;
50 }
51 
52 namespace functions
53 {
54 
55 enum relop {
56  dods_nop_op,
57  dods_greater_op,
58  dods_greater_equal_op,
59  dods_less_op,
60  dods_less_equal_op,
61  dods_equal_op,
62  dods_not_equal_op
63 };
64 
73 class GSEClause
74 {
75 private:
76  libdap::Array *d_map;
77  // _value1, 2 and _op1, 2 hold the first and second operators and
78  // operands. For a clause like `var op value' only _op1 and _value1 have
79  // valid information. For a clause like `value op var op value' the
80  // second operator and operand are on _op2 and _value2. 1/19/99 jhrg
81  double d_value1, d_value2;
82  relop d_op1, d_op2;
83  int d_start;
84  int d_stop;
85 
86  string d_map_min_value, d_map_max_value;
87 
88  GSEClause(); // Hidden default constructor.
89 
90  GSEClause(const GSEClause &param); // Hide
91  GSEClause &operator=(GSEClause &rhs); // Hide
92 
93  template<class T> void set_start_stop();
94  template<class T> void set_map_min_max_value(T min, T max);
95 
96  void compute_indices();
97 
98 public:
101  GSEClause(libdap::Grid *grid, const string &map, const double value,
102  const relop op);
103 
104  GSEClause(libdap::Grid *grid, const string &map, const double value1,
105  const relop op1, const double value2, const relop op2);
107 
108  virtual ~GSEClause();
109 
110  bool OK() const;
111 
114  libdap::Array *get_map() const;
115 
116  string get_map_name() const;
117 
118  int get_start() const;
119 
120  int get_stop() const;
121 
122  string get_map_min_value() const;
123 
124  string get_map_max_value() const;
126 
129  void set_map(libdap::Array *map);
130 
131  void set_start(int start);
132 
133  void set_stop(int stop);
135 };
136 
137 } // namespace functions
138 
139 #endif // _gseclause_h
140 
top level DAP object to house generic methods
Definition: AISConnect.cc:30
Holds the Grid data type.
Definition: Grid.h:122
A multidimensional array of identical data types.
Definition: Array.h:112