26 #ifndef _d4attributes_h 27 #define _d4attributes_h 1 33 #include "D4AttributeType.h" 34 #include "XMLWriter.h" 46 D4AttributeType d_type;
55 vector<string> d_values;
61 typedef vector<string>::iterator D4AttributeIter;
62 typedef vector<string>::const_iterator D4AttributeCIter;
64 D4Attribute() : d_name(
""), d_type(attr_null_c), d_attributes(0) {}
65 D4Attribute(
const string &name, D4AttributeType type)
66 : d_name(name), d_type(type), d_attributes(0) {}
72 string name()
const {
return d_name; }
73 void set_name(
const string &name) { d_name = name; }
75 D4AttributeType type()
const {
return d_type; }
76 void set_type(D4AttributeType type) { d_type = type; }
78 void add_value(
const string &value) { d_values.push_back(value); }
79 void add_value_vector(
const vector<string> &values) { d_values = values; }
81 D4AttributeIter value_begin() {
return d_values.begin(); }
82 D4AttributeIter value_end() {
return d_values.end(); }
84 unsigned int num_values()
const {
return d_values.size(); }
85 string value(
unsigned int i)
const {
return d_values[i]; }
91 virtual void dump(ostream &strm)
const;
96 typedef vector<D4Attribute*>::iterator D4AttributesIter;
97 typedef vector<D4Attribute*>::const_iterator D4AttributesCIter;
100 vector<D4Attribute*> d_attrs;
103 D4AttributesCIter i = src.d_attrs.begin();
104 while (i != src.d_attrs.end()) {
109 D4Attribute *find_depth_first(
const string &name, D4AttributesIter i);
119 D4AttributesIter i = d_attrs.begin();
120 while(i != d_attrs.end()) {
126 if (
this == &rhs)
return *
this;
132 void transform_attrs_to_dap2(
AttrTable *d2_attr_table);
136 AttrTable *get_AttrTable(
const std::string name);
140 bool empty()
const {
return d_attrs.empty(); }
147 d_attrs.push_back(attr);
166 virtual void dump(ostream &strm)
const;
170 D4AttributeType StringToD4AttributeType(
string s);
174 #endif // _d4attributes_h
D4AttributesIter attribute_begin()
Get an iterator to the start of the enumerations.
Contains the attributes for a dataset.
top level DAP object to house generic methods
libdap base object for common functionality of libdap objects
D4AttributesIter attribute_end()
Get an iterator to the end of the enumerations.
string D4AttributeTypeToString(D4AttributeType at)