bes  Updated for version 3.19.1
CacheUnMarshaller.cc
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of Hyrax, A C++ implementation of the OPeNDAP Data
4 // Access Protocol.
5 
6 // Copyright (c) 2016 OPeNDAP, Inc.
7 // Author: James Gallagher <jgallagher@opendap.org>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 #include "config.h"
26 
27 #include <InternalErr.h>
28 
29 #include "CacheUnMarshaller.h"
30 
31 using namespace libdap;
32 
33 // namespace bes {
34 
35 void CacheUnMarshaller::get_byte(dods_byte &val)
36 {
37  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
38 }
39 
40 void CacheUnMarshaller::get_int16(dods_int16 &val)
41 {
42  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
43 }
44 
45 void CacheUnMarshaller::get_int32(dods_int32 &val)
46 {
47  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
48 }
49 
50 void CacheUnMarshaller::get_float32(dods_float32 &val)
51 {
52  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
53 }
54 
55 void CacheUnMarshaller::get_float64(dods_float64 &val)
56 {
57  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
58 }
59 
60 void CacheUnMarshaller::get_uint16(dods_uint16 &val)
61 {
62  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
63 }
64 
65 void CacheUnMarshaller::get_uint32(dods_uint32 &val)
66 {
67  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
68 }
69 
70 void CacheUnMarshaller::get_str(string &val)
71 {
72  size_t len;
73  d_in.read(reinterpret_cast<char*>(&len), sizeof(size_t));
74  val.resize(len);
75  d_in.read(&val[0], len);
76 }
77 
78 void CacheUnMarshaller::get_url(string &val)
79 {
80  get_str(val);
81 }
82 
91 void CacheUnMarshaller::get_opaque(char *val, unsigned int bytes)
92 {
93  d_in.read(val, bytes);
94  //throw InternalErr(__FILE__, __LINE__, "CacheUnMarshaller::get_opaque() not implemented");
95 }
96 
97 void CacheUnMarshaller::get_int(int &val)
98 {
99  d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
100 }
101 
108 void CacheUnMarshaller::get_vector(char **val, unsigned int &bytes, Vector &)
109 {
110  d_in.read(*val, bytes);
111 }
112 
113 void CacheUnMarshaller::get_vector(char **val, unsigned int &num, int width, Vector &)
114 {
115  d_in.read(*val, num * width);
116 }
117 
118 void CacheUnMarshaller::dump(ostream &strm) const
119 {
120  strm << DapIndent::LMarg << "CacheUnMarshaller::dump - (" << (void *) this << ")" << endl;
121 }
122 
123 //} // namespace bes
124 
virtual void get_opaque(char *val, unsigned int len)
Get bytes; assume the caller knows what they are doing The get_opaque() and put_opaque() methods of U...