libdap++
Updated for version 3.12.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BaseType.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
// Dan Holloway <dan@hollywood.gso.uri.edu>
10
// Reza Nekovei <reza@intcomm.net>
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
//
26
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
27
28
// (c) COPYRIGHT URI/MIT 1994-1999
29
// Please read the full copyright statement in the file COPYRIGHT_URI.
30
//
31
// Authors:
32
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
33
// dan Dan Holloway <dan@hollywood.gso.uri.edu>
34
// reza Reza Nekovei <reza@intcomm.net>
35
36
// Abstract base class for the variables in a dataset. This is used to store
37
// the type-invariant information that describes a variable as given in the
38
// DODS API.
39
//
40
// jhrg 9/6/94
41
42
#ifndef _basetype_h
43
#define _basetype_h 1
44
45
46
#include <vector>
47
#include <stack>
48
#include <iostream>
49
#include <string>
50
51
// These are instantiated only for DAP4 variables
52
#if DAP4
53
#include "
D4Dimensions.h
"
54
#include "
D4Maps.h
"
55
#endif
56
57
#include "
AttrTable.h
"
58
59
#include "
InternalErr.h
"
60
61
#include "
dods-datatypes.h
"
62
63
#include "
DapObj.h
"
64
65
#include "
XMLWriter.h
"
66
67
using namespace
std;
68
69
namespace
libdap
70
{
71
72
class
DDS;
73
class
ConstraintEvaluator;
74
class
Marshaller;
75
class
UnMarshaller;
76
95
enum
Part
{
96
nil
,
// nil is for types that don't have parts...
97
array
,
98
maps
99
};
100
137
enum
Type
{
138
dods_null_c
,
139
dods_byte_c
,
140
dods_int16_c
,
141
dods_uint16_c
,
142
dods_int32_c
,
// Added `dods_' to fix clash with IRIX 5.3.
143
dods_uint32_c
,
144
dods_float32_c
,
145
dods_float64_c
,
146
dods_str_c
,
147
dods_url_c
,
148
dods_array_c
,
149
dods_structure_c
,
150
dods_sequence_c
,
151
dods_grid_c
,
152
153
// Added for DAP4
154
dods_int8_c
,
155
dods_uint8_c
,
156
157
dods_int64_c
,
158
dods_uint64_c
,
159
160
dods_url4_c
,
161
162
dods_enum_c
,
163
dods_group_c
164
165
};
166
199
class
BaseType
:
public
DapObj
200
{
201
private
:
202
string
d_name;
// name of the instance
203
Type
d_type;
// instance's type
204
string
d_dataset;
// name of the dataset used to create this BaseType
205
206
bool
d_is_read;
// true if the value has been read
207
bool
d_is_send;
// Is the variable in the projection?
208
bool
d_in_selection;
// Is the variable in the selection?
209
bool
d_is_synthesized;
// true if the variable is synthesized
210
211
// d_parent points to the Constructor or Vector which holds a particular
212
// variable. It is null for simple variables. The Vector and Constructor
213
// classes must maintain this variable.
214
BaseType
*d_parent;
215
216
// Attributes for this variable. Added 05/20/03 jhrg
217
AttrTable
d_attr;
218
219
bool
d_is_dap4;
// True if this is a DAP4 variable, false ... DAP2
220
221
// These are non-empty only for DAP4 variables. Added 9/27/12 jhrg
222
223
// FIXME Remove this. This header cannot have compile-time variation
224
#if DAP4
225
D4Dimensions
d_dims;
// If non-empty, this BaseType is an DAP4 Array
226
D4Maps
d_maps;
// if non-empty, this BaseType is a DAP4 'Grid'
227
#endif
228
229
protected
:
230
void
m_duplicate(
const
BaseType
&bt);
231
232
public
:
233
typedef
stack<BaseType *>
btp_stack
;
234
235
// These ctors assume is_dap4 is false
236
BaseType
(
const
string
&n,
const
Type
&t,
bool
is_dap4 =
false
);
237
BaseType
(
const
string
&n,
const
string
&d,
const
Type
&t,
bool
is_dap4 =
false
);
238
#if 0
239
// These provide a way to set is_dap4
240
BaseType
(
const
string
&n,
const
Type
&t,
bool
is_dap4);
241
BaseType
(
const
string
&n,
const
string
&d,
const
Type
&t,
bool
is_dap4);
242
#endif
243
BaseType
(
const
BaseType
©_from);
244
virtual
~
BaseType
();
245
246
virtual
string
toString();
247
248
virtual
void
dump(ostream &strm)
const
;
249
250
BaseType
&operator=(
const
BaseType
&rhs);
251
252
bool
is_dap4
() {
return
d_is_dap4; }
253
void
set_is_dap4
(
const
bool
v) { d_is_dap4 = v;}
254
261
virtual
BaseType
*ptr_duplicate() = 0;
262
263
string
name()
const
;
264
virtual
void
set_name(
const
string
&n);
265
266
Type
type()
const
;
267
void
set_type(
const
Type
&t);
268
string
type_name
()
const
;
269
270
string
dataset()
const
;
271
272
virtual
bool
is_simple_type
();
273
virtual
bool
is_vector_type
();
274
virtual
bool
is_constructor_type
();
275
276
#if 0
277
// Not yet, if ever. Allow 'sloppy' changeover in the handlers
278
virtual
bool
is_dap4_only_type();
279
virtual
bool
is_dap2_only_type();
280
#endif
281
virtual
bool
synthesized_p();
282
virtual
void
set_synthesized_p(
bool
state);
283
284
virtual
int
element_count(
bool
leaves =
false
);
285
286
virtual
bool
read_p();
287
virtual
void
set_read_p(
bool
state);
288
289
virtual
bool
send_p();
290
virtual
void
set_send_p(
bool
state);
291
292
virtual
AttrTable
&get_attr_table();
293
virtual
void
set_attr_table(
const
AttrTable
&at);
294
295
virtual
bool
is_in_selection();
296
virtual
void
set_in_selection(
bool
state);
297
298
virtual
void
set_parent(
BaseType
*parent);
299
virtual
BaseType
*get_parent();
300
301
virtual
void
transfer_attributes(
AttrTable
*at);
302
303
// I put this comment here because the version in BaseType.cc does not
304
// include the exact_match or s variables since they are not used. Doxygen
305
// was gaging on the comment.
306
337
virtual
BaseType
*var(
const
string
&name =
""
,
bool
exact_match =
true
, btp_stack *s = 0);
338
virtual
BaseType
*var(
const
string
&name, btp_stack &s);
339
340
virtual
void
add_var(
BaseType
*bt,
Part
part =
nil
);
341
342
virtual
bool
read();
343
344
virtual
bool
check_semantics(
string
&msg,
bool
all =
false
);
345
346
virtual
bool
ops(
BaseType
*b,
int
op);
347
348
virtual
void
print_decl(FILE *out,
string
space =
" "
,
349
bool
print_semi =
true
,
350
bool
constraint_info =
false
,
351
bool
constrained =
false
);
352
353
virtual
void
print_xml(FILE *out,
string
space =
" "
,
354
bool
constrained =
false
);
355
356
virtual
void
print_decl(ostream &out,
string
space =
" "
,
357
bool
print_semi =
true
,
358
bool
constraint_info =
false
,
359
bool
constrained =
false
);
360
361
virtual
void
print_xml(ostream &out,
string
space =
" "
,
362
bool
constrained =
false
);
363
364
virtual
void
print_xml_writer(
XMLWriter
&xml,
bool
constrained =
false
);
365
368
#if 0
369
380
virtual
unsigned
int
width(
bool
constrained =
false
) = 0;
381
#endif
382
virtual
unsigned
int
width(
bool
constrained =
false
);
383
404
virtual
unsigned
int
buf2val(
void
**val) = 0;
405
435
virtual
unsigned
int
val2buf(
void
*val,
bool
reuse =
false
) = 0;
436
449
virtual
void
intern_data(
ConstraintEvaluator
&eval,
DDS
&dds);
450
478
virtual
bool
serialize(
ConstraintEvaluator
&eval,
DDS
&dds,
479
Marshaller
&m,
bool
ce_eval =
true
) = 0;
480
505
virtual
bool
deserialize(
UnMarshaller
&um,
DDS
*dds,
bool
reuse =
false
) = 0;
506
522
virtual
void
print_val(FILE *out,
string
space =
""
,
523
bool
print_decl_p =
true
) = 0;
524
539
virtual
void
print_val(ostream &out,
string
space =
""
,
540
bool
print_decl_p =
true
) = 0;
542
};
543
544
}
// namespace libdap
545
546
#endif // _basetype_h
BaseType.h
Generated on Fri Oct 18 2013 00:14:23 for libdap++ by
1.8.4