libdap++
Updated for version 3.12.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
DAP4StreamUnMarshaller.h
Go to the documentation of this file.
1
// DAP4StreamUnMarshaller.h
2
3
// -*- mode: c++; c-basic-offset:4 -*-
4
5
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
6
// Access Protocol.
7
8
// Copyright (c) 2012 OPeNDAP, Inc.
9
// Author: James Gallagher <jgallagher@opendap.org>
10
//
11
// This library is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU Lesser General Public
13
// License as published by the Free Software Foundation; either
14
// version 2.1 of the License, or (at your option) any later version.
15
//
16
// This library is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
// Lesser General Public License for more details.
20
//
21
// You should have received a copy of the GNU Lesser General Public
22
// License along with this library; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
//
25
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
26
27
#ifndef I_DAP4StreamUnMarshaller_h
28
#define I_DAP4StreamUnMarshaller_h 1
29
30
#include <iostream>
31
32
using
std::istream ;
33
using
std::cin ;
34
35
#include "
UnMarshaller.h
"
36
#include "
BaseType.h
"
37
#include "
XDRUtils.h
"
38
39
namespace
libdap
40
{
41
42
class
Vector;
43
46
class
DAP4StreamUnMarshaller
:
public
UnMarshaller
{
47
public
:
48
const
static
unsigned
int
c_md5_length
= 16;
49
50
private
:
51
istream &d_in;
52
bool
d_twiddle_bytes;
53
54
// These are used for reals that need to be converted from IEEE 754
55
XDR d_source;
56
dods_float64
d_buf;
57
58
DAP4StreamUnMarshaller
();
59
#if 0
60
: d_in(cin) {
61
throw
InternalErr
( __FILE__, __LINE__,
"not implemented."
) ;
62
}
63
#endif
64
DAP4StreamUnMarshaller
(
const
DAP4StreamUnMarshaller
&);
65
#if 0
66
:
UnMarshaller
(), d_in(cin) {
67
throw
InternalErr
( __FILE__, __LINE__,
"not implemented."
) ;
68
}
69
#endif
70
71
DAP4StreamUnMarshaller & operator=(
const
DAP4StreamUnMarshaller &);
72
#if 0
73
{
74
throw
InternalErr( __FILE__, __LINE__,
"not implemented."
) ;
75
}
76
#endif
77
78
void
m_deserialize_reals(
char
*val,
unsigned
int
num,
int
width,
Type
type);
79
void
m_twidle_vector_elements(
char
*vals,
unsigned
int
num,
int
width);
80
81
public
:
82
struct
checksum
{
83
unsigned
char
md
[
c_md5_length
];
84
};
85
86
DAP4StreamUnMarshaller
(istream &in,
bool
is_stream_bigendian);
87
virtual
~DAP4StreamUnMarshaller
();
88
89
checksum
get_checksum
();
90
string
get_checksum
(
checksum
c);
91
92
virtual
void
get_byte
(
dods_byte
&val);
93
virtual
void
get_int8
(
dods_int8
&val);
94
95
virtual
void
get_int16
(
dods_int16
&val);
96
virtual
void
get_int32
(
dods_int32
&val);
97
98
virtual
void
get_int64
(
dods_int64
&val);
99
100
virtual
void
get_float32
(
dods_float32
&val);
101
virtual
void
get_float64
(
dods_float64
&val);
102
103
virtual
void
get_uint16
(
dods_uint16
&val);
104
virtual
void
get_uint32
(
dods_uint32
&val);
105
106
virtual
void
get_uint64
(
dods_uint64
&val);
107
108
virtual
void
get_str
(
string
&val);
109
virtual
void
get_url
(
string
&val);
110
111
virtual
void
get_opaque
(
char
*val,
unsigned
int
len);
112
virtual
void
get_opaque
(
char
**val,
unsigned
int
&len);
113
114
virtual
void
get_int
(
int
&) {
115
throw
InternalErr
(__FILE__, __LINE__,
"Not implemented for DAP4"
);
116
}
117
118
virtual
dods_uint64
get_length_prefix
();
119
120
// Note that DAP4 assumes clients know the size of arrays when they
121
// read the data; it's the 'varying' get methods that read & return the
122
// number of elements. These methods are here to appease the UnMarshaller
123
// 'interface' code
124
virtual
void
get_vector
(
char
**,
unsigned
int
&,
Vector
&) {
125
throw
InternalErr
(__FILE__, __LINE__,
"Not implemented for DAP4"
);
126
}
127
128
virtual
void
get_vector
(
char
**,
unsigned
int
&,
int
,
Vector
& ) {
129
throw
InternalErr
(__FILE__, __LINE__,
"Not implemented for DAP4"
);
130
}
131
132
virtual
void
get_vector
(
char
*val,
unsigned
int
num);
133
virtual
void
get_vector
(
char
*val,
unsigned
int
num,
int
width,
Type
type);
134
135
virtual
void
get_varying_vector
(
char
**val,
unsigned
int
&num);
136
virtual
void
get_varying_vector
(
char
**val,
unsigned
int
&num,
int
width,
Type
type);
137
138
virtual
void
dump
(ostream &strm)
const
;
139
};
140
141
}
// namespace libdap
142
143
#endif // I_DAP4StreamUnMarshaller_h
144
DAP4StreamUnMarshaller.h
Generated on Tue Oct 22 2013 06:24:37 for libdap++ by
1.8.4