GSEClause.h

Go to the documentation of this file.
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 enum relop {
00054     dods_nop_op,
00055     dods_greater_op,
00056     dods_greater_equal_op,
00057     dods_less_op,
00058     dods_less_equal_op,
00059     dods_equal_op,
00060     dods_not_equal_op
00061 };
00062 
00071 class GSEClause
00072 {
00073 private:
00074     Array *d_map;
00075     // _value1, 2 and _op1, 2 hold the first and second operators and
00076     // operands. For a clause like `var op value' only _op1 and _value1 have
00077     // valid information. For a clause like `value op var op value' the
00078     // second operator and operand are on _op2 and _value2. 1/19/99 jhrg
00079     double d_value1, d_value2;
00080     relop d_op1, d_op2;
00081     int d_start;
00082     int d_stop;
00083 
00084     string d_map_min_value, d_map_max_value;
00085 
00086     GSEClause();  // Hidden default constructor.
00087 
00088     GSEClause(const GSEClause &param); // Hide
00089     GSEClause &operator=(GSEClause &rhs); // Hide
00090 
00091     template<class T> void set_start_stop();
00092     template<class T> void set_map_min_max_value(T min, T max);
00093 
00094     void compute_indices();
00095 
00096 public:
00099     GSEClause(Grid *grid, const string &map, const double value,
00100               const relop op);
00101 
00102     GSEClause(Grid *grid, const string &map, const double value1,
00103               const relop op1, const double value2, const relop op2);
00105 
00106     bool OK() const;
00107 
00110     Array *get_map() const;
00111 
00112     string get_map_name() const;
00113 
00114     int get_start() const;
00115 
00116     int get_stop() const;
00117 
00118     string get_map_min_value() const;
00119 
00120     string get_map_max_value() const;
00122 
00125     void set_map(Array *map);
00126 
00127     void set_start(int start);
00128 
00129     void set_stop(int stop);
00131 };
00132 
00133 #endif // _gseclause_h
00134 

Generated on Wed Jun 27 12:56:39 2007 for libdap++ by  doxygen 1.4.7