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