/usr/include/libdap/DMR.h is in libdap-dev 3.15.1-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | // -*- 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 "D4Group.h"
//#include "XMLWriter.h"
#include "DapObj.h"
namespace libdap
{
class D4Group;
class D4BaseTypeFactory;
class XMLWriter;
class DDS;
/** DMR is root object for a DAP4 dataset. It holds a D4Group and other
* information about the dataset (DAP protocol number, DMR version, etc.).
*
* @note This class holds the dataset name and filename (which might
* actually be a database name, but it's usually a filename). The variables
* of a DAP4 dataset are held by the D4Group instance (which is a child
* of Constructor).
*/
class DMR : public DapObj
{
private:
D4BaseTypeFactory *d_factory;
/// The name of the dataset. This should not be the pathname to a file
string d_name;
/// The pathname or other system identifier for the dataset
string d_filename;
/// DAP protocol major version number. Should be '4'
int d_dap_major;
/// DAP protocol minor version number.
int d_dap_minor;
/// String version of the DAP protocol number
string d_dap_version;
/// The version of the DMR document
string d_dmr_version;
/// The URL for the request base
string d_request_xml_base;
/// The namespace to use when printing the XML serialization
string d_namespace;
/// The maximum response size (in Kilo bytes)
long d_max_response_size;
/// The root group; holds dimensions, enums, variables, groups, ...
D4Group *d_root;
friend class DMRTest;
protected:
void m_duplicate(const DMR &dmr);
public:
DMR();
DMR(const DMR &dmr);
DMR(D4BaseTypeFactory *factory, const string &name = "");
DMR(D4BaseTypeFactory *factory, DDS &dds);
virtual ~DMR();
DMR &operator=(const DMR &rhs);
virtual void build_using_dds(DDS &dds);
/**
* Class invariant. If true, any method can be used.
* @return True if the instance is OK to use, false otherwise.
*/
bool OK() const { return (d_factory && d_root && !d_dap_version.empty()); }
/** Get and set the DMR's name. This is effectively the 'dataset' name.
* It should not be used to reference the dataset's data store
* (e.g., it should not be a pathname to a file). This will be used in
* error messages.
*/
//@{
string name() const { return d_name; }
void set_name(const string &n) { d_name = n; }
//@}
/** Get/set the factory which makes instances of the variables.
Specialize D4BaseTypeFactory so that a DMR will be
populated with your client or server's specialized types.*/
//@{
virtual D4BaseTypeFactory *factory() { return d_factory; }
virtual void set_factory(D4BaseTypeFactory *f) { d_factory = f; }
//@}
/** get/set the dataset's 'filename.' The filename is a string that can
* be used to access the dataset's actual data store (it's usually a
* pathname to a file, but it might be a database key.
*
* @todo Move this to Group?
*/
//@{
string filename() const { return d_filename; }
void set_filename(const string &fn) { d_filename = fn;}
//@}
string dap_version() const { return d_dap_version; }
void set_dap_version(const string &version_string);
int dap_major() const { return d_dap_major; }
int dap_minor() const { return d_dap_minor; }
string dmr_version() const { return d_dmr_version; }
void set_dmr_version(const string &v) { d_dmr_version = v; }
/// Get the URL that will return this DMR/DDX/DataThing
string request_xml_base() const { return d_request_xml_base; }
/// @see get_request_xml_base
void set_request_xml_base(const string &xb) { d_request_xml_base = xb; }
/// Get the namespace associated with the DDS - likely set only by DDX responses
string get_namespace() const { return d_namespace; }
/// Set the namespace for this DDS/DDX object/response
void set_namespace(const string &ns) { d_namespace = ns; }
// TODO Move the response_limit methods to D4ResponseBuilder? jhrg 5/1/13
/// Get the maximum response size, in KB. Zero indicates no limit.
long response_limit() { return d_max_response_size; }
/** Set the maximum response size. Zero is the default value. The size
is given in kilobytes.
@param size The maximum size of the response in kilobytes. */
void set_response_limit(long size) { d_max_response_size = size; }
/// Get the estimated response size, in kilo bytes
long request_size(bool constrained);
/** Return the root group of this Dataset. If no root group has been
* set, use the D4BaseType factory to make it.
* @return The root group of the dataset.
*/
D4Group *root();
void print_dap4(XMLWriter &xml, bool constrained = false);
virtual void dump(ostream &strm) const ;
};
} // namespace libdap
#endif // _dmr_h
|