bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
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 <libdap/InternalErr.h>
28
29#include "BESIndent.h"
30#include "CacheUnMarshaller.h"
31
32using namespace libdap;
33using namespace std;
34
35// namespace bes {
36
37void CacheUnMarshaller::get_byte(dods_byte &val)
38{
39 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
40}
41
42void CacheUnMarshaller::get_int16(dods_int16 &val)
43{
44 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
45}
46
47void CacheUnMarshaller::get_int32(dods_int32 &val)
48{
49 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
50}
51
52void CacheUnMarshaller::get_float32(dods_float32 &val)
53{
54 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
55}
56
57void CacheUnMarshaller::get_float64(dods_float64 &val)
58{
59 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
60}
61
62void CacheUnMarshaller::get_uint16(dods_uint16 &val)
63{
64 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
65}
66
67void CacheUnMarshaller::get_uint32(dods_uint32 &val)
68{
69 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
70}
71
72void CacheUnMarshaller::get_str(string &val)
73{
74 size_t len;
75 d_in.read(reinterpret_cast<char*>(&len), sizeof(size_t));
76 val.resize(len);
77 d_in.read(&val[0], len);
78}
79
80void CacheUnMarshaller::get_url(string &val)
81{
82 get_str(val);
83}
84
93void CacheUnMarshaller::get_opaque(char *val, unsigned int bytes)
94{
95 d_in.read(val, bytes);
96 //throw InternalErr(__FILE__, __LINE__, "CacheUnMarshaller::get_opaque() not implemented");
97}
98
99void CacheUnMarshaller::get_int(int &val)
100{
101 d_in.read(reinterpret_cast<char*>(&val), sizeof(val));
102}
103
110void CacheUnMarshaller::get_vector(char **val, unsigned int &bytes, Vector &)
111{
112 d_in.read(*val, bytes);
113}
114
115void CacheUnMarshaller::get_vector(char **val, unsigned int &num, int width, Vector &)
116{
117 d_in.read(*val, num * width);
118}
119
120void CacheUnMarshaller::dump(ostream &strm) const
121{
122 strm << BESIndent::LMarg << "CacheUnMarshaller::dump - (" << (void *) this << ")" << endl;
123}
124
125//} // namespace bes
126
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...