bes  Updated for version 3.20.6
NCGrid.cc
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of nc_handler, a data handler for the OPeNDAP data
5 // server.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This is free software; you can redistribute it and/or modify it under the
11 // terms of the GNU Lesser General Public License as published by the Free
12 // Software Foundation; either version 2.1 of the License, or (at your
13 // option) any later version.
14 //
15 // This software is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 // 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 
27 // (c) COPYRIGHT URI/MIT 1994-1996
28 // Please read the full copyright statement in the file COPYRIGHT.
29 //
30 // Authors:
31 // reza Reza Nekovei (reza@intcomm.net)
32 
33 // netCDF sub-class implementation for NCByte,...NCGrid.
34 // The files are patterned after the subcalssing examples
35 // Test<type>.c,h files.
36 //
37 // ReZa 1/12/95
38 
39 #include "config_nc.h"
40 
41 static char rcsid[] not_used ={"$Id$"};
42 
43 #include <sstream>
44 
45 #include <netcdf.h>
46 
47 #include <Error.h>
48 #include <InternalErr.h>
49 #include <util.h>
50 
51 #include "NCGrid.h"
52 #include <debug.h>
53 
54 // protected
55 
56 
57 BaseType *
58 NCGrid::ptr_duplicate()
59 {
60  return new NCGrid(*this);
61 }
62 
63 // public
64 
65 NCGrid::NCGrid(const string &n, const string &d) : Grid(n, d)
66 {
67 }
68 
69 NCGrid::NCGrid(const NCGrid &rhs) : Grid(rhs)
70 {
71 }
72 
73 
74 NCGrid::~NCGrid()
75 {
76 }
77 
78 NCGrid &
79 NCGrid::operator=(const NCGrid &rhs)
80 {
81  if (this == &rhs)
82  return *this;
83 
84  dynamic_cast<NCGrid&>(*this) = rhs;
85 
86 
87  return *this;
88 }
89 
90 
91 bool
92 NCGrid::read()
93 {
94  DBG(cerr << "In NCGrid::read" << endl);
95 
96  if (read_p()) // nothing to do
97  return true;
98 
99  DBG(cerr << "In NCGrid, reading components for " << name() << endl);
100 
101  // read array elements
102  if (array_var()->send_p() || array_var()->is_in_selection())
103  array_var()->read();
104 
105  // read maps elements
106  for (Map_iter p = map_begin(); p != map_end(); ++p)
107  if ((*p)->send_p() || (*p)->is_in_selection())
108  (*p)->read();
109 
110  set_read_p(true);
111 
112  return true;
113 }
114 
119 void NCGrid::transfer_attributes(AttrTable *at)
120 {
121  if (at) {
122  array_var()->transfer_attributes(at);
123 
124  Map_iter map = map_begin();
125  while (map != map_end()) {
126  (*map)->transfer_attributes(at);
127  map++;
128  }
129  }
130 }
NCGrid
Definition: NCGrid.h:46
NCGrid::transfer_attributes
virtual void transfer_attributes(AttrTable *at)
Definition: NCGrid.cc:119