libdap++  Updated for version 3.14.0
libdap::DMR Class Reference

#include <DMR.h>

Inheritance diagram for libdap::DMR:
Inheritance graph
Collaboration diagram for libdap::DMR:
Collaboration graph

Public Member Functions

virtual void build_using_dds (DDS &dds)
 
int dap_major () const
 
int dap_minor () const
 
string dap_version () const
 
 DMR ()
 
 DMR (const DMR &dmr)
 
 DMR (D4BaseTypeFactory *factory, const string &name="")
 
 DMR (D4BaseTypeFactory *factory, DDS &dds)
 Build a DMR using a DAP2 DDS. More...
 
string dmr_version () const
 
virtual void dump (ostream &strm) const
 dumps information about this object More...
 
string get_namespace () const
 Get the namespace associated with the DDS - likely set only by DDX responses. 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...
 
string request_xml_base () const
 Get the URL that will return this DMR/DDX/DataThing. More...
 
long response_limit ()
 Get the maximum response size, in KB. Zero indicates no limit. More...
 
D4Grouproot ()
 
void set_dap_version (const string &version_string)
 
void set_dmr_version (const string &v)
 
void set_namespace (const string &ns)
 Set the namespace for this DDS/DDX object/response. More...
 
void set_request_xml_base (const string &xb)
 
void set_response_limit (long size)
 
virtual ~DMR ()
 
string name () const
 
void set_name (const string &n)
 
virtual D4BaseTypeFactoryfactory ()
 
virtual void set_factory (D4BaseTypeFactory *f)
 
string filename () const
 
void set_filename (const 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 55 of file DMR.h.

Constructor & Destructor Documentation

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 180 of file DMR.cc.

References set_dap_version().

Here is the call graph for this function:

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

The DMR copy constructor.

Definition at line 190 of file DMR.cc.

References m_duplicate().

Here is the call graph for this function:

libdap::DMR::DMR ( D4BaseTypeFactory factory,
const 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 118 of file DMR.cc.

References set_dap_version().

Here is the call graph for this function:

libdap::DMR::DMR ( D4BaseTypeFactory factory,
DDS 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 148 of file DMR.cc.

References libdap::Constructor::add_var_nocopy(), libdap::BaseType::attributes(), build_using_dds(), libdap::DDS::get_attr_table(), root(), set_dap_version(), libdap::D4Attributes::transform_to_dap4(), libdap::BaseType::transform_to_dap4(), libdap::DDS::var_begin(), and libdap::DDS::var_end().

Here is the call graph for this function:

libdap::DMR::~DMR ( )
virtual

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

Definition at line 198 of file DMR.cc.

Member Function Documentation

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 224 of file DMR.cc.

References libdap::Constructor::add_var_nocopy(), libdap::BaseType::attributes(), libdap::DDS::filename(), libdap::DDS::get_attr_table(), libdap::DDS::get_dataset_name(), root(), set_filename(), set_name(), libdap::D4Attributes::transform_to_dap4(), libdap::BaseType::transform_to_dap4(), libdap::DDS::var_begin(), and libdap::DDS::var_end().

Referenced by DMR().

Here is the call graph for this function:

int libdap::DMR::dap_major ( ) const
inline

Definition at line 142 of file DMR.h.

int libdap::DMR::dap_minor ( ) const
inline

Definition at line 143 of file DMR.h.

string libdap::DMR::dap_version ( ) const
inline
string libdap::DMR::dmr_version ( ) const
inline

Definition at line 145 of file DMR.h.

Referenced by print_dap4().

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

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 367 of file DMR.cc.

References libdap::DapIndent::Indent(), libdap::DapIndent::LMarg(), and libdap::DapIndent::UnIndent().

Here is the call graph for this function:

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 or server's specialized types.

Definition at line 125 of file DMR.h.

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's actual data store (it's usually a pathname to a file, but it might be a database key.

Todo:
Move this to Group?

Definition at line 136 of file DMR.h.

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

Definition at line 155 of file DMR.h.

Referenced by print_dap4().

void libdap::DMR::m_duplicate ( const DMR dmr)
protected

Definition at line 76 of file DMR.cc.

References DBG, OK(), and libdap::D4Group::ptr_duplicate().

Referenced by DMR(), and operator=().

Here is the call graph for this function:

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

Referenced by print_dap4().

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

Referenced by m_duplicate().

DMR & libdap::DMR::operator= ( const DMR rhs)

Definition at line 206 of file DMR.cc.

References m_duplicate().

Here is the call graph for this function:

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 314 of file DMR.cc.

References c_dap_40_n_sl, c_xml_namespace, c_xml_xsi, dap_version(), dmr_version(), get_namespace(), libdap::XMLWriter::get_writer(), name(), libdap::D4Group::print_dap4(), request_xml_base(), and root().

Referenced by main().

Here is the call graph for this function:

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

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 301 of file DMR.cc.

References libdap::D4Group::request_size().

Here is the call graph for this function:

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

Definition at line 149 of file DMR.h.

Referenced by print_dap4().

long libdap::DMR::response_limit ( )
inline

Definition at line 162 of file DMR.h.

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.

Definition at line 243 of file DMR.cc.

References libdap::dods_group_c, and libdap::D4BaseTypeFactory::NewVariable().

Referenced by build_using_dds(), DMR(), libdap::D4ParserSax2::dmr_start_document(), libdap::D4ParserSax2::dmr_start_element(), print_dap4(), and libdap::D4Connect::request_dap4_data().

Here is the call graph for this function:

void libdap::DMR::set_dap_version ( const string &  v)

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

Parameters
vThe version string.

Definition at line 255 of file DMR.cc.

References c_dap40_namespace.

Referenced by DMR(), and libdap::D4ParserSax2::dmr_start_element().

void libdap::DMR::set_dmr_version ( const string &  v)
inline

Definition at line 146 of file DMR.h.

Referenced by libdap::D4ParserSax2::dmr_start_element().

virtual void libdap::DMR::set_factory ( D4BaseTypeFactory f)
inlinevirtual

Definition at line 126 of file DMR.h.

void libdap::DMR::set_filename ( const string &  fn)
inline

Definition at line 137 of file DMR.h.

Referenced by build_using_dds().

void libdap::DMR::set_name ( const string &  n)
inline

Definition at line 118 of file DMR.h.

Referenced by build_using_dds(), and libdap::D4ParserSax2::dmr_start_element().

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

Definition at line 158 of file DMR.h.

Referenced by libdap::D4ParserSax2::dmr_start_element().

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

Definition at line 152 of file DMR.h.

Referenced by libdap::D4ParserSax2::dmr_start_element().

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

Friends And Related Function Documentation

friend class DMRTest
friend

Definition at line 87 of file DMR.h.


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