-
Notifications
You must be signed in to change notification settings - Fork 2
/
NCGrid.cc
130 lines (96 loc) · 2.7 KB
/
NCGrid.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// -*- mode: c++; c-basic-offset:4 -*-
// This file is part of nc_handler, a data handler for the OPeNDAP data
// server.
// Copyright (c) 2002,2003 OPeNDAP, Inc.
// Author: James Gallagher <[email protected]>
//
// This 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 software 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-1996
// Please read the full copyright statement in the file COPYRIGHT.
//
// Authors:
// reza Reza Nekovei ([email protected])
// netCDF sub-class implementation for NCByte,...NCGrid.
// The files are patterned after the subcalssing examples
// Test<type>.c,h files.
//
// ReZa 1/12/95
#include "config_nc.h"
static char rcsid[] not_used ={"$Id$"};
#include <sstream>
#include <netcdf.h>
#include <Error.h>
#include <InternalErr.h>
#include <util.h>
#include "NCGrid.h"
#include <debug.h>
// protected
BaseType *
NCGrid::ptr_duplicate()
{
return new NCGrid(*this);
}
// public
NCGrid::NCGrid(const string &n, const string &d) : Grid(n, d)
{
}
NCGrid::NCGrid(const NCGrid &rhs) : Grid(rhs)
{
}
NCGrid::~NCGrid()
{
}
NCGrid &
NCGrid::operator=(const NCGrid &rhs)
{
if (this == &rhs)
return *this;
dynamic_cast<NCGrid&>(*this) = rhs;
return *this;
}
bool
NCGrid::read()
{
DBG(cerr << "In NCGrid::read" << endl);
if (read_p()) // nothing to do
return true;
DBG(cerr << "In NCGrid, reading components for " << name() << endl);
// read array elements
if (array_var()->send_p() || array_var()->is_in_selection())
array_var()->read();
// read maps elements
for (Map_iter p = map_begin(); p != map_end(); ++p)
if ((*p)->send_p() || (*p)->is_in_selection())
(*p)->read();
set_read_p(true);
return true;
}
/**
* @see NCStructure
* @param at
*/
void NCGrid::transfer_attributes(AttrTable *at)
{
if (at) {
array_var()->transfer_attributes(at);
Map_iter map = map_begin();
while (map != map_end()) {
(*map)->transfer_attributes(at);
map++;
}
}
}