bes  Updated for version 3.20.6
CacheUnMarshaller.h
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 #ifndef cache_unmarshaller_h
26 #define cache_unmarshaller_h 1
27 
28 #include <cassert>
29 #include <istream>
30 
31 #include <UnMarshaller.h> // from libdap
32 
33 // namespace bes {
34 
43 class CacheUnMarshaller: public libdap::UnMarshaller {
44 private:
45  std::istream &d_in;
46 
49  CacheUnMarshaller & operator=(const CacheUnMarshaller &);
50 
51 public:
52  CacheUnMarshaller(std::istream &in) : UnMarshaller(), d_in(in) {
53  assert(sizeof(std::streamsize) >= sizeof(int64_t));
54  // This will cause exceptions to be thrown on i/o errors. The exception
55  // will be ostream::failure
56  d_in.exceptions(std::istream::failbit | std::istream::badbit);
57  }
58 
59  virtual ~CacheUnMarshaller() { }
60 
61  virtual void get_byte(libdap::dods_byte &val);
62 
63  virtual void get_int16(libdap::dods_int16 &val);
64  virtual void get_int32(libdap::dods_int32 &val);
65 
66  virtual void get_float32(libdap::dods_float32 &val);
67  virtual void get_float64(libdap::dods_float64 &val);
68 
69  virtual void get_uint16(libdap::dods_uint16 &val);
70  virtual void get_uint32(libdap::dods_uint32 &val);
71 
72  virtual void get_str(std::string &val);
73  virtual void get_url(std::string &val);
74 
75  virtual void get_opaque(char *val, unsigned int len);
76  virtual void get_int(int &val);
77 
78  virtual void get_vector(char **val, unsigned int &num, libdap::Vector &);
79  virtual void get_vector(char **val, unsigned int &num, int width, libdap::Vector &);
80 
81  virtual void dump(ostream &strm) const;
82 };
83 
84 //} // namespace bes
85 
86 #endif // cache_unmarshaller_h
87 
CacheUnMarshaller
UnMarshaller that knows how to deserialize dap objects.
Definition: CacheUnMarshaller.h:43
CacheUnMarshaller::get_opaque
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...
Definition: CacheUnMarshaller.cc:93