Grid.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 1994-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 // Interface to the Grid ctor class. Grids contain a single array (the `main'
00033 // array) of dimension N and N single dimension arrays (map arrays). For any
00034 // dimension n of the main array, the size of the nth map array must match
00035 // the size of the main array's nth dimension. Grids are used to map
00036 // non-integer scales to multidimensional point data.
00037 //
00038 // jhrg 9/15/94
00039 
00040 #ifndef _grid_h
00041 #define _grid_h 1
00042 
00043 #include <vector>
00044 
00045 //#include "Pix.h"
00046 
00047 #ifndef _basetype_h
00048 #include "BaseType.h"
00049 #endif
00050 
00051 #ifndef _array_h
00052 #include "Array.h"
00053 #endif
00054 
00055 #ifndef _constructor_h
00056 #include "Constructor.h"
00057 #endif
00058 
00059 #ifndef constraint_evaluator_h
00060 #include "ConstraintEvaluator.h"
00061 #endif
00062 
00063 namespace libdap
00064 {
00065 
00121 class Grid: public Constructor
00122 {
00123 private:
00124     BaseType *_array_var;
00125     std::vector<BaseType *> _map_vars;
00126 
00127     void _duplicate(const Grid &s);
00128 
00129 public:
00130 
00131     Grid(const string &n = "");
00132     Grid(const Grid &rhs);
00133     virtual ~Grid();
00134 
00135     typedef std::vector<BaseType *>::const_iterator Map_citer ;
00136     typedef std::vector<BaseType *>::iterator Map_iter ;
00137     typedef std::vector<BaseType *>::reverse_iterator Map_riter ;
00138 
00139 
00140     Grid &operator=(const Grid &rhs);
00141     virtual BaseType *ptr_duplicate();
00142 
00143     virtual int element_count(bool leaves = false);
00144 
00145     virtual void set_send_p(bool state);
00146     virtual void set_read_p(bool state);
00147     virtual void set_in_selection(bool state);
00148 
00149     virtual BaseType *var(const string &n, bool exact = true,
00150                           btp_stack *s = 0);
00151 
00152     virtual BaseType *var(const string &n, btp_stack &s);
00153 
00154     virtual void add_var(BaseType *bt, Part part);
00155 
00156     BaseType *array_var();
00157     Array *get_array();
00158 
00159     virtual unsigned int width();
00160 
00161     virtual int components(bool constrained = false);
00162 
00163     virtual bool projection_yields_grid();
00164 
00165     virtual void clear_constraint();
00166 
00167     virtual void intern_data(const string &dataset, ConstraintEvaluator &eval,
00168                              DDS &dds);
00169     virtual bool serialize(const string &dataset, ConstraintEvaluator &eval,
00170                            DDS &dds, Marshaller &m, bool ce_eval = true);
00171     virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse = false);
00172 
00173     virtual unsigned int val2buf(void *buf, bool reuse = false);
00174 
00175     virtual unsigned int buf2val(void **val);
00176 
00177     virtual void print_decl(FILE *out, string space = "    ",
00178                             bool print_semi = true,
00179                             bool constraint_info = false,
00180                             bool constrained = false);
00181     virtual void print_decl(ostream &out, string space = "    ",
00182                             bool print_semi = true,
00183                             bool constraint_info = false,
00184                             bool constrained = false);
00185 
00186     virtual void print_xml(FILE *out, string space = "    ",
00187                            bool constrained = false);
00188     virtual void print_xml(ostream &out, string space = "    ",
00189                            bool constrained = false);
00190 
00191     virtual void print_val(FILE *out, string space = "",
00192                            bool print_decl_p = true);
00193     virtual void print_val(ostream &out, string space = "",
00194                            bool print_decl_p = true);
00195 
00196     virtual bool check_semantics(string &msg, bool all = false);
00197 
00198     Map_iter map_begin() ;
00199     Map_iter map_end() ;
00200     Map_riter map_rbegin() ;
00201     Map_riter map_rend() ;
00202     Map_iter get_map_iter(int i);
00203 
00204     virtual void dump(ostream &strm) const ;
00205 };
00206 
00207 } // namespace libdap
00208 
00209 #endif // _grid_h
00210 

Generated on Tue Mar 4 18:01:54 2008 for libdap++ by  doxygen 1.5.1