netcdf-cxx4 icon indicating copy to clipboard operation
netcdf-cxx4 copied to clipboard

Typesafe attribute accessors

Open citibeth opened this issue 9 years ago • 1 comments

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.

citibeth avatar Feb 10 '16 18:02 citibeth

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

firegurafiku avatar May 13 '16 14:05 firegurafiku