libdap::D4Map Class Reference

`#include <D4Maps.h>`

## Public Member Functions

const std::string & | get_array_path () const
const string & | name () const
virtual void | print_dap4 (XMLWriter &xml)
void | set_array (Array *array)
void | set_array_path (const std::string &array)
void | set_name (const string &name)
| D4Map (std::string name, Array *array)
| D4Map (std::string name, Array *array, BaseType *)
| D4Map (std::string name, std::string array)
Array * | array (D4Group *root)
| This will always return the correct pointer for a valid data set.
Array * | array () const
| Only use this accessor in code that can deal with a nullptr return!

## Detailed Description

A 'Map' in DAP4 is an Array in the dataset that is used to provide the domain values for a Coverage (aka a DAP2 Grid). These Maps are a more general case of the DAP2 'Map vectors' because a DAP4 Map can have N dimensions.

Because the Maps can be shared by many of the Arrays in a dataset, they also correspond to the NetCDF/CF notion of a Shared Dimension.

In this implementation of the D4Map, each Map has a name and two weak pointers, one to the Array that holds the domain values and one to the Array that uses the Map. Note that while Maps can be shared by Arrays, each Array has it's own collection of these D4Map objects. This makes processing constraints possible (because it is possible to write different constraints for two arrays that share Maps).

Second try. Including these 'weak' pointers lead to a paradox because the pointers don't exist when making deep copies of the Array. In that case the parent and source Array (the array that holds the Map's data) cannot be found because the Array that holds the Maps does not yet exist. It's being copied and the source object holds pointers to objects that are not reliable - the source Array is being copied because it's maybe going to be deleted!

I removed the parent pointer from the D4Map object and added a pathname to the source Array. So, now we can set either the weak pointer to the source array or the pathname to the source array. The former is used when building the Array (as would be done in a handler) and the latter is used during a deep copy (where even though the pointer to the source Array will soon be invalid, the pathname won't be).

Definition at line 71 of file D4Maps.h.

## Constructor & Destructor Documentation

## D4Map() [1/3]

libdap::D4Map::D4Map | ( | std::string | name,
|  | Array * | array )

inline

Special constructors for object creation and deep copy

Definition at line 80 of file D4Maps.h.

## D4Map() [2/3]

libdap::D4Map::D4Map | ( | std::string | name,
|  | Array * | array,
|  | BaseType * | )

inline

This ctor mimics older behavior - the parent arg is ignored now.

Deprecated

Definition at line 83 of file D4Maps.h.

## D4Map() [3/3]

libdap::D4Map::D4Map | ( | std::string | name,
|  | std::string | array )

inline

Definition at line 84 of file D4Maps.h.

## Member Function Documentation

## array() [1/2]

Array * libdap::D4Map::array | ( |  | ) | const

inline

Only use this accessor in code that can deal with a nullptr return!

Definition at line 101 of file D4Maps.h.

## array() [2/2]

Array * D4Map::array | ( | D4Group * | root | ) |

This will always return the correct pointer for a valid data set.

Ways to get the Array that holds a Map's values.

Definition at line 36 of file D4Maps.cc.

## get_array_path()

const std::string & libdap::D4Map::get_array_path | ( |  | ) | const

inline

Definition at line 91 of file D4Maps.h.

## name()

const string & libdap::D4Map::name | ( |  | ) | const

inline

Definition at line 88 of file D4Maps.h.

## print_dap4()

void D4Map::print_dap4 | ( | XMLWriter & | xml | ) |

virtual

Definition at line 47 of file D4Maps.cc.

## set_array()

void libdap::D4Map::set_array | ( | Array * | array | ) |

inline

Definition at line 104 of file D4Maps.h.

## set_array_path()

void libdap::D4Map::set_array_path | ( | const std::string & | array | ) |

inline

Note
  We can set the path even if the referenced Array does not yet exist!

Definition at line 93 of file D4Maps.h.

## set_name()

void libdap::D4Map::set_name | ( | const string & | name | ) |

inline

Definition at line 89 of file D4Maps.h.

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

- D4Maps.h
- D4Maps.cc