libdap++
Updated for version 3.8.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Array.h
Go to the documentation of this file.
1
2
// -*- mode: c++; c-basic-offset:4 -*-
3
4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5
// Access Protocol.
6
7
// Copyright (c) 2002,2003 OPeNDAP, Inc.
8
// Author: James Gallagher <jgallagher@opendap.org>
9
//
10
// This library is free software; you can redistribute it and/or
11
// modify it under the terms of the GNU Lesser General Public
12
// License as published by the Free Software Foundation; either
13
// version 2.1 of the License, or (at your option) any later version.
14
//
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
// Lesser General Public 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
//
24
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26
// (c) COPYRIGHT URI/MIT 1994-1999
27
// Please read the full copyright statement in the file COPYRIGHT_URI.
28
//
29
// Authors:
30
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31
32
// Class for array variables. The dimensions of the array are stored in the
33
// list SHAPE.
34
//
35
// jhrg 9/6/94
36
37
#ifndef _array_h
38
#define _array_h 1
39
40
#include <string>
41
#include <vector>
42
43
#ifndef _dods_limits_h
44
#include "
dods-limits.h
"
45
#endif
46
47
#ifndef _vector_h
48
#include "
Vector.h
"
49
#endif
50
51
#ifndef XMLWRITER_H_
52
#include "
XMLWriter.h
"
53
#endif
54
55
#define FILE_METHODS 1
56
57
namespace
libdap
58
{
59
60
const
int
DODS_MAX_ARRAY
=
DODS_INT_MAX
;
61
105
class
Array
:
public
Vector
106
{
107
public
:
118
struct
dimension
119
{
120
int
size
;
121
string
name
;
122
int
start
;
123
int
stop
;
124
int
stride
;
125
int
c_size
;
126
};
127
128
private
:
129
std::vector<dimension> _shape;
// list of dimensions (i.e., the shape)
130
131
friend
class
ArrayTest
;
132
133
protected
:
134
void
_duplicate
(
const
Array
&a);
135
136
#if FILE_METHODS
137
unsigned
int
print_array
(FILE *out,
unsigned
int
index,
138
unsigned
int
dims,
unsigned
int
shape[]);
139
#endif
140
unsigned
int
print_array
(ostream &out,
unsigned
int
index,
141
unsigned
int
dims,
unsigned
int
shape[]);
142
143
public
:
149
typedef
std::vector<dimension>::const_iterator
Dim_citer
;
156
typedef
std::vector<dimension>::iterator
Dim_iter
;
157
158
Array
(
const
string
&n,
BaseType
*v);
159
Array
(
const
string
&n,
const
string
&d,
BaseType
*v);
160
Array
(
const
Array
&rhs);
161
virtual
~Array
();
162
163
Array
&
operator=
(
const
Array
&rhs);
164
virtual
BaseType
*
ptr_duplicate
();
165
166
void
add_var
(
BaseType
*v,
Part
p =
nil
);
167
168
void
append_dim
(
int
size,
string
name
=
""
);
169
void
prepend_dim
(
int
size,
const
string
&
name
=
""
);
170
171
virtual
void
add_constraint
(
Dim_iter
i,
int
start,
int
stride,
int
stop);
172
virtual
void
reset_constraint
();
173
174
virtual
void
clear_constraint
();
175
176
virtual
void
update_length
(
int
size);
177
virtual
unsigned
int
width
(
bool
constrained =
true
);
178
179
Dim_iter
dim_begin
() ;
180
Dim_iter
dim_end
() ;
181
182
virtual
int
dimension_size
(
Dim_iter
i,
bool
constrained =
false
);
183
virtual
int
dimension_start
(
Dim_iter
i,
bool
constrained =
false
);
184
virtual
int
dimension_stop
(
Dim_iter
i,
bool
constrained =
false
);
185
virtual
int
dimension_stride
(
Dim_iter
i,
bool
constrained =
false
);
186
virtual
string
dimension_name
(
Dim_iter
i);
187
188
virtual
unsigned
int
dimensions
(
bool
constrained =
false
);
189
190
virtual
void
print_decl
(ostream &out,
string
space =
" "
,
191
bool
print_semi =
true
,
192
bool
constraint_info =
false
,
193
bool
constrained =
false
);
194
195
virtual
void
print_xml
(ostream &out,
string
space =
" "
,
196
bool
constrained =
false
);
197
198
virtual
void
print_xml_writer
(
XMLWriter
&xml,
bool
constrained =
false
);
199
virtual
void
print_xml_writer_core
(
XMLWriter
&out,
bool
constrained,
string
tag);
200
virtual
void
print_as_map_xml_writer
(
XMLWriter
&xml,
bool
constrained);
201
202
#if FILE_METHODS
203
virtual
void
print_xml_core
(FILE *out,
string
space,
bool
constrained,
string
tag);
204
#endif
205
virtual
void
print_xml_core
(ostream &out,
string
space,
bool
constrained,
string
tag);
206
207
// not used (?)
208
virtual
void
print_as_map_xml
(ostream &out,
string
space =
" "
,
209
bool
constrained =
false
);
210
211
virtual
void
print_val
(ostream &out,
string
space =
""
,
212
bool
print_decl_p =
true
);
213
214
#if FILE_METHODS
215
virtual
void
print_xml
(FILE *out,
string
space =
" "
,
216
bool
constrained =
false
);
217
virtual
void
print_as_map_xml
(FILE *out,
string
space =
" "
,
218
bool
constrained =
false
);
219
virtual
void
print_val
(FILE *out,
string
space =
""
,
220
bool
print_decl_p =
true
);
221
virtual
void
print_decl
(FILE *out,
string
space =
" "
,
222
bool
print_semi =
true
,
223
bool
constraint_info =
false
,
224
bool
constrained =
false
);
225
#endif
226
227
virtual
bool
check_semantics
(
string
&msg,
bool
all =
false
);
228
229
virtual
void
dump
(ostream &strm)
const
;
230
};
231
232
}
// namespace libdap
233
234
#endif // _array_h
Array.h
Generated by
1.8.3.1