libdap  Updated for version 3.18.2
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 
97  DMR(D4BaseTypeFactory *factory, DDS &dds);
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 
136  string filename() const { return d_filename; }
137  void set_filename(const string &fn) { d_filename = fn;}
139 
140  string dap_version() const { return d_dap_version; }
141  void set_dap_version(const string &version_string);
142  int dap_major() const { return d_dap_major; }
143  int dap_minor() const { return d_dap_minor; }
144 
145  string dmr_version() const { return d_dmr_version; }
146  void set_dmr_version(const string &v) { d_dmr_version = v; }
147 
149  string request_xml_base() const { return d_request_xml_base; }
150 
152  void set_request_xml_base(const string &xb) { d_request_xml_base = xb; }
153 
155  string get_namespace() const { return d_namespace; }
156 
158  void set_namespace(const string &ns) { d_namespace = ns; }
159 
160  // TODO Move the response_limit methods to D4ResponseBuilder? jhrg 5/1/13
162  long response_limit() { return d_max_response_size; }
163 
167  void set_response_limit(long size) { d_max_response_size = size; }
168 
170  long request_size(bool constrained);
171 
176  D4Group *root();
177 
178  void print_dap4(XMLWriter &xml, bool constrained = false);
179 
180  virtual void dump(ostream &strm) const ;
181 };
182 
183 } // namespace libdap
184 
185 #endif // _dmr_h
void set_namespace(const string &ns)
Set the namespace for this DDS/DDX object/response.
Definition: DMR.h:158
void set_response_limit(long size)
Definition: DMR.h:167
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: DMR.cc:313
string request_xml_base() const
Get the URL that will return this DMR/DDX/DataThing.
Definition: DMR.h:149
D4Group * root()
Definition: DMR.cc:242
virtual void dump(ostream &strm) const
dumps information about this object
Definition: DMR.cc:366
long response_limit()
Get the maximum response size, in KB. Zero indicates no limit.
Definition: DMR.h:162
void set_request_xml_base(const string &xb)
Definition: DMR.h:152
virtual ~DMR()
Definition: DMR.cc:197
string name() const
Definition: DMR.h:117
bool OK() const
Definition: DMR.h:109
virtual D4BaseTypeFactory * factory()
Definition: DMR.h:125
long request_size(bool constrained)
Get the estimated response size, in kilo bytes.
Definition: DMR.cc:300
string get_namespace() const
Get the namespace associated with the DDS - likely set only by DDX responses.
Definition: DMR.h:155
virtual void build_using_dds(DDS &dds)
Definition: DMR.cc:223
libdap base object for common functionality of libdap objects
Definition: DapObj.h:55
void set_dap_version(const string &version_string)
Definition: DMR.cc:254
string filename() const
Definition: DMR.h:136