bes  Updated for version 3.20.6
CachedSequence.h
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of libdap, 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 _cached_sequence_h
26 #define _cached_sequence_h 1
27 
28 #include <Sequence.h>
29 
30 namespace libdap {
31 class ConstraintEvaluator;
32 class DDS;
33 class Marshaller;
34 }
35 
36 // namespace bes {
37 
42 class CachedSequence: public libdap::Sequence
43 {
44 private:
45 protected:
46  unsigned int d_value_index;
47 
48  void load_prototypes_with_values(libdap::BaseTypeRow &btr, bool safe = true);
49 
50 public:
59  CachedSequence(const string &n) : Sequence(n), d_value_index(0) { }
60 
71  CachedSequence(const string &n, const string &d) : Sequence(n, d), d_value_index(0) { }
72 
74  CachedSequence(const CachedSequence &rhs) : Sequence(rhs), d_value_index(0) { }
75 
76  virtual ~CachedSequence() { }
77 
78  virtual BaseType *ptr_duplicate() { return new CachedSequence(*this); }
79 
80  CachedSequence &operator=(const CachedSequence &rhs) {
81  if (this == &rhs)
82  return *this;
83 
84  static_cast<Sequence &>(*this) = rhs; // run Sequence=
85 
86  return *this;
87  }
88 
89  virtual bool read_row(int row, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool ce_eval);
90 
91  virtual void intern_data(libdap::ConstraintEvaluator &eval, libdap::DDS &dds);
92  virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval = true);
93 
94  virtual void dump(ostream &strm) const;
95 };
96 
97 // } // namespace bes
98 
99 #endif //_cached_sequence_h
CachedSequence::CachedSequence
CachedSequence(const string &n)
The Sequence constructor.
Definition: CachedSequence.h:59
CachedSequence
Specialization of Sequence for cached responses.
Definition: CachedSequence.h:42
CachedSequence::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: CachedSequence.cc:232
libdap
Definition: BESDapFunctionResponseCache.h:35
CachedSequence::CachedSequence
CachedSequence(const CachedSequence &rhs)
The Sequence copy constructor.
Definition: CachedSequence.h:74
CachedSequence::serialize
virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval=true)
Specialization that resets CachedSequence's 'value index' state variable.
Definition: CachedSequence.cc:199
CachedSequence::read_row
virtual bool read_row(int row, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool ce_eval)
Read row number row of the Sequence.
Definition: CachedSequence.cc:142
CachedSequence::intern_data
virtual void intern_data(libdap::ConstraintEvaluator &eval, libdap::DDS &dds)
Specialization that resets CachedSequence's 'value index' state variable.
Definition: CachedSequence.cc:216
CachedSequence::CachedSequence
CachedSequence(const string &n, const string &d)
The Sequence server-side constructor.
Definition: CachedSequence.h:71