libdap++
Updated for version 3.12.0
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., 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
// (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
namespace
libdap
56
{
57
58
const
int
DODS_MAX_ARRAY
=
DODS_INT_MAX
;
59
103
class
Array
:
public
Vector
104
{
105
public
:
116
struct
dimension
117
{
118
int
size
;
119
string
name
;
120
int
start
;
121
int
stop
;
122
int
stride
;
123
int
c_size
;
124
};
125
126
private
:
127
std::vector<dimension> _shape;
// list of dimensions (i.e., the shape)
128
129
friend
class
ArrayTest
;
130
131
protected
:
132
void
_duplicate
(
const
Array
&a);
133
134
unsigned
int
print_array
(FILE *out,
unsigned
int
index,
135
unsigned
int
dims,
unsigned
int
shape[]);
136
137
unsigned
int
print_array
(ostream &out,
unsigned
int
index,
138
unsigned
int
dims,
unsigned
int
shape[]);
139
140
public
:
146
typedef
std::vector<dimension>::const_iterator
Dim_citer
;
153
typedef
std::vector<dimension>::iterator
Dim_iter
;
154
155
Array
(
const
string
&n,
BaseType
*v);
156
Array
(
const
string
&n,
const
string
&d,
BaseType
*v);
157
Array
(
const
Array
&rhs);
158
virtual
~Array
();
159
160
Array
&
operator=
(
const
Array
&rhs);
161
virtual
BaseType
*
ptr_duplicate
();
162
163
void
add_var
(
BaseType
*v,
Part
p =
nil
);
164
void
add_var_nocopy
(
BaseType
*v,
Part
p =
nil
);
165
166
void
append_dim
(
int
size,
string
name
=
""
);
167
void
prepend_dim
(
int
size,
const
string
&
name
=
""
);
168
void
clear_all_dims
();
169
170
virtual
void
add_constraint
(
Dim_iter
i,
int
start,
int
stride,
int
stop);
171
virtual
void
reset_constraint
();
172
173
virtual
void
clear_constraint
();
174
175
virtual
void
update_length
(
int
size);
176
virtual
unsigned
int
width
(
bool
constrained =
false
);
177
178
Dim_iter
dim_begin
() ;
179
Dim_iter
dim_end
() ;
180
181
virtual
int
dimension_size
(
Dim_iter
i,
bool
constrained =
false
);
182
virtual
int
dimension_start
(
Dim_iter
i,
bool
constrained =
false
);
183
virtual
int
dimension_stop
(
Dim_iter
i,
bool
constrained =
false
);
184
virtual
int
dimension_stride
(
Dim_iter
i,
bool
constrained =
false
);
185
virtual
string
dimension_name
(
Dim_iter
i);
186
187
virtual
unsigned
int
dimensions
(
bool
constrained =
false
);
188
189
virtual
void
print_decl
(ostream &out,
string
space =
" "
,
190
bool
print_semi =
true
,
191
bool
constraint_info =
false
,
192
bool
constrained =
false
);
193
194
virtual
void
print_xml
(ostream &out,
string
space =
" "
,
195
bool
constrained =
false
);
196
197
virtual
void
print_xml_writer
(
XMLWriter
&xml,
bool
constrained =
false
);
198
virtual
void
print_xml_writer_core
(
XMLWriter
&out,
bool
constrained,
string
tag);
199
virtual
void
print_as_map_xml_writer
(
XMLWriter
&xml,
bool
constrained);
200
201
virtual
void
print_xml_core
(FILE *out,
string
space,
bool
constrained,
string
tag);
202
virtual
void
print_xml_core
(ostream &out,
string
space,
bool
constrained,
string
tag);
203
204
// not used (?)
205
virtual
void
print_as_map_xml
(ostream &out,
string
space =
" "
,
206
bool
constrained =
false
);
207
208
virtual
void
print_val
(ostream &out,
string
space =
""
,
209
bool
print_decl_p =
true
);
210
211
virtual
void
print_xml
(FILE *out,
string
space =
" "
,
212
bool
constrained =
false
);
213
virtual
void
print_as_map_xml
(FILE *out,
string
space =
" "
,
214
bool
constrained =
false
);
215
virtual
void
print_val
(FILE *out,
string
space =
""
,
216
bool
print_decl_p =
true
);
217
virtual
void
print_decl
(FILE *out,
string
space =
" "
,
218
bool
print_semi =
true
,
219
bool
constraint_info =
false
,
220
bool
constrained =
false
);
221
222
virtual
bool
check_semantics
(
string
&msg,
bool
all =
false
);
223
224
virtual
void
dump
(ostream &strm)
const
;
225
};
226
227
}
// namespace libdap
228
229
#endif // _array_h
Array.h
Generated on Tue Oct 22 2013 06:24:37 for libdap++ by
1.8.4