73#include "InternalErr.h"
84const string c_xml_xsi =
"http://www.w3.org/2001/XMLSchema-instance";
85const string c_xml_namespace =
"http://www.w3.org/XML/1998/namespace";
87const string grddl_transformation_dap32 =
"http://xml.opendap.org/transforms/ddxToRdfTriples.xsl";
89const string c_default_dap20_schema_location =
"http://xml.opendap.org/dap/dap2.xsd";
90const string c_default_dap32_schema_location =
"http://xml.opendap.org/dap/dap3.2.xsd";
91const string c_default_dap40_schema_location =
"http://xml.opendap.org/dap/dap4.0.xsd";
93const string c_dap20_namespace =
"http://xml.opendap.org/ns/DAP2";
94const string c_dap32_namespace =
"http://xml.opendap.org/ns/DAP/3.2#";
95const string c_dap40_namespace =
"http://xml.opendap.org/ns/DAP/4.0#";
97const string c_dap_20_n_sl = c_dap20_namespace +
" " + c_default_dap20_schema_location;
98const string c_dap_32_n_sl = c_dap32_namespace +
" " + c_default_dap32_schema_location;
99const string c_dap_40_n_sl = c_dap40_namespace +
" " + c_default_dap40_schema_location;
104const string TOP_LEVEL_ATTRS_CONTAINER_NAME =
"DAP4_GLOBAL";
111void dds_switch_to_buffer(
void *new_buffer);
112void dds_delete_buffer(
void *buffer);
113void *dds_buffer(FILE *fp);
117void DDS::duplicate(
const DDS &dds) {
118 DBG(cerr <<
"Entering DDS::duplicate... " << endl);
120 d_factory = dds.d_factory;
123 d_filename = dds.d_filename;
124 d_container_name = dds.d_container_name;
125 d_container = dds.d_container;
127 d_dap_major = dds.d_dap_major;
128 d_dap_minor = dds.d_dap_minor;
130 d_dap_version = dds.d_dap_version;
131 d_request_xml_base = dds.d_request_xml_base;
132 d_namespace = dds.d_namespace;
136 DDS &dds_tmp =
const_cast<DDS &
>(dds);
139 for (Vars_iter i = dds_tmp.var_begin(); i != dds_tmp.var_end(); i++) {
143 d_timeout = dds.d_timeout;
145 d_max_response_size_kb = dds.d_max_response_size_kb;
161 : d_factory(factory), d_name(name), d_container_name(
""), d_container(0), d_request_xml_base(
""), d_timeout(0),
162 d_max_response_size_kb(0) {
163 DBG(cerr <<
"Building a DDS for the default version (2.0)" << endl);
186 : d_factory(factory), d_name(name), d_container_name(
""), d_container(0), d_request_xml_base(
""), d_timeout(0),
187 d_max_response_size_kb(0) {
188 DBG(cerr <<
"Building a DDS for version: " << version << endl);
197 DBG(cerr <<
"Entering DDS(const DDS &rhs) ..." << endl);
199 DBG(cerr <<
" bye." << endl);
204 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
211DDS &DDS::operator=(
const DDS &rhs) {
238 "Error transferring attributes: working on a container in dds, but not das");
244 (*i)->transfer_attributes(top);
250 if ((*i)->type == Attr_container && (*i)->attributes->is_global_attribute()) {
254 d_attr.append_container(at, at->
get_name());
303 if (d_dap_minor >= 0) {
305 oss << d_dap_major <<
"." << d_dap_minor;
306 d_dap_version = oss.str();
316 if (d_dap_major >= 0) {
318 oss << d_dap_major <<
"." << d_dap_minor;
319 d_dap_version = oss.str();
329 istringstream iss(v);
331 int major = -1, minor = -1;
333 if (!iss.eof() && !iss.fail())
335 if (!iss.eof() && !iss.fail())
337 if (!iss.eof() && !iss.fail())
340 if (major == -1 || minor == -1 or dot !=
'.')
341 throw InternalErr(__FILE__, __LINE__,
"Could not parse dap version. Value given: " + v);
352 switch (d_dap_major) {
354 d_namespace = c_dap20_namespace;
357 d_namespace = c_dap32_namespace;
360 d_namespace = c_dap40_namespace;
363 throw InternalErr(__FILE__, __LINE__,
"Unknown DAP version.");
375 int major = floor(d);
376 int minor = (d - major) * 10;
378 DBG(cerr <<
"Major: " << major <<
", Minor: " << minor << endl);
381 oss << major <<
"." << minor;
418 d_container_name = cn;
440 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
443 w += (*i)->width(constrained);
445 w += (*i)->width(constrained);
464 uint64_t req_size = 0;
465 for (
auto &btp : vars) {
468 req_size += btp->width_ll(constrained);
470 req_size += btp->width_ll(constrained);
474 return req_size / 1024;
484 throw InternalErr(__FILE__, __LINE__,
"Trying to add a BaseType object with a NULL pointer.");
486 DBG2(cerr <<
"In DDS::add_var(), bt's address is: " << bt << endl);
489 DBG2(cerr <<
"In DDS::add_var(), btp's address is: " << btp << endl);
493 d_container->add_var(bt);
506 throw InternalErr(__FILE__, __LINE__,
"Trying to add a BaseType object with a NULL pointer.");
508 DBG2(cerr <<
"In DDS::add_var(), bt's address is: " << bt << endl);
511 d_container->add_var_nocopy(bt);
525 d_container->del_var(n);
529 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
530 if ((*i)->name() == n) {
545 if (i != vars.end()) {
560 for (Vars_iter i_tmp = i1; i_tmp != i2; i_tmp++) {
599 return d_container->var(name,
false, s);
605 return leaf_match(name, s);
608BaseType *DDS::leaf_match(
const string &n, BaseType::btp_stack *s) {
609 DBG(cerr <<
"DDS::leaf_match: Looking for " << n << endl);
611 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
613 DBG(cerr <<
"DDS::leaf_match: Looking for " << n <<
" in: " << btp->
name() << endl);
615 if (btp->
name() == n) {
616 DBG(cerr <<
"Found " << n <<
" in: " << btp->
name() << endl);
621 BaseType *found = btp->
var(n,
false, s);
623 DBG(cerr <<
"Found " << n <<
" in: " << btp->
name() << endl);
627#if STRUCTURE_ARRAY_SYNTAX_OLD
630 BaseType *found = btp->
var()->
var(n,
false, s);
632 DBG(cerr <<
"Found " << n <<
" in: " << btp->
var()->d_name() << endl);
642BaseType *DDS::exact_match(
const string &name, BaseType::btp_stack *s) {
643 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
645 DBG2(cerr <<
"Looking for " << d_name <<
" in: " << btp << endl);
647 if (btp->name() == name) {
648 DBG2(cerr <<
"Found " << d_name <<
" in: " << btp << endl);
653 string::size_type dot_pos = name.find(
".");
654 if (dot_pos != string::npos) {
655 string aggregate = name.substr(0, dot_pos);
656 string field = name.substr(dot_pos + 1);
658 BaseType *agg_ptr =
var(aggregate, s);
660 DBG2(cerr <<
"Descending into " << agg_ptr->name() << endl);
661 return agg_ptr->var(field,
true, s);
687void DDS::timeout_on() {
688#if USE_LOCAL_TIMEOUT_SCHEME
695void DDS::timeout_off() {
696#if USE_LOCAL_TIMEOUT_SCHEME
714void DDS::set_timeout(
int) {
715#if USE_LOCAL_TIMEOUT_SCHEME
721int DDS::get_timeout() {
722#if USE_LOCAL_TIMEOUT_SCHEME
731 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
732 if ((*i)->type() == dods_sequence_c)
734 else if ((*i)->type() == dods_structure_c)
741 FILE *in = fopen(fname.c_str(),
"r");
744 throw Error(cannot_read_file,
"Could not open: " + fname);
759 int new_fd = _dup(fd);
761 int new_fd = dup(fd);
765 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
766 FILE *in = fdopen(new_fd,
"r");
769 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
789 throw InternalErr(__FILE__, __LINE__,
"Null input stream.");
792 void *buffer = dds_buffer(in);
793 dds_switch_to_buffer(buffer);
797 bool status = ddsparse(&arg) == 0;
799 dds_delete_buffer(buffer);
801 DBG2(cout <<
"Status from parser: " << status << endl);
805 if (!status || !arg.status()) {
815 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
820 out <<
"Dataset {\n";
822 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
823 (*i)->print_decl(out);
826 out <<
"} " <<
id2www(d_name) <<
";\n";
864 Grid *grid =
dynamic_cast<Grid *
>(btp);
868 for (Constructor::Vars_iter i = cons->
var_begin(), e = cons->
var_end(); i != e; i++) {
886static string four_spaces =
" ";
887void print_var_das(ostream &out, BaseType *bt,
string indent =
"") {
892 AttrTable attr_table = bt->get_attr_table();
895 Constructor *cnstrctr =
dynamic_cast<Constructor *
>(bt);
897 Grid *grid =
dynamic_cast<Grid *
>(bt);
899 Array *gridArray = grid->get_array();
900 AttrTable arrayAT = gridArray->get_attr_table();
903 gridArray->get_attr_table().print(out, indent + four_spaces);
907 for (Grid::Map_iter mIter = grid->map_begin();
908 mIter != grid->map_end(); ++mIter) {
909 BaseType *currentMap = *mIter;
911 print_var_das(out, currentMap, indent + four_spaces);
915 attr_table.print(out, indent + four_spaces);
916 Constructor::Vars_iter i = cnstrctr->var_begin();
917 Constructor::Vars_iter e = cnstrctr->var_end();
918 for (; i != e; i++) {
924 print_var_das(out, *i, indent + four_spaces);
928 attr_table.print(out, indent + four_spaces);
931 out << indent <<
"}" << endl;
943 unique_ptr<DAS> das(
get_das());
968static string get_unique_top_level_global_container_name(
DAS *das) {
973 return TOP_LEVEL_ATTRS_CONTAINER_NAME;
983 throw InternalErr(__FILE__, __LINE__,
"Cannot add top-level attributes to the DAS");
984 name = TOP_LEVEL_ATTRS_CONTAINER_NAME + oss.str();
1001 Grid *grid =
dynamic_cast<Grid *
>(bt);
1006 for (AttrTable::Attr_iter atIter = arrayAT.
attr_begin(); atIter != arrayAT.
attr_end(); ++atIter) {
1008 string childName = arrayAT.
get_name(atIter);
1009 if (type == Attr_container) {
1019 for (Constructor::Vars_iter i = cons->
var_begin(), e = cons->
var_end(); i != e; i++) {
1031 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
1033 AttrTable *childAttrT =
new AttrTable((*i)->get_attr_table());
1035 das->add_table((*i)->name(), childAttrT);
1040 unique_ptr<AttrTable> global(
new AttrTable);
1042 for (AttrTable::Attr_iter i = d_attr.attr_begin(); i != d_attr.attr_end(); ++i) {
1045 if (d_attr.get_attr_table(i)) {
1046 das->add_table(d_attr.get_name(i),
new AttrTable(*(d_attr.get_attr_table(i))));
1049 global->append_attr(d_attr.get_name(i), d_attr.get_type(i), d_attr.get_attr_vector(i), (*i)->is_utf8_str);
1054 if (global->get_size() > 0) {
1055 das->add_table(get_unique_top_level_global_container_name(das),
1074 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1088 out <<
"Dataset {\n";
1090 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
1094 (*i)->print_decl(out,
" ",
true,
false,
true);
1097 out <<
"} " <<
id2www(d_name) <<
";\n";
1116 fwrite(oss.str().data(), 1, oss.str().length(), out);
1132class VariablePrintXMLWriter :
public unary_function<BaseType *, void> {
1137 VariablePrintXMLWriter(
XMLWriter &xml,
bool constrained) : d_xml(xml), d_constrained(constrained) {}
1138 void operator()(BaseType *bt) { bt->print_xml_writer(d_xml, d_constrained); }
1162 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
"Dataset") < 0)
1163 throw InternalErr(__FILE__, __LINE__,
"Could not write Dataset element");
1164 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)d_name.c_str()) < 0)
1165 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1166 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:xsi",
1167 (
const xmlChar *)
"http://www.w3.org/2001/XMLSchema-instance") < 0)
1168 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
1170 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xsi:schemaLocation",
1171 (
const xmlChar *)c_dap_32_n_sl.c_str()) < 0)
1172 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
1174 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:grddl",
1175 (
const xmlChar *)
"http://www.w3.org/2003/g/data-view#") < 0)
1176 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:grddl");
1178 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"grddl:transformation",
1179 (
const xmlChar *)grddl_transformation_dap32.c_str()) < 0)
1180 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:transformation");
1182 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns",
1183 (
const xmlChar *)c_dap32_namespace.c_str()) < 0)
1184 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1185 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:dap",
1186 (
const xmlChar *)c_dap32_namespace.c_str()) < 0)
1187 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:dap");
1189 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"dapVersion", (
const xmlChar *)
"3.2") < 0)
1190 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1193 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:xml",
1194 (
const xmlChar *)c_xml_namespace.c_str()) < 0)
1195 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
1197 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xml:base",
1199 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
1203 d_attr.print_xml_writer(xml);
1206 for_each(
var_begin(),
var_end(), VariablePrintXMLWriter(xml, constrained));
1208 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
"blob") < 0)
1209 throw InternalErr(__FILE__, __LINE__,
"Could not write blob element");
1210 string cid =
"cid:" + blob;
1211 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"href", (
const xmlChar *)cid.c_str()) < 0)
1212 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1213 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1214 throw InternalErr(__FILE__, __LINE__,
"Could not end blob element");
1216 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1217 throw InternalErr(__FILE__, __LINE__,
"Could not end Dataset element");
1219 out << xml.get_doc();
1237 throw InternalErr(__FILE__, __LINE__,
"Tried to print a DMR with DAP major version less than 4");
1242 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
"Group") < 0)
1243 throw InternalErr(__FILE__, __LINE__,
"Could not write Group element");
1245 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:xml",
1246 (
const xmlChar *)c_xml_namespace.c_str()) < 0)
1247 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
1249 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns:xsi",
1250 (
const xmlChar *)c_xml_xsi.c_str()) < 0)
1251 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
1253 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xsi:schemaLocation",
1254 (
const xmlChar *)c_dap_40_n_sl.c_str()) < 0)
1255 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
1257 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xmlns",
1259 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1261 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"dapVersion",
1262 (
const xmlChar *)get_dap_version().c_str()) < 0)
1263 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1265 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"dmrVersion",
1266 (
const xmlChar *)get_dmr_version().c_str()) < 0)
1267 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1270 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"xml:base",
1272 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
1275 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)d_name.c_str()) < 0)
1276 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1279 d_attr.print_xml_writer(xml);
1282 for_each(
var_begin(),
var_end(), VariablePrintXMLWriter(xml, constrained));
1284 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1285 throw InternalErr(__FILE__, __LINE__,
"Could not end the top-level Group element");
1287 out << xml.get_doc();
1308 cerr <<
"A dataset must have a d_name" << endl;
1313 if (!unique_names(vars, d_name,
"Dataset", msg))
1317 for (Vars_iter i = vars.begin(); i != vars.end(); i++)
1318 if (!(*i)->check_semantics(msg,
true))
1348 unique_ptr<BaseType::btp_stack> s(
new BaseType::btp_stack);
1350 DBG2(cerr <<
"DDS::mark: Looking for " << n << endl);
1354 throw Error(malformed_expr,
"Could not find variable " + n);
1359 DBG2(cerr <<
"DDS::mark: Set variable " << variable->d_name() <<
" (a " << variable->
type_name() <<
")" << endl);
1365 while (!s->empty()) {
1366 s->top()->BaseType::set_send_p(state);
1368 DBG2(cerr <<
"DDS::mark: Set variable " << s->top()->d_name() <<
" (a " << s->top()->type_name() <<
")"
1371 string parent_name = (s->top()->get_parent()) ? s->top()->get_parent()->name() :
"none";
1372 string parent_type = (s->top()->get_parent()) ? s->top()->get_parent()->type_name() :
"none";
1373 DBG2(cerr <<
"DDS::mark: Parent variable " << parent_name <<
" (a " << parent_type <<
")" << endl);
1387 for (Vars_iter i = vars.begin(); i != vars.end(); i++)
1388 (*i)->set_send_p(state);
1397 bool has_dap4 = d_attr.has_dap4_types(
"/", inventory);
1399 has_dap4 |=
var->is_dap4_projected(inventory);
1412 strm << DapIndent::LMarg <<
"DDS::dump - (" << (
void *)
this <<
")" << endl;
1413 DapIndent::Indent();
1414 strm << DapIndent::LMarg <<
"d_name: " << d_name << endl;
1415 strm << DapIndent::LMarg <<
"filename: " << d_filename << endl;
1416 strm << DapIndent::LMarg <<
"protocol major: " << d_dap_major << endl;
1417 strm << DapIndent::LMarg <<
"protocol minor: " << d_dap_minor << endl;
1418 strm << DapIndent::LMarg <<
"factory: " << (
void *)d_factory << endl;
1420 strm << DapIndent::LMarg <<
"global attributes:" << endl;
1421 DapIndent::Indent();
1423 DapIndent::UnIndent();
1426 strm << DapIndent::LMarg <<
"vars:" << endl;
1427 DapIndent::Indent();
1428 Vars_citer i = vars.begin();
1429 Vars_citer ie = vars.end();
1430 for (; i != ie; i++) {
1433 DapIndent::UnIndent();
1435 strm << DapIndent::LMarg <<
"vars: none" << endl;
1438 DapIndent::UnIndent();
A multidimensional array of identical data types.
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 Attr_iter attr_end()
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued 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 string get_name() const
Get the name of this attribute table.
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
The basic data type for the DODS DAP types.
virtual string type_name() const
Returns the type of the class instance as a string.
virtual AttrTable & get_attr_table()
virtual string name() const
Returns the name of the class instance.
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
virtual void set_send_p(bool state)
virtual BaseType * ptr_duplicate()=0
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr)
Returns a pointer to a member of a constructor class.
Hold attribute data for a DAP2 dataset.
virtual AttrTable * get_top_level_attributes()
Returns the top most set of attributes.
AttrTable * get_table(AttrTable::Attr_iter &i)
Returns 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.
void set_dataset_name(const string &n)
void set_dap_major(int p)
void mark_all(bool state)
void print_dmr(ostream &out, bool constrained)
Print the DAP4 DMR object using a DDS.
void add_var_nocopy(BaseType *bt)
Adds the variable to the DDS.
bool check_semantics(bool all=false)
Check the semantics of each of the variables represented in the DDS.
virtual AttrTable & get_attr_table()
uint64_t get_request_size_kb(bool constrained)
Get the estimated response size in kilobytes.
virtual void transfer_attributes(DAS *das)
void set_dap_minor(int p)
string get_namespace() const
Get the namespace associated with the DDS - likely set only by DDX responses.
int num_var()
Returns the number of variables in the DDS.
void print(FILE *out)
Print the entire DDS to the specified file.
int get_request_size(bool constrained)
Get the estimated response size in bytes.
bool is_dap4_projected(std::vector< string > &inventory)
string get_dataset_name() const
void del_var(const string &n)
Removes a variable from the DDS.
void parse(string fname)
Parse a DDS from a file with the given d_name.
BaseType * var(const string &n, BaseType::btp_stack &s)
void print_xml(FILE *out, bool constrained, const string &blob="")
void insert_var(Vars_iter i, BaseType *ptr)
Insert a variable before the referenced element.
bool mark(const string &name, bool state)
Mark the send_p flag of the named variable to state.
DDS(BaseTypeFactory *factory, const string &name="")
void tag_nested_sequences()
Traverse DDS, set Sequence leaf nodes.
DAS * get_das()
Get a DAS object.
void print_constrained(FILE *out)
Print a constrained DDS to the specified file.
void insert_var_nocopy(Vars_iter i, BaseType *ptr)
string get_request_xml_base() const
Get the URL that will return this DDS/DDX/DataThing.
Vars_iter var_end()
Return an iterator.
int get_dap_major() const
Get the DAP major version as sent by the client.
const vector< BaseType * > & variables() const
void set_dap_version(const string &version_string="2.0")
void add_var(BaseType *bt)
Adds a copy of the variable to the DDS. Using the ptr_duplicate() method, perform a deep copy on the ...
void print_xml_writer(ostream &out, bool constrained, const string &blob="")
void print_das(ostream &out)
write the DAS response given the attribute information in the DDS
virtual void dump(ostream &strm) const
dumps information about this object
libdap base object for common functionality of libdap objects
A class for error processing.
Holds the Grid data type.
Array * get_array()
Returns the Grid Array. This method returns the array using an Array*, so no cast is required.
A class for software fault reporting.
virtual void set_leaf_sequence(int lvl=1)
Mark the Sequence which holds the leaf elements.
Holds a structure (aggregate) type.
virtual void set_leaf_sequence(int level=1)
Traverse Structure, set Sequence leaf nodes.
top level DAP object to house generic methods
bool has_dap2_attributes(AttrTable &a)
string www2id(const string &in, const string &escape, const string &except)
string add_space_encoding(const string &s)
string AttrType_to_String(const AttrType at)
void fillConstructorAttrTable(AttrTable *at, BaseType *bt)
Recursive helper function for Building DAS entries for Constructor types.
string id2www(string in, const string &allowable)
Pass parameters by reference to a parser.