75void DAS::duplicate(
const DAS &src) {
78 d_container =
new AttrTable(*src.d_container);
82 d_container_name = src.d_container_name;
83 d_attrs = src.d_attrs;
102 if (cn != d_container_name) {
110 d_container_name = cn;
122 return d_container->get_size();
124 return d_attrs.get_size();
131 d_container->erase();
141 return d_container->attr_begin();
143 return d_attrs.attr_begin();
151 return d_container->attr_end();
153 return d_attrs.attr_end();
160 return d_container->get_name(i);
162 return d_attrs.get_name(i);
169 return d_container->get_attr_table(i);
178 return d_container->get_attr_table(name);
196 return d_container->append_container(at, name);
214 FILE *in = fopen(fname.c_str(),
"r");
222 int res = fclose(in);
224 DBG(cerr <<
"DAS::parse - Failed to close file " << (
void *)in << endl;);
240 int new_fd = _dup(fd);
242 int new_fd = dup(fd);
246 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
247 FILE *in = fdopen(new_fd,
"r");
250 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
255 int res = fclose(in);
257 DBG(cerr <<
"DAS::parse(fd) - Failed to close " << (
void *)in << endl;);
269 throw InternalErr(__FILE__, __LINE__,
"Null input stream.");
284 if (!status || !arg.
status()) {
305 fprintf(out,
"Attributes {\n");
307 d_attrs.print(out,
" ", dereference);
325 out <<
"Attributes {\n";
327 d_attrs.print(out,
" ", dereference);
343 strm <<
DapIndent::LMarg <<
"current container: " << d_container_name << endl;
int dasparse(libdap::parser_arg *arg)
void das_switch_to_buffer(void *new_buffer)
void * das_buffer(FILE *fp)
void das_delete_buffer(void *buffer)
#define cannot_read_file
(400)
Contains the attributes for a dataset.
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
virtual void set_is_global_attribute(bool ga)
std::vector< entry * >::iterator Attr_iter
AttrTable::Attr_iter var_begin()
Returns a reference to the attribute table for the first variable.
DAS & operator=(const DAS &rhs)
virtual unsigned int get_size() const
Returns the number of attributes in the current attribute table.
virtual AttrTable * add_table(const string &name, AttrTable *at)
Adds a variable attribute table to the DAS or the current dataset container attribute table.
virtual void print(FILE *out, bool dereference=false)
virtual void dump(ostream &strm) const
dumps information about this object
AttrTable::Attr_iter var_end()
virtual void parse(string fname)
Reads a DAS from the named file.
AttrTable * get_table(AttrTable::Attr_iter &i)
Returns the referenced variable attribute table.
virtual void erase()
erase all attributes in this DAS
string get_name(AttrTable::Attr_iter &i)
Returns the name of the referenced variable attribute table.
virtual string container_name() const
Returns the name of the current attribute container when multiple files used to build this DAS.
static ostream & LMarg(ostream &strm)
A class for error processing.
A class for software fault reporting.
top level DAP object to house generic methods
Pass parameters by reference to a parser.