105AttrType String_to_AttrType(
const string &s);
167 bool is_utf8_str =
false;
171 AttrTable *attributes;
172 std::vector<string> *attr;
175 : name(
""), type(Attr_unknown), is_alias(
false), aliased_to(
""), is_global(
true), attributes(0), attr(0) {}
177 entry(
const entry &rhs)
178 : name(rhs.name), type(rhs.type), is_alias(rhs.is_alias), aliased_to(rhs.aliased_to),
179 is_global(rhs.is_global), attributes(0), attr(0) {
183 void delete_entry() {
186 if (type == Attr_container) {
195 virtual ~entry() { delete_entry(); }
197 void clone(
const entry &rhs) {
201 is_alias = rhs.is_alias;
202 aliased_to = rhs.aliased_to;
203 is_global = rhs.is_global;
208 case Attr_container: {
210 attributes = rhs.attributes;
212 attributes =
new AttrTable(*rhs.attributes);
219 attr =
new std::vector<string>(*rhs.attr);
225 entry &operator=(
const entry &rhs) {
239 bool is_dap4_type(
const std::string &path, std::vector<std::string> &inventory)
const {
240 bool ima_d4_attr =
false;
248 ima_d4_attr = attributes->has_dap4_types(path, inventory);
257 typedef std::vector<entry *>::const_iterator Attr_citer;
258 typedef std::vector<entry *>::iterator Attr_iter;
263 std::vector<entry *> attr_map;
271 bool d_is_global_attribute;
273 void delete_attr_table();
275 friend class AttrTableTest;
280 void simple_print(FILE *out,
string pad, Attr_iter i,
bool dereference);
281 void simple_print(ostream &out,
string pad, Attr_iter i,
bool dereference);
289 virtual void erase();
291 virtual unsigned int get_size()
const;
293 virtual void set_name(
const string &n);
300 virtual bool is_global_attribute()
const {
return d_is_global_attribute; }
301 virtual void set_is_global_attribute(
bool ga) { d_is_global_attribute = ga; }
303 virtual unsigned int append_attr(
const string &name,
const string &type,
const string &value);
304 virtual unsigned int append_attr(
const string &name,
const string &type, vector<string> *values);
305 virtual unsigned int append_attr(
const string &name,
const string &type,
const string &value,
bool is_utf8_str);
306 virtual unsigned int append_attr(
const string &name,
const string &type, vector<string> *values,
bool is_utf8_str);
311 virtual void find(
const string &target, AttrTable **at, Attr_iter *iter);
313 virtual AttrTable *
recurrsive_find(
const string &target, Attr_iter *location);
316 AttrTable *simple_find_container(
const string &target);
319 virtual string get_type(
const string &name);
322 virtual string get_attr(
const string &name,
unsigned int i = 0);
324 virtual void del_attr(
const string &name,
int i = -1);
329 virtual string get_name(Attr_iter iter);
333 virtual string get_type(Attr_iter iter);
336 virtual string get_attr(Attr_iter iter,
unsigned int i = 0);
338 virtual bool is_global_attribute(Attr_iter iter);
339 virtual void set_is_global_attribute(Attr_iter iter,
bool ga);
342 virtual void add_value_alias(AttrTable *at,
const string &name,
const string &source);
343 virtual bool attr_alias(
const string &alias, AttrTable *at,
const string &name);
344 virtual bool attr_alias(
const string &alias,
const string &name);
346 bool has_dap4_types(
const std::string &path, std::vector<std::string> &inventory)
const;
347 bool is_dap4_type(
const std::string &path, std::vector<std::string> &inventory)
const;
349 virtual void print(FILE *out,
string pad =
" ",
bool dereference =
false);
350 virtual void print(ostream &out,
string pad =
" ",
bool dereference =
false);
352 virtual void print_xml(FILE *out,
string pad =
" ",
bool constrained =
false);
353 virtual void print_xml(ostream &out,
string pad =
" ",
bool constrained =
false);
359 virtual void dump(ostream &strm)
const;
Contains the attributes for a dataset.
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
void simple_print(FILE *out, string pad, Attr_iter i, bool dereference)
virtual unsigned int get_attr_num(const string &name)
Get the number of attributes in this container.
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
virtual bool attr_alias(const string &alias, AttrTable *at, const string &name)
Adds an alias to the set of attributes.
virtual bool is_container(Attr_iter iter)
virtual void find(const string &target, AttrTable **at, Attr_iter *iter)
virtual void set_name(const string &n)
Set the name of this attribute table.
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
void clone(const AttrTable &at)
virtual Attr_iter attr_end()
virtual void print_xml(FILE *out, string pad=" ", bool constrained=false)
virtual AttrTable * get_parent() const
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
virtual void add_value_alias(AttrTable *at, const string &name, const string &source)
Add an alias for an attribute.
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
virtual Attr_iter attr_begin()
virtual Attr_iter get_attr_iter(int i)
void print_dap4(XMLWriter &xml)
virtual void del_attr(const string &name, int i=-1)
Deletes an attribute.
virtual string get_name() const
Get the name of this attribute table.
virtual void erase()
Erase the attribute table.
void print_xml_writer(XMLWriter &xml)
virtual Attr_iter del_attr_table(Attr_iter iter)
virtual void print(FILE *out, string pad=" ", bool dereference=false)
Prints the attribute table.
virtual void add_container_alias(const string &name, AttrTable *src)
Add an alias to a container held by this attribute table.
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
virtual void dump(ostream &strm) const
dumps information about this object
virtual AttrTable * find_container(const string &target)
Find an attribute with a given name.
Attr_iter simple_find(const string &target)
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
virtual AttrTable * recurrsive_find(const string &target, Attr_iter *location)
libdap base object for common functionality of libdap objects
top level DAP object to house generic methods
string add_space_encoding(const string &s)
string AttrType_to_String(const AttrType at)
string remove_space_encoding(const string &s)
bool is_dap4_type(const std::string &path, std::vector< std::string > &inventory) const