libdap++ Updated for version 3.8.2
|
00001 00002 // -*- mode: c++; c-basic-offset:4 -*- 00003 00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data 00005 // Access Protocol. 00006 00007 // Copyright (c) 2002,2003 OPeNDAP, Inc. 00008 // Author: James Gallagher <jgallagher@opendap.org> 00009 // 00010 // This library is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU Lesser General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 2.1 of the License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 // 00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112. 00025 00026 // (c) COPYRIGHT URI/MIT 1999 00027 // Please read the full copyright statement in the file COPYRIGHT_URI. 00028 // 00029 // Authors: 00030 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu> 00031 00032 // The Grid Selection Expression Clause class. 00033 00034 #ifndef _gseclause_h 00035 #define _gseclause_h 1 00036 00037 00038 #include <string> 00039 #include <sstream> 00040 00041 #ifndef _basetype_h 00042 #include "BaseType.h" 00043 #endif 00044 00045 #ifndef _array_h 00046 #include "Array.h" 00047 #endif 00048 00049 #ifndef _grid_h 00050 #include "Grid.h" 00051 #endif 00052 00053 namespace libdap 00054 { 00055 00056 enum relop { 00057 dods_nop_op, 00058 dods_greater_op, 00059 dods_greater_equal_op, 00060 dods_less_op, 00061 dods_less_equal_op, 00062 dods_equal_op, 00063 dods_not_equal_op 00064 }; 00065 00074 class GSEClause 00075 { 00076 private: 00077 Array *d_map; 00078 // _value1, 2 and _op1, 2 hold the first and second operators and 00079 // operands. For a clause like `var op value' only _op1 and _value1 have 00080 // valid information. For a clause like `value op var op value' the 00081 // second operator and operand are on _op2 and _value2. 1/19/99 jhrg 00082 double d_value1, d_value2; 00083 relop d_op1, d_op2; 00084 int d_start; 00085 int d_stop; 00086 00087 string d_map_min_value, d_map_max_value; 00088 00089 GSEClause(); // Hidden default constructor. 00090 00091 GSEClause(const GSEClause ¶m); // Hide 00092 GSEClause &operator=(GSEClause &rhs); // Hide 00093 00094 template<class T> void set_start_stop(); 00095 template<class T> void set_map_min_max_value(T min, T max); 00096 00097 void compute_indices(); 00098 00099 public: 00102 GSEClause(Grid *grid, const string &map, const double value, 00103 const relop op); 00104 00105 GSEClause(Grid *grid, const string &map, const double value1, 00106 const relop op1, const double value2, const relop op2); 00108 00109 virtual ~GSEClause() { 00110 delete d_map; d_map = 0; 00111 } 00112 00113 bool OK() const; 00114 00117 Array *get_map() const; 00118 00119 string get_map_name() const; 00120 00121 int get_start() const; 00122 00123 int get_stop() const; 00124 00125 string get_map_min_value() const; 00126 00127 string get_map_max_value() const; 00129 00132 void set_map(Array *map); 00133 00134 void set_start(int start); 00135 00136 void set_stop(int stop); 00138 }; 00139 00140 } // namespace libdap 00141 00142 #endif // _gseclause_h 00143