libdap::DMR Class Reference

`#include <DMR.h>`

Inheritance diagram for libdap::DMR:

## 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...
virtual D4BaseTypeFactory * | factory ()
std::string | filename () const
bool | get_ce_empty () const
| Get the flag that marks the expression constraint as empty. More...
std::string | get_namespace () const
| Get the namespace associated with the DMR. More...
virtual DDS * | getDDS ()
| Build a DDS from a DMR. More...
std::string | name () const
bool | OK () const
DMR & | operator= (const DMR &rhs)
void | print_dap4 (XMLWriter &xml, bool constrained=false)
long | request_size (bool constrained)
| Get the estimated response size, in kilobytes. More...
uint64_t | request_size_kb (bool constrained)
| Get the estimated response size, in kilobytes. More...
std::string | request_xml_base () const
| Get the URL that will return this DMR. More...
long | response_limit () const
| Get the maximum response size, in KB. Zero indicates no limit. More...
uint64_t | response_limit_kb () const
| Get the maximum response size, in KB. Zero indicates no limit. More...
D4Group * | root ()
void | set_ce_empty (bool ce_empty)
| Set the flag that marks the expression constraint as empty. More...
void | set_dap_version (const std::string &version_string)
void | set_dmr_version (const std::string &v)
virtual void | set_factory (D4BaseTypeFactory *f)
void | set_filename (const std::string &fn)
void | set_name (const std::string &n)
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)
void | set_response_limit_kb (const uint64_t &size)
bool | too_big ()
virtual | ~DMR ()

## 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 54 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 185 of file DMR.cc.

## DMR() [2/4]

libdap::DMR::DMR | ( | const DMR & | rhs | ) |

The DMR copy constructor.

Definition at line 195 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

  factory | The 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.
  name | The name of the DMR - usually derived from the name of the pathname or table name of the dataset.

Definition at line 122 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

  factory | Factory class used to make new variables
  dds | Get the variables to convert from this DAP2 DDS.

See also
  BaseType::transform_to_dap4()

Definition at line 153 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 203 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

  dds | Read variables and Attributes from this DDS

Definition at line 229 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

  strm | C++ i/o stream to dump the information to

Returns
  void

Implements libdap::DapObj.

Definition at line 552 of file DMR.cc.

## factory()

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

inline virtual

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 127 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 136 of file DMR.h.

## get_ce_empty()

bool libdap::DMR::get_ce_empty | ( |  | ) | const

inline

Get the flag that marks the expression constraint as empty.

Definition at line 220 of file DMR.h.

## get_namespace()

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

inline

Get the namespace associated with the DMR.

Definition at line 155 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 374 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 119 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 111 of file DMR.h.

## print_dap4()

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

Print the DAP4 DMR object.

Parameters

  xml | use this XMLWriter to build the XML.
  constrained | Should the DMR be subject to a constraint? Defaults to False

Definition at line 499 of file DMR.cc.

## request_size()

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

Get the estimated response size, in kilobytes.

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

  constrained | Should 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 468 of file DMR.cc.

## request_size_kb()

uint64_t libdap::DMR::request_size_kb | ( | bool | constrained | ) |

Get the estimated response size, in kilobytes.

Compute the estimated response size, in kilobytes.

Parameters

  constrained |

Returns
  The estimated response size, in kilobytes.

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

  constrained | Should 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 483 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 149 of file DMR.h.

## response_limit()

long libdap::DMR::response_limit | ( |  | ) | const

inline

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

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

Returns
  The maximum allowable response size. A value of 0 means there is no limit (default).

Definition at line 168 of file DMR.h.

## response_limit_kb()

uint64_t libdap::DMR::response_limit_kb | ( |  | ) | const

inline

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

Returns
  The maximum allowable response size. A value of 0 means there is no limit (default).

Definition at line 175 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 410 of file DMR.cc.

## set_ce_empty()

void libdap::DMR::set_ce_empty | ( | bool | ce_empty | ) |

inline

Set the flag that marks the expression constraint as empty.

Definition at line 217 of file DMR.h.

## 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

  v | The version string.

Definition at line 422 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 158 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 152 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

  size | The maximum size of the response in kilobytes.

Definition at line 183 of file DMR.h.

## set_response_limit_kb()

void libdap::DMR::set_response_limit_kb | ( | const uint64_t & | size | ) |

inline

Set the maximum response size. Zero is the default value and indicates there is no limit. The size is given in kilobytes.

Parameters

  size | The maximum size of the response in kilobytes.

Definition at line 192 of file DMR.h.

## too_big()

bool libdap::DMR::too_big | ( |  | ) |

inline

Returns
  Returns true if the total data bytes requested exceeds the set limit, false otherwise.

Definition at line 211 of file DMR.h.

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

- DMR.h
- DMR.cc