DMR.h
// -*- mode: c++; c-basic-offset:4 -*-
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.
// Copyright (c) 2013 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
#ifndef _dmr_h
#define _dmr_h 1
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include "DapObj.h"
namespace libdap
{
class D4Group;
class D4BaseTypeFactory;
class XMLWriter;
class DDS;
class DMR : public DapObj
{
private:
D4BaseTypeFactory *d_factory;
std::string d_name;
std::string d_filename;
int d_dap_major;
int d_dap_minor;
std::string d_dap_version;
std::string d_dmr_version;
std::string d_request_xml_base;
std::string d_namespace;
long d_max_response_size;
D4Group *d_root;
friend class DMRTest;
protected:
void m_duplicate(const DMR &dmr);
public:
DMR();
DMR(const DMR &dmr);
DMR(D4BaseTypeFactory *factory, const std::string &name = "");
DMR(D4BaseTypeFactory *factory, DDS &dds);
virtual ~DMR();
DMR &operator=(const DMR &rhs);
virtual void build_using_dds(DDS &dds);
bool OK() const { return (d_factory && d_root && !d_dap_version.empty()); }
std::string name() const { return d_name; }
void set_name(const std::string &n) { d_name = n; }
virtual D4BaseTypeFactory *factory() { return d_factory; }
virtual void set_factory(D4BaseTypeFactory *f) { d_factory = f; }
std::string filename() const { return d_filename; }
void set_filename(const std::string &fn) { d_filename = fn;}
std::string dap_version() const { return d_dap_version; }
void set_dap_version(const std::string &version_string);
int dap_major() const { return d_dap_major; }
int dap_minor() const { return d_dap_minor; }
std::string dmr_version() const { return d_dmr_version; }
void set_dmr_version(const std::string &v) { d_dmr_version = v; }
std::string request_xml_base() const { return d_request_xml_base; }
void set_request_xml_base(const std::string &xb) { d_request_xml_base = xb; }
std::string get_namespace() const { return d_namespace; }
void set_namespace(const std::string &ns) { d_namespace = ns; }
// TODO Move the response_limit methods to D4ResponseBuilder? jhrg 5/1/13
long response_limit() { return d_max_response_size; }
void set_response_limit(long size) { d_max_response_size = size; }
long request_size(bool constrained);
D4Group *root();
// TODO Remove this static method? If we have a DMR, why not use the
// getDDS() method below? jhrg 2.28.18
//static DDS *getDDS(DMR &dmr);
virtual DDS *getDDS();
void print_dap4(XMLWriter &xml, bool constrained = false);
virtual void dump(std::ostream &strm) const ;
};
} // namespace libdap
#endif // _dmr_h
libdap::DMR::getDDS
virtual DDS * getDDS()
Build a DDS from a DMR.
Definition: DMR.cc:371
libdap::DMR::request_size
long request_size(bool constrained)
Get the estimated response size, in kilo bytes.
Definition: DMR.cc:465
libdap::DMR::set_dap_version
void set_dap_version(const std::string &version_string)
Definition: DMR.cc:419
libdap::XMLWriter
Definition: XMLWriter.h:39
libdap::DMR::~DMR
virtual ~DMR()
Definition: DMR.cc:200
libdap::DMR::set_request_xml_base
void set_request_xml_base(const std::string &xb)
Definition: DMR.h:148
libdap::DMR::request_xml_base
std::string request_xml_base() const
Get the URL that will return this DMR.
Definition: DMR.h:145
libdap::DMR::root
D4Group * root()
Definition: DMR.cc:407
libdap::D4Group
Definition: D4Group.h:43
libdap
top level DAP object to house generic methods
Definition: AlarmHandler.h:35
libdap::DapObj
libdap base object for common functionality of libdap objects
Definition: DapObj.h:50
libdap::DMR::get_namespace
std::string get_namespace() const
Get the namespace associated with the DMR.
Definition: DMR.h:151
libdap::DMR::set_namespace
void set_namespace(const std::string &ns)
Set the namespace for this DMR.
Definition: DMR.h:154
libdap::DMR::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: DMR.cc:531
libdap::DMR::name
std::string name() const
Definition: DMR.h:115
libdap::DMR::build_using_dds
virtual void build_using_dds(DDS &dds)
Definition: DMR.cc:226
libdap::DMR::DMR
DMR()
Definition: DMR.cc:182
libdap::DMR
Definition: DMR.h:53
libdap::D4BaseTypeFactory
Definition: D4BaseTypeFactory.h:72
libdap::DMR::factory
virtual D4BaseTypeFactory * factory()
Definition: DMR.h:123
libdap::DDS
Definition: DDS.h:183
libdap::DMR::response_limit
long response_limit()
Get the maximum response size, in KB. Zero indicates no limit.
Definition: DMR.h:158
libdap::DMR::filename
std::string filename() const
Definition: DMR.h:132
libdap::DMR::set_response_limit
void set_response_limit(long size)
Definition: DMR.h:163
libdap::DMR::print_dap4
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: DMR.cc:478
libdap::DMR::OK
bool OK() const
Definition: DMR.h:107