bes  Updated for version 3.20.10
DmrppByte.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 #include <memory>
29 
30 #include <BESError.h>
31 #include <BESDebug.h>
32 
33 #include "DmrppByte.h"
34 
35 using namespace libdap;
36 using namespace std;
37 
38 namespace dmrpp {
39 
40 DmrppByte &
41 DmrppByte::operator=(const DmrppByte &rhs)
42 {
43  if (this == &rhs)
44  return *this;
45 
46  dynamic_cast<Byte &>(*this) = rhs; // run Constructor=
47 
48  dynamic_cast<DmrppCommon &>(*this) = rhs;
49  // DmrppCommon::m_duplicate_common(rhs);
50 
51  return *this;
52 }
53 
54 bool DmrppByte::read()
55 {
56  BESDEBUG("dmrpp", "Entering " <<__PRETTY_FUNCTION__ << " for " << name() << endl);
57 
58  if (!get_chunks_loaded())
59  load_chunks(this);
60 
61  if (read_p())
62  return true;
63 
64  set_value(*reinterpret_cast<dods_byte*>(read_atomic(name())));
65 
66  set_read_p(true);
67 
68  return true;
69 }
70 
71 void
72 DmrppByte::set_send_p(bool state)
73 {
74  if (!get_attributes_loaded())
75  load_attributes(this);
76 
77  Byte::set_send_p(state);
78 }
79 
80 void DmrppByte::dump(ostream & strm) const
81 {
82  strm << BESIndent::LMarg << "DmrppByte::dump - (" << (void *) this << ")" << endl;
83  BESIndent::Indent();
84  DmrppCommon::dump(strm);
85  Byte::dump(strm);
86  strm << BESIndent::LMarg << "value: " << d_buf << endl;
87  BESIndent::UnIndent();
88 }
89 
90 } // namespace dmrpp