OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
GSEClause.h
Go to the documentation of this file.
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 #include <BaseType.h>
41 #include <Array.h>
42 #include <Grid.h>
43 
44 namespace libdap
45 {
46 
47 enum relop {
55 };
56 
65 class GSEClause
66 {
67 private:
68  Array *d_map;
69  // _value1, 2 and _op1, 2 hold the first and second operators and
70  // operands. For a clause like `var op value' only _op1 and _value1 have
71  // valid information. For a clause like `value op var op value' the
72  // second operator and operand are on _op2 and _value2. 1/19/99 jhrg
73  double d_value1, d_value2;
74  relop d_op1, d_op2;
75  int d_start;
76  int d_stop;
77 
78  string d_map_min_value, d_map_max_value;
79 
80  GSEClause(); // Hidden default constructor.
81 
82  GSEClause(const GSEClause &param); // Hide
83  GSEClause &operator=(GSEClause &rhs); // Hide
84 
85  template<class T> void set_start_stop();
86  template<class T> void set_map_min_max_value(T min, T max);
87 
88  void compute_indices();
89 
90 public:
93  GSEClause(Grid *grid, const string &map, const double value,
94  const relop op);
95 
96  GSEClause(Grid *grid, const string &map, const double value1,
97  const relop op1, const double value2, const relop op2);
99 
100  virtual ~GSEClause() {
101  delete d_map; d_map = 0;
102  }
103 
104  bool OK() const;
105 
108  Array *get_map() const;
109 
110  string get_map_name() const;
111 
112  int get_start() const;
113 
114  int get_stop() const;
115 
116  string get_map_min_value() const;
117 
118  string get_map_max_value() const;
120 
123  void set_map(Array *map);
124 
125  void set_start(int start);
126 
127  void set_stop(int stop);
129 };
130 
131 } // namespace libdap
132 
133 #endif // _gseclause_h
134 
Array * get_map() const
Get a pointer to the map variable constrained by this clause.
Definition: GSEClause.cc:263
bool OK() const
Class invariant.
Definition: GSEClause.cc:250
string get_map_max_value() const
Get the maximum map vector value.
Definition: GSEClause.cc:336
int get_start() const
Get the starting index of the clause's map variable as constrained by this clause.
Definition: GSEClause.cc:290
void set_start(int start)
Set the starting index.
Definition: GSEClause.cc:298
void set_stop(int stop)
Set the stopping index.
Definition: GSEClause.cc:316
Holds the results of parsing one of the Grid Selection Expression clauses.
Definition: GSEClause.h:65
virtual ~GSEClause()
Definition: GSEClause.h:100
int get_stop() const
Get the stopping index of the clause's map variable as constrained by this clause.
Definition: GSEClause.cc:307
string get_map_min_value() const
Get the minimum map vector value.
Definition: GSEClause.cc:326
void set_map(Array *map)
Set the pointer to the map vector contrained by this clause.
Definition: GSEClause.cc:273
string get_map_name() const
Get the name of the map variable constrained by this clause.
Definition: GSEClause.cc:281