Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

Typesafe attribute accessors #29

Open citibeth opened 8 years ago

citibeth commented 8 years ago

class NcAtt needs modern typesafe ways to retrieve attribute values. This is especially true for retrieving multiple (vector) valued strings.

The following methods should be included:

    getValue(TypeT &)      // Retrieves the first value
    getValues(std::vector<TypeT> &)     // Retrieves all values

"getValues"(string) makes no sense: it retrieves a single value, not all values.

firegurafiku commented 8 years ago

Why std::vector should be preffered over anything else? It may be worth to also consider adding iterator-based overload, like:

template <typename OutputIterator>
void getValues(OutputIterator first, size_t count);