libdap  Updated for version 3.19.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
DMR.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) 2013 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 #ifndef _dmr_h
26 #define _dmr_h 1
27 
28 #include <cassert>
29 
30 #include <iostream>
31 #include <string>
32 #include <vector>
33 
34 //#include "D4Group.h"
35 //#include "XMLWriter.h"
36 #include "DapObj.h"
37 
38 namespace libdap
39 {
40 
41 class D4Group;
42 class D4BaseTypeFactory;
43 class XMLWriter;
44 
45 class DDS;
46 
55 class DMR : public DapObj
56 {
57 private:
58  D4BaseTypeFactory *d_factory;
59 
61  string d_name;
63  string d_filename;
64 
66  int d_dap_major;
68  int d_dap_minor;
70  string d_dap_version;
71 
73  string d_dmr_version;
74 
76  string d_request_xml_base;
77 
79  string d_namespace;
80 
82  long d_max_response_size;
83 
85  D4Group *d_root;
86 
87  friend class DMRTest;
88 
89 protected:
90  void m_duplicate(const DMR &dmr);
91 
92 public:
93  DMR();
94  DMR(const DMR &dmr);
95  DMR(D4BaseTypeFactory *factory, const string &name = "");
96 
98 
99  virtual ~DMR();
100 
101  DMR &operator=(const DMR &rhs);
102 
103  virtual void build_using_dds(DDS &dds);
104 
109  bool OK() const { return (d_factory && d_root && !d_dap_version.empty()); }
110 
117  string name() const { return d_name; }
118  void set_name(const string &n) { d_name = n; }
120 
125  virtual D4BaseTypeFactory *factory() { return d_factory; }
126  virtual void set_factory(D4BaseTypeFactory *f) { d_factory = f; }
128 
134  string filename() const { return d_filename; }
135  void set_filename(const string &fn) { d_filename = fn;}
137 
138  string dap_version() const { return d_dap_version; }
139  void set_dap_version(const string &version_string);
140  int dap_major() const { return d_dap_major; }
141  int dap_minor() const { return d_dap_minor; }
142 
143  string dmr_version() const { return d_dmr_version; }
144  void set_dmr_version(const string &v) { d_dmr_version = v; }
145 
147  string request_xml_base() const { return d_request_xml_base; }
148 
150  void set_request_xml_base(const string &xb) { d_request_xml_base = xb; }
151 
153  string get_namespace() const { return d_namespace; }
154 
156  void set_namespace(const string &ns) { d_namespace = ns; }
157 
158  // TODO Move the response_limit methods to D4ResponseBuilder? jhrg 5/1/13
160  long response_limit() { return d_max_response_size; }
161 
165  void set_response_limit(long size) { d_max_response_size = size; }
166 
168  long request_size(bool constrained);
169 
174  D4Group *root();
175 
176  static DDS *getDDS(DMR &dmr);
177  virtual DDS *getDDS();
178 
179 
180 
181 
182  void print_dap4(XMLWriter &xml, bool constrained = false);
183 
184  virtual void dump(ostream &strm) const ;
185 };
186 
187 } // namespace libdap
188 
189 #endif // _dmr_h
libdap::DMR::request_size
long request_size(bool constrained)
Get the estimated response size, in kilo bytes.
Definition: DMR.cc:418
libdap::DMR::name
string name() const
Definition: DMR.h:117
libdap::XMLWriter
Definition: XMLWriter.h:39
libdap::DMR::set_request_xml_base
void set_request_xml_base(const string &xb)
Definition: DMR.h:150
libdap::DMR::~DMR
virtual ~DMR()
Definition: DMR.cc:199
libdap::DMR::request_xml_base
string request_xml_base() const
Get the URL that will return this DMR/DDX/DataThing.
Definition: DMR.h:147
libdap::DMR::root
D4Group * root()
Definition: DMR.cc:360
libdap::DMR::set_dap_version
void set_dap_version(const string &version_string)
Definition: DMR.cc:372
libdap::D4Group
Definition: D4Group.h:43
libdap
Definition: AlarmHandler.h:35
libdap::DapObj
libdap base object for common functionality of libdap objects
Definition: DapObj.h:55
libdap::DMR::filename
string filename() const
Definition: DMR.h:134
libdap::DMR::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: DMR.cc:484
libdap::DMR::build_using_dds
virtual void build_using_dds(DDS &dds)
Definition: DMR.cc:225
libdap::DMR::DMR
DMR()
Definition: DMR.cc:181
libdap::DMR
Definition: DMR.h:55
libdap::D4BaseTypeFactory
Definition: D4BaseTypeFactory.h:72
libdap::DMR::factory
virtual D4BaseTypeFactory * factory()
Definition: DMR.h:125
libdap::DDS
Definition: DDS.h:180
libdap::DMR::response_limit
long response_limit()
Get the maximum response size, in KB. Zero indicates no limit.
Definition: DMR.h:160
libdap::DMR::get_namespace
string get_namespace() const
Get the namespace associated with the DDS - likely set only by DDX responses.
Definition: DMR.h:153
libdap::DMR::set_namespace
void set_namespace(const string &ns)
Set the namespace for this DDS/DDX object/response.
Definition: DMR.h:156
libdap::DMR::set_response_limit
void set_response_limit(long size)
Definition: DMR.h:165
libdap::DMR::print_dap4
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: DMR.cc:431
libdap::DMR::OK
bool OK() const
Definition: DMR.h:109