26#ifndef _d4attributes_h
27#define _d4attributes_h 1
32#include "D4AttributeType.h"
45 D4AttributeType d_type;
46 bool is_utf8_str =
false;
55 vector<string> d_values;
58 void m_duplicate(
const D4Attribute &src);
64 D4Attribute() : d_name(
""), d_type(attr_null_c), d_attributes(0) {}
65 D4Attribute(
const string &name, D4AttributeType type) : d_name(name), d_type(type), d_attributes(0) {}
67 D4Attribute(
const D4Attribute &src);
69 D4Attribute &operator=(
const D4Attribute &rhs);
71 string name()
const {
return d_name; }
72 void set_name(
const string &name) { d_name = name; }
74 D4AttributeType type()
const {
return d_type; }
75 void set_type(D4AttributeType type) { d_type = type; }
77 bool get_utf8_str_flag()
const {
return is_utf8_str; }
78 void set_utf8_str_flag(
bool utf8_str_flag) { is_utf8_str = utf8_str_flag; }
80 void add_value(
const string &value) { d_values.push_back(value); }
81 void add_value_vector(
const vector<string> &values) { d_values = values; }
83 D4AttributeIter value_begin() {
return d_values.begin(); }
84 D4AttributeIter value_end() {
return d_values.end(); }
86 unsigned int num_values()
const {
return d_values.size(); }
87 string value(
unsigned int i)
const {
return d_values[i]; }
91 bool is_dap4_type(
const std::string &path, std::vector<std::string> &inventory);
95 virtual void dump(ostream &strm)
const;
104 vector<D4Attribute *> d_attrs;
106 void m_duplicate(
const D4Attributes &src) {
107 D4AttributesCIter i = src.d_attrs.begin();
108 while (i != src.d_attrs.end()) {
113 D4Attribute *find_depth_first(
const string &name, D4AttributesIter i);
117 D4Attributes(
const D4Attributes &rhs) { m_duplicate(rhs); }
119 virtual ~D4Attributes() {
120 D4AttributesIter i = d_attrs.begin();
121 while (i != d_attrs.end()) {
126 D4Attributes &operator=(
const D4Attributes &rhs) {
136 bool empty()
const {
return d_attrs.empty(); }
140 void add_attribute_nocopy(
D4Attribute *attr) { d_attrs.push_back(attr); }
150 void erase(
const string &fqn);
158 const vector<D4Attribute *> &
attributes()
const {
return d_attrs; }
160 bool has_dap4_types(
const std::string &path, std::vector<std::string> &inventory)
const;
164 virtual void dump(ostream &strm)
const;
168D4AttributeType StringToD4AttributeType(
string s);
Contains the attributes for a dataset.
bool is_dap4_type(const std::string &path, std::vector< std::string > &inventory)
virtual void dump(ostream &strm) const
dumps information about this object
void erase(const string &fqn)
Erase the given attribute.
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
D4Attribute * get(const string &fqn)
const vector< D4Attribute * > & attributes() const
D4AttributesIter attribute_begin()
Get an iterator to the start of the enumerations.
D4AttributesIter attribute_end()
Get an iterator to the end of the enumerations.
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
virtual void dump(ostream &strm) const
dumps information about this object
void erase_named_attribute(const string &name)
Erase an attribute from a specific container This method expects to find 'name' in the D4Attributes o...
libdap base object for common functionality of libdap objects
top level DAP object to house generic methods
string D4AttributeTypeToString(D4AttributeType at)