libdap++
Updated for version 3.8.2
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
#ifndef _attrtable_h
52
#include "
AttrTable.h
"
53
#endif
54
55
#ifndef _internalerr_h
56
#include "
InternalErr.h
"
57
#endif
58
59
#ifndef __DODS_DATATYPES_
60
#include "
dods-datatypes.h
"
61
#endif
62
63
#ifndef A_DapObj_h
64
#include "
DapObj.h
"
65
#endif
66
67
#include "
Marshaller.h
"
68
#include "
UnMarshaller.h
"
69
70
#define FILE_METHODS 1
71
72
using namespace
std;
73
74
namespace
libdap
75
{
76
77
class
DDS;
78
class
ConstraintEvaluator;
79
98
enum
Part
{
99
nil
,
// nil is for types that don't have parts...
100
array
,
101
maps
102
};
103
131
enum
Type
{
132
dods_null_c
,
133
dods_byte_c
,
134
dods_int16_c
,
135
dods_uint16_c
,
136
dods_int32_c
,
// Added `dods_' to fix clash with IRIX 5.3.
137
dods_uint32_c
,
138
dods_float32_c
,
139
dods_float64_c
,
140
dods_str_c
,
141
dods_url_c
,
142
dods_array_c
,
143
dods_structure_c
,
144
dods_sequence_c
,
145
dods_grid_c
146
};
147
190
class
BaseType
:
public
DapObj
191
{
192
private
:
193
string
_name;
// name of the instance
194
Type
_type;
// instance's type
195
string
_dataset;
// name of the dataset used to create this BaseType
196
197
bool
_read_p;
// true if the value has been read
198
bool
_send_p;
// Is the variable in the projection?
199
bool
d_in_selection;
// Is the variable in the selection?
200
bool
_synthesized_p;
// true if the variable is synthesized
201
202
// d_parent points to the Constructor or Vector which holds a particular
203
// variable. It is null for simple variables. The Vector and Constructor
204
// classes must maintain this variable.
205
BaseType
*d_parent;
206
207
// Attributes for this variable. Added 05/20/03 jhrg
208
AttrTable
d_attr;
209
210
protected
:
211
void
_duplicate(
const
BaseType
&bt);
212
213
public
:
214
typedef
stack<BaseType *>
btp_stack
;
215
216
BaseType
(
const
string
&n,
const
Type
&t);
217
BaseType
(
const
string
&n,
const
string
&d,
const
Type
&t);
218
219
BaseType
(
const
BaseType
©_from);
220
virtual
~
BaseType
();
221
222
virtual
string
toString();
223
224
virtual
void
dump(ostream &strm)
const
;
225
226
BaseType
&operator=(
const
BaseType
&rhs);
227
234
virtual
BaseType
*ptr_duplicate() = 0;
235
236
string
name()
const
;
237
virtual
void
set_name(
const
string
&n);
238
239
Type
type()
const
;
240
void
set_type(
const
Type
&t);
241
string
type_name()
const
;
242
243
string
dataset()
const
;
244
245
virtual
bool
is_simple_type();
246
virtual
bool
is_vector_type();
247
virtual
bool
is_constructor_type();
248
249
virtual
bool
synthesized_p();
250
virtual
void
set_synthesized_p(
bool
state);
251
252
virtual
int
element_count(
bool
leaves =
false
);
253
254
virtual
bool
read_p();
255
virtual
void
set_read_p(
bool
state);
256
257
virtual
bool
send_p();
258
virtual
void
set_send_p(
bool
state);
259
260
virtual
AttrTable
&get_attr_table();
261
virtual
void
set_attr_table(
const
AttrTable
&at);
262
263
virtual
bool
is_in_selection();
264
virtual
void
set_in_selection(
bool
state);
265
266
virtual
void
set_parent(
BaseType
*parent);
267
virtual
BaseType
*get_parent();
268
269
virtual
void
transfer_attributes(
AttrTable
*at);
270
271
// I put this comment here because the version in BaseType.cc does not
272
// include the exact_match or s variables since they are not used. Doxygen
273
// was gaging on the comment.
274
305
virtual
BaseType
*var(
const
string
&name =
""
,
bool
exact_match =
true
,
306
btp_stack
*s = 0);
307
virtual
BaseType
*var(
const
string
&name,
btp_stack
&s);
308
309
virtual
void
add_var(
BaseType
*bt,
Part
part =
nil
);
310
311
virtual
bool
read();
312
313
virtual
bool
check_semantics(
string
&msg,
bool
all =
false
);
314
315
virtual
bool
ops(
BaseType
*b,
int
op);
316
#if FILE_METHODS
317
virtual
void
print_decl(FILE *out,
string
space =
" "
,
318
bool
print_semi =
true
,
319
bool
constraint_info =
false
,
320
bool
constrained =
false
);
321
322
virtual
void
print_xml(FILE *out,
string
space =
" "
,
323
bool
constrained =
false
);
324
#endif
325
virtual
void
print_decl(ostream &out,
string
space =
" "
,
326
bool
print_semi =
true
,
327
bool
constraint_info =
false
,
328
bool
constrained =
false
);
329
330
virtual
void
print_xml(ostream &out,
string
space =
" "
,
331
bool
constrained =
false
);
332
335
347
virtual
unsigned
int
width() = 0;
348
369
virtual
unsigned
int
buf2val(
void
**val) = 0;
370
400
virtual
unsigned
int
val2buf(
void
*val,
bool
reuse =
false
) = 0;
401
414
virtual
void
intern_data(
ConstraintEvaluator
&eval,
DDS
&dds);
415
443
virtual
bool
serialize(
ConstraintEvaluator
&eval,
DDS
&dds,
444
Marshaller
&m,
bool
ce_eval =
true
) = 0;
445
470
virtual
bool
deserialize(
UnMarshaller
&um,
DDS
*dds,
bool
reuse =
false
) = 0;
471
472
#if FILE_METHODS
473
488
virtual
void
print_val(FILE *out,
string
space =
""
,
489
bool
print_decl_p =
true
) = 0;
490
#endif
491
506
virtual
void
print_val(ostream &out,
string
space =
""
,
507
bool
print_decl_p =
true
) = 0;
509
};
510
511
}
// namespace libdap
512
513
#endif // _basetype_h
BaseType.h
Generated on Thu Mar 13 2014 01:23:38 for libdap++ by
1.8.1.2