libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
libdap::DMR Class Reference

#include <DMR.h>

Inheritance diagram for libdap::DMR:
Inheritance graph

Public Member Functions

virtual void build_using_dds (DDS &dds)
 
int dap_major () const
 
int dap_minor () const
 
std::string dap_version () const
 
 DMR ()
 
 DMR (const DMR &dmr)
 
 DMR (D4BaseTypeFactory *factory, const std::string &name="")
 
 DMR (D4BaseTypeFactory *factory, DDS &dds)
 Build a DMR using a DAP2 DDS. More...
 
std::string dmr_version () const
 
virtual void dump (std::ostream &strm) const
 dumps information about this object More...
 
std::string get_namespace () const
 Get the namespace associated with the DMR. More...
 
virtual DDSgetDDS ()
 Build a DDS from a DMR. More...
 
bool OK () const
 
DMRoperator= (const DMR &rhs)
 
void print_dap4 (XMLWriter &xml, bool constrained=false)
 
long request_size (bool constrained)
 Get the estimated response size, in kilo bytes. More...
 
std::string request_xml_base () const
 Get the URL that will return this DMR. More...
 
long response_limit ()
 Get the maximum response size, in KB. Zero indicates no limit. More...
 
D4Grouproot ()
 
void set_dap_version (const std::string &version_string)
 
void set_dmr_version (const std::string &v)
 
void set_namespace (const std::string &ns)
 Set the namespace for this DMR. More...
 
void set_request_xml_base (const std::string &xb)
 
void set_response_limit (long size)
 
virtual ~DMR ()
 
std::string name () const
 
void set_name (const std::string &n)
 
virtual D4BaseTypeFactoryfactory ()
 
virtual void set_factory (D4BaseTypeFactory *f)
 
std::string filename () const
 
void set_filename (const std::string &fn)
 

Protected Member Functions

void m_duplicate (const DMR &dmr)
 

Friends

class DMRTest
 

Detailed Description

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).

Definition at line 53 of file DMR.h.

Constructor & Destructor Documentation

◆ DMR() [1/4]

libdap::DMR::DMR ( )

Make a DMR which uses the given BaseTypeFactory to create variables.

Note
The default DAP version is 4.0 - use the DDS class to make DAP2 things. The default DMR version is 1.0

Definition at line 182 of file DMR.cc.

◆ DMR() [2/4]

libdap::DMR::DMR ( const DMR rhs)

The DMR copy constructor.

Definition at line 192 of file DMR.cc.

◆ DMR() [3/4]

libdap::DMR::DMR ( D4BaseTypeFactory factory,
const std::string &  name = "" 
)

Make a DMR which uses the given BaseTypeFactory to create variables.

Note
The default DAP version is 4.0 - use the DDS class to make DAP2 things. The default DMR version is 1.0
Parameters
factoryThe D4BaseTypeFactory to use when creating instances of DAP4 variables. The caller must ensure the factory's lifetime is at least that of the DMR instance.
nameThe name of the DMR - usually derived from the name of the pathname or table name of the dataset.

Definition at line 120 of file DMR.cc.

◆ DMR() [4/4]

libdap::DMR::DMR ( D4BaseTypeFactory factory,
DDS dds 
)

Build a DMR using a DAP2 DDS.

Given a DDS from code written for DAP2, build a DAP4 DMR object. This works because DAP4 subsumes DAP2, but there are a few quirks... For each variable in the DDS, transform it to the equivalent DAP4 variable type and then copy the variable's attributes. Most types convert easily. Types that need special treatment are: Array: DAP2 array dimensions must be morphed to DAP4 Sequence: Make a D4Sequence Grid: Make a coverage; assume Grids with the same dimension names have 'shared dimensions' and that maps with the same names are shared too.

Note
Assume that a DDS has only a root group. This is not actually true for a DDS from the HDF5 handler, because it has Groups encoded into the variable names. jhrg 3/18/14
Parameters
factoryFactory class used to make new variables
ddsGet the variables to convert from this DAP2 DDS.
See also
BaseType::transform_to_dap4()

Definition at line 150 of file DMR.cc.

◆ ~DMR()

libdap::DMR::~DMR ( )
virtual

Delete a DMR. The BaseType factory is not freed, while the contained group is.

Definition at line 200 of file DMR.cc.

Member Function Documentation

◆ build_using_dds()

void libdap::DMR::build_using_dds ( DDS dds)
virtual

If we have a DDS that includes Attributes, use it to build the DMR. This will copy all of the variables in the DDS into the DMR using BaseType::transform_to_dap4(), so the actual types added can be controlled by code that specializes the various type classes.

Parameters
ddsRead variables and Attributes from this DDS

Definition at line 226 of file DMR.cc.

◆ dump()

void libdap::DMR::dump ( std::ostream &  strm) const
virtual

dumps information about this object

Displays the pointer value of this instance and then calls parent dump

Parameters
strmC++ i/o stream to dump the information to
Returns
void

Implements libdap::DapObj.

Definition at line 531 of file DMR.cc.

◆ factory()

virtual D4BaseTypeFactory* libdap::DMR::factory ( )
inlinevirtual

Get/set the factory which makes instances of the variables. Specialize D4BaseTypeFactory so that a DMR will be populated with your client's or server's specialized types.

Definition at line 123 of file DMR.h.

◆ filename()

std::string libdap::DMR::filename ( ) const
inline

get/set the dataset's 'filename.' The filename is a string that can be used to access the dataset via some data store (it's usually a pathname to a file, but it might be a database key).

Definition at line 132 of file DMR.h.

◆ get_namespace()

std::string libdap::DMR::get_namespace ( ) const
inline

Get the namespace associated with the DMR.

Definition at line 151 of file DMR.h.

◆ getDDS()

DDS * libdap::DMR::getDDS ( )
virtual

Build a DDS from a DMR.

Build a DDS from a DMR, collapsing DAP4 Groups, transforming Arrays to Grids as needed, and moving the attributes around to match the new variables. All of the variables in the returned DDS object are newly allocated with separate lifetimes from the objects in the DMR. They are made using ptr_duplicate() so that all of the variables mirror specializations for the various types. That is, if the HDF5 handler built the DMR, then the resulting DDS will hold instances of H5Int32, etc.

Note
The caller is responsible for deleting the resulting DDS object.
Returns
A pointer to the newly allocated DDS.

Definition at line 371 of file DMR.cc.

◆ name()

std::string libdap::DMR::name ( ) const
inline

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.

Definition at line 115 of file DMR.h.

◆ OK()

bool libdap::DMR::OK ( ) const
inline

Class invariant. If true, any method can be used.

Returns
True if the instance is OK to use, false otherwise.

Definition at line 107 of file DMR.h.

◆ print_dap4()

void libdap::DMR::print_dap4 ( XMLWriter xml,
bool  constrained = false 
)

Print the DAP4 DMR object.

Parameters
xmluse this XMLWriter to build the XML.
constrainedShould the DMR be subject to a constraint? Defaults to False

Definition at line 478 of file DMR.cc.

◆ request_size()

long libdap::DMR::request_size ( bool  constrained)

Get the estimated response size, in kilo bytes.

Get the size of a response, in kilobytes. This method looks at the variables in the DMR a computes the number of bytes in the response.

Note
This version of the method does a poor job with Arrays that have varying dimensions.
Parameters
constrainedShould the size of the whole DMR be used or should the current constraint be taken into account?
Returns
The size of the request in kilobytes

Definition at line 465 of file DMR.cc.

◆ request_xml_base()

std::string libdap::DMR::request_xml_base ( ) const
inline

Get the URL that will return this DMR.

Definition at line 145 of file DMR.h.

◆ response_limit()

long libdap::DMR::response_limit ( )
inline

Get the maximum response size, in KB. Zero indicates no limit.

Definition at line 158 of file DMR.h.

◆ root()

D4Group * libdap::DMR::root ( )

Return the root group of this Dataset. If no root group has been set, use the D4BaseType factory to make it.

Returns
The root group of the dataset.

Get the root group for this DMR. This accessor allocates the root group if one does not exist using the factory class bound to this DMR

Returns
A pointer to the root group.

Definition at line 407 of file DMR.cc.

◆ set_dap_version()

void libdap::DMR::set_dap_version ( const std::string &  version_string)

Given the DAP protocol version, parse that string and set the DMR fields.

Parameters
vThe version string.

Definition at line 419 of file DMR.cc.

◆ set_namespace()

void libdap::DMR::set_namespace ( const std::string &  ns)
inline

Set the namespace for this DMR.

Definition at line 154 of file DMR.h.

◆ set_request_xml_base()

void libdap::DMR::set_request_xml_base ( const std::string &  xb)
inline
See also
get_request_xml_base

Definition at line 148 of file DMR.h.

◆ set_response_limit()

void libdap::DMR::set_response_limit ( long  size)
inline

Set the maximum response size. Zero is the default value. The size is given in kilobytes.

Parameters
sizeThe maximum size of the response in kilobytes.

Definition at line 163 of file DMR.h.


The documentation for this class was generated from the following files: