bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
DmrppInt16.cc
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of the BES
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 <string>
28
29#include <BESError.h>
30#include <BESDebug.h>
31
32#include "byteswap_compat.h"
33#include "DmrppInt16.h"
34
35using namespace libdap;
36using namespace std;
37
38namespace dmrpp {
39
41DmrppInt16::operator=(const DmrppInt16 &rhs)
42{
43 if (this == &rhs)
44 return *this;
45
46 dynamic_cast<Int16 &>(*this) = rhs; // run Constructor=
47
48 dynamic_cast<DmrppCommon &>(*this) = rhs;
49 //DmrppCommon::m_duplicate_common(rhs);
50
51 return *this;
52}
53
54bool
55DmrppInt16::read()
56{
57 BESDEBUG("dmrpp", "Entering " <<__PRETTY_FUNCTION__ << " for '" << name() << "'" << endl);
58
59 if (!get_chunks_loaded())
60 load_chunks(this);
61
62 if (read_p())
63 return true;
64
65 set_value(*reinterpret_cast<dods_int16*>(read_atomic(name())));
66
67 if ( this->twiddle_bytes() ) {
68 d_buf = bswap_16(d_buf);
69 }
70
71 set_read_p(true);
72
73 return true;
74}
75
76void
77DmrppInt16::set_send_p(bool state)
78{
80 load_attributes(this);
81
82 Int16::set_send_p(state);
83}
84
85void DmrppInt16::dump(ostream & strm) const
86{
87 strm << BESIndent::LMarg << "DmrppInt16::dump - (" << (void *) this << ")" << endl;
88 BESIndent::Indent();
89 DmrppCommon::dump(strm);
90 Int16::dump(strm);
91 strm << BESIndent::LMarg << "value: " << d_buf << endl;
92 BESIndent::UnIndent();
93}
94
95} // namespace dmrpp
96
virtual bool twiddle_bytes() const
Returns true if this object utilizes shuffle compression.
virtual void load_attributes(libdap::BaseType *btp)
Load the attribute information for this variable.
virtual bool get_chunks_loaded() const
Have the chunks been loaded?
virtual void load_chunks(libdap::BaseType *btp)
Load chunk information for this variable.
virtual bool get_attributes_loaded() const
Have the attributes been loaded?
virtual char * read_atomic(const std::string &name)
read method for the atomic types