Grid.h
// -*- mode: c++; c-basic-offset:4 -*-
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.
// Copyright (c) 2002,2003 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
// (c) COPYRIGHT URI/MIT 1994-1999
// Please read the full copyright statement in the file COPYRIGHT_URI.
//
// Authors:
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
// Interface to the Grid ctor class. Grids contain a single array (the `main'
// array) of dimension N and N single dimension arrays (map arrays). For any
// dimension n of the main array, the size of the nth map array must match
// the size of the main array's nth dimension. Grids are used to map
// non-integer scales to multidimensional point data.
//
// jhrg 9/15/94
#ifndef _grid_h
#define _grid_h 1
#include <vector>
#ifndef _basetype_h
#include "BaseType.h"
#endif
#ifndef _array_h
#include "Array.h"
#endif
#ifndef _constructor_h
#include "Constructor.h"
#endif
#ifndef constraint_evaluator_h
#include "ConstraintEvaluator.h"
#endif
namespace libdap
{
class D4Grup;
class XMLWriter;
class Grid: public Constructor
{
private:
//BaseType *d_array_var; // weak pointer to the
bool d_is_array_set;
protected: // subclasses need access [mjohnson 11 nov 2009]
void m_duplicate(const Grid &s);
public:
Grid(const string &n);
Grid(const string &n, const string &d);
Grid(const Grid &rhs);
virtual ~Grid();
typedef std::vector<BaseType *>::const_iterator Map_citer ;
typedef std::vector<BaseType *>::iterator Map_iter ;
typedef std::vector<BaseType *>::reverse_iterator Map_riter ;
Grid &operator=(const Grid &rhs);
virtual BaseType *ptr_duplicate();
virtual void transform_to_dap4(D4Group *root, Constructor *container);
virtual bool is_dap2_only_type();
virtual void add_var(BaseType *bt, Part part);
virtual void add_var_nocopy(BaseType *bt, Part part);
virtual void set_array(Array* p_new_arr);
virtual Array* add_map(Array* p_new_map, bool add_copy);
virtual Array* prepend_map(Array* p_new_map, bool add_copy);
BaseType *array_var();
Array *get_array();
// virtual unsigned int width(bool constrained = false);
virtual int components(bool constrained = false);
virtual bool projection_yields_grid();
virtual void clear_constraint();
virtual void print_decl(ostream &out, string space = " ",
bool print_semi = true,
bool constraint_info = false,
bool constrained = false);
virtual void print_xml(ostream &out, string space = " ",
bool constrained = false);
virtual void print_xml_writer(XMLWriter &xml, bool constrained = false);
virtual void print_val(ostream &out, string space = "",
bool print_decl_p = true);
virtual void print_decl(FILE *out, string space = " ",
bool print_semi = true,
bool constraint_info = false,
bool constrained = false);
virtual void print_xml(FILE *out, string space = " ",
bool constrained = false);
virtual void print_val(FILE *out, string space = "",
bool print_decl_p = true);
virtual void transfer_attributes(AttrTable *at_container);
virtual bool check_semantics(string &msg, bool all = false);
Map_iter map_begin() ;
Map_iter map_end() ;
Map_riter map_rbegin() ;
Map_riter map_rend() ;
Map_iter get_map_iter(int i);
virtual void dump(ostream &strm) const ;
};
} // namespace libdap
#endif // _grid_h
libdap::Array
A multidimensional array of identical data types.
Definition: Array.h:113
libdap::AttrTable
Contains the attributes for a dataset.
Definition: AttrTable.h:143
libdap::BaseType
The basic data type for the DODS DAP types.
Definition: BaseType.h:118
libdap::Constructor
Definition: Constructor.h:44
libdap::D4Group
Definition: D4Group.h:44
libdap::Grid
Holds the Grid data type.
Definition: Grid.h:123
libdap::Grid::ptr_duplicate
virtual BaseType * ptr_duplicate()
Definition: Grid.cc:116
libdap::Grid::array_var
BaseType * array_var()
Returns the Grid Array.
Definition: Grid.cc:501
libdap::Grid::transform_to_dap4
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: Grid.cc:148
libdap::Grid::print_xml
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
Definition: Grid.cc:819
libdap::Grid::map_begin
Map_iter map_begin()
Returns an iterator referencing the first Map vector.
Definition: Grid.cc:525
libdap::Grid::get_map_iter
Map_iter get_map_iter(int i)
Definition: Grid.cc:563
libdap::Grid::set_array
virtual void set_array(Array *p_new_arr)
Definition: Grid.cc:389
libdap::Grid::clear_constraint
virtual void clear_constraint()
Definition: Grid.cc:736
libdap::Grid::print_val
virtual void print_val(ostream &out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: Grid.cc:900
libdap::Grid::print_decl
virtual void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
Definition: Grid.cc:753
libdap::Grid::prepend_map
virtual Array * prepend_map(Array *p_new_map, bool add_copy)
Definition: Grid.cc:484
libdap::Grid::Grid
Grid(const string &n)
The Grid constructor.
Definition: Grid.cc:86
libdap::Grid::get_array
Array * get_array()
Returns the Grid Array. This method returns the array using an Array*, so no cast is required.
Definition: Grid.cc:518
libdap::Grid::transfer_attributes
virtual void transfer_attributes(AttrTable *at_container)
Definition: Grid.cc:610
libdap::Grid::projection_yields_grid
virtual bool projection_yields_grid()
Definition: Grid.cc:692
libdap::Grid::map_end
Map_iter map_end()
Definition: Grid.cc:537
libdap::Grid::map_rend
Map_riter map_rend()
Definition: Grid.cc:554
libdap::Grid::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: Grid.cc:1033
libdap::Grid::add_map
virtual Array * add_map(Array *p_new_map, bool add_copy)
Definition: Grid.cc:455
libdap::Grid::components
virtual int components(bool constrained=false)
Returns the number of components in the Grid object.
Definition: Grid.cc:585
libdap::Grid::print_xml_writer
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: Grid.cc:847
libdap::Grid::check_semantics
virtual bool check_semantics(string &msg, bool all=false)
Return true if this Grid is well formed.
Definition: Grid.cc:937
libdap::Grid::add_var
virtual void add_var(BaseType *bt, Part part)
Definition: Grid.cc:264
libdap::Grid::add_var_nocopy
virtual void add_var_nocopy(BaseType *bt, Part part)
Definition: Grid.cc:330
libdap::Grid::map_rbegin
Map_riter map_rbegin()
Returns an iterator referencing the first Map vector.
Definition: Grid.cc:544
libdap::Grid::is_dap2_only_type
virtual bool is_dap2_only_type()
Definition: Grid.cc:246
libdap::XMLWriter
Definition: XMLWriter.h:39
libdap
top level DAP object to house generic methods
Definition: AlarmHandler.h:36
libdap::Part
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48