bes  Updated for version 3.20.6
DmrppUInt16.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 "DmrppUInt16.h"
33 
34 using namespace libdap;
35 using namespace std;
36 
37 namespace dmrpp {
38 
39 void
40 DmrppUInt16::_duplicate(const DmrppUInt16 &)
41 {
42 }
43 
44 DmrppUInt16::DmrppUInt16(const string &n) : UInt16(n), DmrppCommon()
45 {
46 }
47 
48 DmrppUInt16::DmrppUInt16(const string &n, const string &d) : UInt16(n, d), DmrppCommon()
49 {
50 }
51 
52 BaseType *
53 DmrppUInt16::ptr_duplicate()
54 {
55  return new DmrppUInt16(*this);
56 }
57 
58 DmrppUInt16::DmrppUInt16(const DmrppUInt16 &rhs) : UInt16(rhs), DmrppCommon(rhs)
59 {
60  _duplicate(rhs);
61 }
62 
63 DmrppUInt16 &
64 DmrppUInt16::operator=(const DmrppUInt16 &rhs)
65 {
66  if (this == &rhs)
67  return *this;
68 
69  dynamic_cast<UInt16 &>(*this) = rhs; // run Constructor=
70 
71  _duplicate(rhs);
72  DmrppCommon::m_duplicate_common(rhs);
73 
74  return *this;
75 }
76 
77 bool
78 DmrppUInt16::read()
79 {
80  BESDEBUG("dmrpp", "Entering " <<__PRETTY_FUNCTION__ << " for '" << name() << "'" << endl);
81 
82  if (read_p())
83  return true;
84 
85  set_value(*reinterpret_cast<dods_uint16*>(read_atomic(name())));
86 
87  set_read_p(true);
88 
89  return true;
90 
91 }
92 
93 
94 void DmrppUInt16::dump(ostream & strm) const
95 {
96  strm << BESIndent::LMarg << "DmrppUInt16::dump - (" << (void *) this << ")" << endl;
97  BESIndent::Indent();
98 
99  DmrppCommon::dump(strm);
100  UInt16::dump(strm);
101  strm << BESIndent::LMarg << "value: " << d_buf << endl;
102  BESIndent::UnIndent();
103 }
104 
105 } // namespace dmrpp
106 
libdap
Definition: BESDapFunctionResponseCache.h:35
dmrpp::DmrppCommon::read_atomic
virtual char * read_atomic(const std::string &name)
read method for the atomic types
Definition: DmrppCommon.cc:187