38 #include <sys/types.h> 62 #include "InternalErr.h" 63 #include "Keywords2.h" 79 #include "Structure.h" 95 const string c_xml_xsi =
"http://www.w3.org/2001/XMLSchema-instance";
96 const string c_xml_namespace =
"http://www.w3.org/XML/1998/namespace";
98 const string grddl_transformation_dap32 =
"http://xml.opendap.org/transforms/ddxToRdfTriples.xsl";
100 const string c_default_dap20_schema_location =
"http://xml.opendap.org/dap/dap2.xsd";
101 const string c_default_dap32_schema_location =
"http://xml.opendap.org/dap/dap3.2.xsd";
102 const string c_default_dap40_schema_location =
"http://xml.opendap.org/dap/dap4.0.xsd";
104 const string c_dap20_namespace =
"http://xml.opendap.org/ns/DAP2";
105 const string c_dap32_namespace =
"http://xml.opendap.org/ns/DAP/3.2#";
106 const string c_dap40_namespace =
"http://xml.opendap.org/ns/DAP/4.0#";
108 const string c_dap_20_n_sl = c_dap20_namespace +
" " + c_default_dap20_schema_location;
109 const string c_dap_32_n_sl = c_dap32_namespace +
" " + c_default_dap32_schema_location;
110 const string c_dap_40_n_sl = c_dap40_namespace +
" " + c_default_dap40_schema_location;
126 void dds_switch_to_buffer(
void *new_buffer);
127 void dds_delete_buffer(
void * buffer);
128 void *dds_buffer(FILE *fp);
133 DDS::duplicate(
const DDS &dds)
135 DBG(cerr <<
"Entering DDS::duplicate... " <<endl);
137 BaseTypeFactory *d_factory;
141 string d_container_name;
142 Structure *d_container;
147 string d_dap_version;
148 string d_request_xml_base;
153 vector<BaseType *> vars;
160 long d_max_response_size;
163 d_factory = dds.d_factory;
166 d_filename = dds.d_filename;
167 d_container_name = dds.d_container_name;
168 d_container = dds.d_container;
170 d_dap_major = dds.d_dap_major;
171 d_dap_minor = dds.d_dap_minor;
173 d_dap_version = dds.d_dap_version;
174 d_request_xml_base = dds.d_request_xml_base;
175 d_namespace = dds.d_namespace;
179 DDS &dds_tmp =
const_cast<DDS &
>(dds);
182 for (Vars_iter i = dds_tmp.var_begin(); i != dds_tmp.var_end(); i++) {
186 d_timeout = dds.d_timeout;
188 d_keywords = dds.d_keywords;
190 d_max_response_size = dds.d_max_response_size;
206 : d_factory(factory), d_name(name), d_container_name(
""), d_container(0),
207 d_request_xml_base(
""),
208 d_timeout(0), d_keywords(), d_max_response_size(0)
210 DBG(cerr <<
"Building a DDS for the default version (2.0)" << endl);
233 : d_factory(factory), d_name(name), d_container_name(
""), d_container(0),
234 d_request_xml_base(
""),
235 d_timeout(0), d_keywords(), d_max_response_size(0)
237 DBG(cerr <<
"Building a DDS for version: " << version << endl);
247 DBG(cerr <<
"Entering DDS(const DDS &rhs) ..." << endl);
249 DBG(cerr <<
" bye." << endl);
255 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
257 delete btp ; btp = 0;
262 DDS::operator=(
const DDS &rhs)
264 DBG(cerr <<
"Entering DDS::operator= ..." << endl);
270 DBG(cerr <<
" bye." << endl);
295 "Error transferring attributes: working on a container in dds, but not das");
301 (*i)->transfer_attributes(top);
307 DBG(cerr <<
"Processing the attributes for: " << (*var)->d_name() <<
" a " << (*var)->type_name() << endl);
308 (*var)->transfer_attributes(top);
321 if ((*i)->type == Attr_container && (*i)->attributes->is_global_attribute()) {
325 d_attr.append_container(at, at->
get_name());
329 AttrTable::Attr_iter at_cont_p = top_level->attr_begin();
330 while (at_cont_p != top_level->attr_end()) {
334 if ((*at_cont_p)->type == Attr_container && (*at_cont_p)->attributes->is_global_attribute()) {
335 DBG(cerr << (*at_cont_p)->d_name <<
" is a global attribute." << endl);
339 d_attr.append_container(at, at->
get_name());
413 if (d_dap_minor >= 0) {
415 oss << d_dap_major <<
"." << d_dap_minor;
416 d_dap_version = oss.str();
428 if (d_dap_major >= 0) {
430 oss << d_dap_major <<
"." << d_dap_minor;
431 d_dap_version = oss.str();
443 istringstream iss(v);
445 int major = -1, minor = -1;
447 if (!iss.eof() && !iss.fail())
449 if (!iss.eof() && !iss.fail())
451 if (!iss.eof() && !iss.fail())
454 if (major == -1 || minor == -1 or dot !=
'.')
455 throw InternalErr(__FILE__, __LINE__,
"Could not parse dap version. Value given: " + v);
466 switch (d_dap_major) {
468 d_namespace = c_dap20_namespace;
471 d_namespace = c_dap32_namespace;
474 d_namespace = c_dap40_namespace;
477 throw InternalErr(__FILE__, __LINE__,
"Unknown DAP version.");
491 int major = floor(d);
492 int minor = (d-major)*10;
494 DBG(cerr <<
"Major: " << major <<
", Minor: " << minor << endl);
497 oss << major <<
"." << minor;
514 return d_container_name;
542 d_container_name = cn;
569 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
572 w += (*i)->width(constrained);
575 w += (*i)->width(constrained);
589 throw InternalErr(__FILE__, __LINE__,
"Trying to add a BaseType object with a NULL pointer.");
591 if (bt->is_dap4_only_type())
592 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 DDS.");
594 DBG2(cerr <<
"In DDS::add_var(), bt's address is: " << bt << endl);
597 DBG2(cerr <<
"In DDS::add_var(), btp's address is: " << btp << endl);
601 d_container->add_var(bt);
617 throw InternalErr(__FILE__, __LINE__,
"Trying to add a BaseType object with a NULL pointer.");
620 if (bt->is_dap4_only_type())
621 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 DDS.");
624 DBG2(cerr <<
"In DDS::add_var(), bt's address is: " << bt << endl);
627 d_container->add_var_nocopy(bt);
646 d_container->del_var( n ) ;
650 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
651 if ((*i)->name() == n) {
667 if (i != vars.end()) {
683 for (Vars_iter i_tmp = i1; i_tmp != i2; i_tmp++) {
726 return d_container->var( name,
false, s ) ;
732 return leaf_match(name, s);
736 DDS::leaf_match(
const string &n, BaseType::btp_stack *s)
738 DBG(cerr <<
"DDS::leaf_match: Looking for " << n << endl);
740 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
742 DBG(cerr <<
"DDS::leaf_match: Looking for " << n <<
" in: " << btp->d_name() << endl);
744 if (btp->
name() == n) {
745 DBG(cerr <<
"Found " << n <<
" in: " << btp->d_name() << endl);
750 BaseType *found = btp->
var(n,
false, s);
752 DBG(cerr <<
"Found " << n <<
" in: " << btp->d_name() << endl);
756 #if STRUCTURE_ARRAY_SYNTAX_OLD 759 BaseType *found = btp->
var()->
var(n,
false, s);
761 DBG(cerr <<
"Found " << n <<
" in: " << btp->
var()->d_name() << endl);
772 DDS::exact_match(
const string &name, BaseType::btp_stack *s)
774 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
776 DBG2(cerr <<
"Looking for " << d_name <<
" in: " << btp << endl);
778 if (btp->name() == name) {
779 DBG2(cerr <<
"Found " << d_name <<
" in: " << btp << endl);
784 string::size_type dot_pos = name.find(
".");
785 if (dot_pos != string::npos) {
786 string aggregate = name.substr(0, dot_pos);
787 string field = name.substr(dot_pos + 1);
789 BaseType *agg_ptr =
var(aggregate, s);
791 DBG2(cerr <<
"Descending into " << agg_ptr->name() << endl);
792 return agg_ptr->var(field,
true, s);
813 return vars.rbegin();
834 return vars.begin() + i;
843 return *(vars.begin() + i);
854 if (ptr->is_dap4_only_type())
855 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 DDS.");
871 if (ptr->is_dap4_only_type())
872 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 DDS.");
887 #if USE_LOCAL_TIMEOUT_SCHEME 897 #if USE_LOCAL_TIMEOUT_SCHEME 916 DDS::set_timeout(
int)
918 #if USE_LOCAL_TIMEOUT_SCHEME 927 #if USE_LOCAL_TIMEOUT_SCHEME 938 for (Vars_iter i = vars.begin(); i != vars.end(); i++) {
939 if ((*i)->type() == dods_sequence_c)
940 dynamic_cast<Sequence&>(**i).set_leaf_sequence();
941 else if ((*i)->type() == dods_structure_c)
942 dynamic_cast<Structure&>(**i).set_leaf_sequence();
950 FILE *in = fopen(fname.c_str(),
"r");
953 throw Error(cannot_read_file,
"Could not open: " + fname);
972 int new_fd = _dup(fd);
974 int new_fd = dup(fd);
978 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
979 FILE *in = fdopen(new_fd,
"r");
982 throw InternalErr(__FILE__, __LINE__,
"Could not access file.");
1005 throw InternalErr(__FILE__, __LINE__,
"Null input stream.");
1008 void *buffer = dds_buffer(in);
1009 dds_switch_to_buffer(buffer);
1013 bool status = ddsparse(&arg) == 0;
1015 dds_delete_buffer(buffer);
1017 DBG2(cout <<
"Status from parser: " << status << endl);
1021 if (!status || !arg.status()) {
1033 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
1040 out <<
"Dataset {\n" ;
1042 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
1043 (*i)->print_decl(out) ;
1046 out <<
"} " <<
id2www(d_name) <<
";\n" ;
1063 out <<
"Attributes {\n" ;
1065 d_attr.print(out,
" ");
1066 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
1067 (*i)->get_attr_table().print(out,
" ");
1088 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
1104 out <<
"Dataset {\n" ;
1106 for (Vars_citer i = vars.begin(); i != vars.end(); i++) {
1110 (*i)->print_decl(out,
" ",
true,
false,
true) ;
1113 out <<
"} " <<
id2www(d_name) <<
";\n" ;
1134 fwrite(oss.str().data(), 1, oss.str().length(), out);
1154 class VariablePrintXMLWriter :
public unary_function<BaseType *, void>
1159 VariablePrintXMLWriter(
XMLWriter &xml,
bool constrained)
1160 : d_xml(xml), d_constrained(constrained)
1162 void operator()(BaseType *bt)
1164 bt->print_xml_writer(d_xml, d_constrained);
1192 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"Group") < 0)
1193 throw InternalErr(__FILE__, __LINE__,
"Could not write Group element");
1194 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)d_name.c_str()) < 0)
1195 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1197 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"dapVersion", (
const xmlChar*)get_dap_version().c_str()) < 0)
1198 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1201 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xml", (
const xmlChar*)c_xml_namespace.c_str()) < 0)
1202 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
1204 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xml:base", (
const xmlChar*)
get_request_xml_base().c_str()) < 0)
1205 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
1208 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns", (
const xmlChar*)
get_namespace().c_str()) < 0)
1209 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1213 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"Dataset") < 0)
1214 throw InternalErr(__FILE__, __LINE__,
"Could not write Dataset element");
1215 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)d_name.c_str()) < 0)
1216 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1217 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xsi", (
const xmlChar*)
"http://www.w3.org/2001/XMLSchema-instance") < 0)
1218 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
1220 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xsi:schemaLocation", (
const xmlChar*)c_dap_32_n_sl.c_str()) < 0)
1221 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
1223 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:grddl", (
const xmlChar*)
"http://www.w3.org/2003/g/data-view#") < 0)
1224 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:grddl");
1226 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"grddl:transformation", (
const xmlChar*)grddl_transformation_dap32.c_str()) < 0)
1227 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:transformation");
1229 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns", (
const xmlChar*)c_dap32_namespace.c_str()) < 0)
1230 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1231 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:dap", (
const xmlChar*)c_dap32_namespace.c_str()) < 0)
1232 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:dap");
1234 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"dapVersion", (
const xmlChar*)
"3.2") < 0)
1235 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1238 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xml", (
const xmlChar*)c_xml_namespace.c_str()) < 0)
1239 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
1241 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xml:base", (
const xmlChar*)
get_request_xml_base().c_str()) < 0)
1242 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
1246 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"Dataset") < 0)
1247 throw InternalErr(__FILE__, __LINE__,
"Could not write Dataset element");
1248 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)d_name.c_str()) < 0)
1249 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1250 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xsi", (
const xmlChar*)
"http://www.w3.org/2001/XMLSchema-instance") < 0)
1251 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
1253 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns", (
const xmlChar*)c_dap20_namespace.c_str()) < 0)
1254 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1256 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xsi:schemaLocation", (
const xmlChar*)c_dap_20_n_sl.c_str()) < 0)
1257 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
1261 d_attr.print_xml_writer(xml);
1264 for_each(
var_begin(),
var_end(), VariablePrintXMLWriter(xml, constrained));
1271 if (!blob.empty()) {
1272 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"blob") < 0)
1273 throw InternalErr(__FILE__, __LINE__,
"Could not write blob element");
1274 string cid =
"cid:" + blob;
1275 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"href", (
const xmlChar*) cid.c_str()) < 0)
1276 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1277 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1278 throw InternalErr(__FILE__, __LINE__,
"Could not end blob element");
1282 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"blob") < 0)
1283 throw InternalErr(__FILE__, __LINE__,
"Could not write blob element");
1284 string cid =
"cid:" + blob;
1285 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"href", (
const xmlChar*) cid.c_str()) < 0)
1286 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1287 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1288 throw InternalErr(__FILE__, __LINE__,
"Could not end blob element");
1291 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"dataBLOB") < 0)
1292 throw InternalErr(__FILE__, __LINE__,
"Could not write dataBLOB element");
1293 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"href", (
const xmlChar*)
"") < 0)
1294 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1295 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1296 throw InternalErr(__FILE__, __LINE__,
"Could not end dataBLOB element");
1299 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1300 throw InternalErr(__FILE__, __LINE__,
"Could not end Dataset element");
1302 out << xml.get_doc();
1321 throw InternalErr(__FILE__, __LINE__,
"Tried to print a DMR with DAP major version less than 4");
1326 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"Group") < 0)
1327 throw InternalErr(__FILE__, __LINE__,
"Could not write Group element");
1329 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xml",
1330 (
const xmlChar*) c_xml_namespace.c_str()) < 0)
1331 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xml");
1333 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns:xsi", (
const xmlChar*) c_xml_xsi.c_str())
1335 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:xsi");
1337 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xsi:schemaLocation",
1338 (
const xmlChar*) c_dap_40_n_sl.c_str()) < 0)
1339 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns:schemaLocation");
1341 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xmlns",
1343 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xmlns");
1345 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"dapVersion",
1346 (
const xmlChar*) get_dap_version().c_str()) < 0)
1347 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1349 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"dmrVersion", (
const xmlChar*) get_dmr_version().c_str()) < 0)
1350 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for dapVersion");
1353 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"xml:base",
1355 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for xml:base");
1358 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*) d_name.c_str()) < 0)
1359 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1362 d_attr.print_xml_writer(xml);
1365 for_each(
var_begin(),
var_end(), VariablePrintXMLWriter(xml, constrained));
1373 if (!blob.empty()) {
1374 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"blob") < 0)
1375 throw InternalErr(__FILE__, __LINE__,
"Could not write blob element");
1376 string cid =
"cid:" + blob;
1377 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"href", (
const xmlChar*) cid.c_str()) < 0)
1378 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for d_name");
1379 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1380 throw InternalErr(__FILE__, __LINE__,
"Could not end blob element");
1385 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1386 throw InternalErr(__FILE__, __LINE__,
"Could not end the top-level Group element");
1388 out << xml.get_doc();
1411 cerr <<
"A dataset must have a d_name" << endl;
1416 if (!unique_names(vars, d_name,
"Dataset", msg))
1420 for (Vars_iter i = vars.begin(); i != vars.end(); i++)
1421 if (!(*i)->check_semantics(msg,
true))
1456 BaseType::btp_stack *s =
new BaseType::btp_stack;
1458 DBG2(cerr <<
"DDS::mark: Looking for " << n << endl);
1462 DBG2(cerr <<
"Could not find variable " << n << endl);
1468 DBG2(cerr <<
"DDS::mark: Set variable " << variable->d_name()
1469 <<
" (a " << variable->
type_name() <<
")" << endl);
1475 while (!s->empty()) {
1476 s->top()->BaseType::set_send_p(state);
1478 DBG2(cerr <<
"DDS::mark: Set variable " << s->top()->d_name()
1479 <<
" (a " << s->top()->type_name() <<
")" << endl);
1482 string parent_name = (s->top()->get_parent()) ? s->top()->get_parent()->name():
"none";
1483 string parent_type = (s->top()->get_parent()) ? s->top()->get_parent()->type_name():
"none";
1484 DBG2(cerr <<
"DDS::mark: Parent variable " << parent_name <<
" (a " << parent_type <<
")" << endl);
1502 for (Vars_iter i = vars.begin(); i != vars.end(); i++)
1503 (*i)->set_send_p(state);
1516 strm << DapIndent::LMarg <<
"DDS::dump - (" 1517 << (
void *)
this <<
")" << endl ;
1518 DapIndent::Indent() ;
1519 strm << DapIndent::LMarg <<
"d_name: " << d_name << endl ;
1520 strm << DapIndent::LMarg <<
"filename: " << d_filename << endl ;
1521 strm << DapIndent::LMarg <<
"protocol major: " << d_dap_major << endl;
1522 strm << DapIndent::LMarg <<
"protocol minor: " << d_dap_minor << endl;
1523 strm << DapIndent::LMarg <<
"factory: " << (
void *)d_factory << endl ;
1525 strm << DapIndent::LMarg <<
"global attributes:" << endl ;
1526 DapIndent::Indent() ;
1528 DapIndent::UnIndent() ;
1531 strm << DapIndent::LMarg <<
"vars:" << endl ;
1532 DapIndent::Indent() ;
1533 Vars_citer i = vars.begin() ;
1534 Vars_citer ie = vars.end() ;
1535 for (; i != ie; i++) {
1538 DapIndent::UnIndent() ;
1541 strm << DapIndent::LMarg <<
"vars: none" << endl ;
1544 DapIndent::UnIndent() ;
virtual string name() const
Returns the name of the class instance.
void print(FILE *out)
Print the entire DDS to the specified file.
virtual Attr_iter attr_end()
void insert_var_nocopy(Vars_iter i, BaseType *ptr)
Contains the attributes for a dataset.
Vars_iter get_vars_iter(int i)
Get an iterator.
void insert_var(Vars_iter i, BaseType *ptr)
Insert a variable before the referenced element.
Vars_iter var_begin()
Return an iterator to the first variable.
virtual string get_name() const
Get the name of this attribute table.
DDS(BaseTypeFactory *factory, const string &name="")
int get_request_size(bool constrained)
Get the estimated response size.
BaseType * var(const string &n, BaseType::btp_stack &s)
virtual void transfer_attributes(DAS *das)
void print_xml(FILE *out, bool constrained, const string &blob="")
void print_xml_writer(ostream &out, bool constrained, const string &blob="")
void add_var_nocopy(BaseType *bt)
Adds the variable to the DDS.
Holds a structure (aggregate) type.
Vars_riter var_rend()
Return a reverse iterator.
string get_dataset_name() const
int num_var()
Returns the number of variables in the DDS.
bool mark(const string &name, bool state)
Mark the send_p flag of the named variable to state.
A class for software fault reporting.
void parse(string fname)
Parse a DDS from a file with the given d_name.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
Returns a pointer to a member of a constructor class.
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
virtual void set_send_p(bool state)
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
void mark_all(bool state)
void print_das(ostream &out)
void print_dmr(ostream &out, bool constrained)
virtual AttrTable & get_attr_table()
BaseType * get_var_index(int i)
Get a variable.
bool check_semantics(bool all=false)
Check the semantics of each of the variables represented in the DDS.
int get_dap_major() const
Get the DAP major version as sent by the client.
string get_request_xml_base() const
Get the URL that will return this DDS/DDX/DataThing.
string get_error_message() const
virtual AttrTable * get_top_level_attributes()
Returns the top most set of attributes.
virtual void dump(ostream &strm) const
dumps information about this object
virtual Attr_iter attr_begin()
virtual string container_name() const
Returns the name of the current attribute container when multiple files used to build this DAS...
virtual BaseType * ptr_duplicate()=0
string get_namespace() const
Get the namespace associated with the DDS - likely set only by DDX responses.
string www2id(const string &in, const string &escape, const string &except)
Vars_iter var_end()
Return an iterator.
void tag_nested_sequences()
Traverse DDS, set Sequence leaf nodes.
void set_dap_minor(int p)
void set_dataset_name(const string &n)
The basic data type for the DODS DAP types.
libdap base object for common functionality of libdap objects
Pass parameters by reference to a parser.
void del_var(const string &n)
Removes a variable from the DDS.
virtual string type_name() const
Returns the type of the class instance as a string.
Vars_riter var_rbegin()
Return a reverse iterator.
Hold attribute data for a DAP2 dataset.
A class for error processing.
int get_dap_minor() const
Get the DAP minor version as sent by the client.
void set_dap_major(int p)
void print_constrained(FILE *out)
Print a constrained DDS to the specified file.
void set_dap_version(const string &version_string="2.0")
string id2www(string in, const string &allowable)
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 ...