libdap++  Updated for version 3.14.0
Constructor.cc
Go to the documentation of this file.
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 // (c) COPYRIGHT URI/MIT 1995-1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 
32 
33 #include "config.h"
34 
35 #include <string>
36 #include <sstream>
37 #include <algorithm>
38 #include <functional>
39 
40 #include <stdint.h>
41 
42 //#define DODS_DEBUG
43 
44 #include "crc.h"
45 
46 #include "Constructor.h"
47 #include "Grid.h"
48 
49 #include "DMR.h"
50 #include "XMLWriter.h"
51 #include "D4StreamMarshaller.h"
52 #include "D4StreamUnMarshaller.h"
53 
54 #include "D4Attributes.h"
55 
56 #include "debug.h"
57 #include "escaping.h"
58 #include "util.h"
59 #include "Error.h"
60 #include "InternalErr.h"
61 
62 using namespace std;
63 
64 namespace libdap {
65 
66 // Private member functions
67 
68 void
69 Constructor::m_duplicate(const Constructor &c)
70 {
71  DBG(cerr << "In Constructor::m_duplicate for " << c.name() << endl);
72  // Clear out any spurious vars in Constructor::d_vars
73  // Moved from Grid::m_duplicate. jhrg 4/3/13
74  d_vars.clear(); // [mjohnson 10 Sep 2009]
75 
76  Vars_citer i = c.d_vars.begin();
77  while (i != c.d_vars.end()) {
78  BaseType *btp = (*i++)->ptr_duplicate();
79  btp->set_parent(this);
80  d_vars.push_back(btp);
81  }
82 
83  DBG(cerr << "Exiting Constructor::m_duplicate for " << c.name() << endl);
84 }
85 
86 // Public member functions
87 
88 Constructor::Constructor(const string &name, const Type &type, bool is_dap4)
89  : BaseType(name, type, is_dap4)
90 {}
91 
102 Constructor::Constructor(const string &name, const string &dataset, const Type &type, bool is_dap4)
103  : BaseType(name, dataset, type, is_dap4)
104 {}
105 
106 Constructor::Constructor(const Constructor &rhs) : BaseType(rhs), d_vars(0)
107 {
108  DBG(cerr << "In Constructor::copy_ctor for " << rhs.name() << endl);
109  m_duplicate(rhs);
110 }
111 
113 {
114  Vars_iter i = d_vars.begin();
115  while (i != d_vars.end()) {
116  delete *i++;
117  }
118 }
119 
120 Constructor &
122 {
123  DBG(cerr << "Entering Constructor::operator=" << endl);
124  if (this == &rhs)
125  return *this;
126 
127  dynamic_cast<BaseType &>(*this) = rhs; // run BaseType=
128 
129  m_duplicate(rhs);
130 
131  DBG(cerr << "Exiting Constructor::operator=" << endl);
132  return *this;
133 }
134 
135 // A public method, but just barely..
136 BaseType *
138 {
139  for (Constructor::Vars_citer i = var_begin(), e = var_end(); i != e; ++i) {
140  BaseType *new_var = (*i)->transform_to_dap4(root, dest);
141  if (new_var) { // Might be a Grid; see the comment in BaseType::transform_to_dap4()
142  new_var->set_parent(dest);
143  dest->add_var_nocopy(new_var);
144  }
145  }
146 
147  // Add attributes
149 
150  dest->set_is_dap4(true);
151 
152  return dest;
153 }
154 
155 string
157 {
158  if (get_parent() == 0)
159  return name();
160  else if (get_parent()->type() == dods_group_c)
161  return get_parent()->FQN() + name();
162  else if (get_parent()->type() == dods_array_c)
163  return get_parent()->FQN();
164  else
165  return get_parent()->FQN() + "." + name();
166 }
167 
168 int
170 {
171  if (!leaves)
172  return d_vars.size();
173  else {
174  int i = 0;
175  for (Vars_iter j = d_vars.begin(); j != d_vars.end(); j++) {
176  i += (*j)->element_count(leaves);
177  }
178  return i;
179  }
180 }
181 
182 void
184 {
185  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
186  (*i)->set_send_p(state);
187  }
188 
189  BaseType::set_send_p(state);
190 }
191 
192 void
194 {
195  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
196  (*i)->set_read_p(state);
197  }
198 
199  BaseType::set_read_p(state);
200 }
201 
202 #if 0
203 // TODO Recode to use width(bool). Bur see comments in BaseType.h
204 unsigned int
206 {
207  unsigned int sz = 0;
208 
209  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
210  sz += (*i)->width();
211  }
212 
213  return sz;
214 }
215 #endif
216 
223 unsigned int
224 Constructor::width(bool constrained) const
225 {
226  unsigned int sz = 0;
227 
228  for (Vars_citer i = d_vars.begin(); i != d_vars.end(); i++) {
229  if (constrained) {
230  if ((*i)->send_p())
231  sz += (*i)->width(constrained);
232  }
233  else {
234  sz += (*i)->width(constrained);
235  }
236  }
237 
238  return sz;
239 }
240 
241 BaseType *
242 Constructor::var(const string &name, bool exact_match, btp_stack *s)
243 {
244  string n = www2id(name);
245 
246  if (exact_match)
247  return m_exact_match(n, s);
248  else
249  return m_leaf_match(n, s);
250 }
251 
253 BaseType *
254 Constructor::var(const string &n, btp_stack &s)
255 {
256  // This should probably be removed. The BES code should remove web encoding
257  // with the possible exception of spaces. jhrg 11/25/13
258  string name = www2id(n);
259 
260  BaseType *btp = m_exact_match(name, &s);
261  if (btp)
262  return btp;
263 
264  return m_leaf_match(name, &s);
265 }
266 
267 // Protected method
268 BaseType *
269 Constructor::m_leaf_match(const string &name, btp_stack *s)
270 {
271  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
272  if ((*i)->name() == name) {
273  if (s) {
274  DBG(cerr << "Pushing " << this->name() << endl);
275  s->push(static_cast<BaseType *>(this));
276  }
277  return *i;
278  }
279  if ((*i)->is_constructor_type()) {
280  BaseType *btp = (*i)->var(name, false, s);
281  if (btp) {
282  if (s) {
283  DBG(cerr << "Pushing " << this->name() << endl);
284  s->push(static_cast<BaseType *>(this));
285  }
286  return btp;
287  }
288  }
289  }
290 
291  return 0;
292 }
293 
294 // Protected method
295 BaseType *
296 Constructor::m_exact_match(const string &name, btp_stack *s)
297 {
298  // Look for name at the top level first.
299  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
300  if ((*i)->name() == name) {
301  if (s)
302  s->push(static_cast<BaseType *>(this));
303 
304  return *i;
305  }
306  }
307 
308  // If it was not found using the simple search, look for a dot and
309  // search the hierarchy.
310  string::size_type dot_pos = name.find("."); // zero-based index of `.'
311  if (dot_pos != string::npos) {
312  string aggregate = name.substr(0, dot_pos);
313  string field = name.substr(dot_pos + 1);
314 
315  BaseType *agg_ptr = var(aggregate);
316  if (agg_ptr) {
317  if (s)
318  s->push(static_cast<BaseType *>(this));
319 
320  return agg_ptr->var(field, true, s); // recurse
321  }
322  else
323  return 0; // qualified names must be *fully* qualified
324  }
325 
326  return 0;
327 }
328 
332 {
333  return d_vars.begin() ;
334 }
335 
340 {
341  return d_vars.end() ;
342 }
343 
347 {
348  return d_vars.rbegin();
349 }
350 
355 {
356  return d_vars.rend();
357 }
358 
364 {
365  return d_vars.begin() + i;
366 }
367 
371 BaseType *
373 {
374  return *(d_vars.begin() + i);
375 }
376 
381 void
383 {
384  // Jose Garcia
385  // Passing and invalid pointer to an object is a developer's error.
386  if (!bt)
387  throw InternalErr(__FILE__, __LINE__, "The BaseType parameter cannot be null.");
388 #if 0
389  if (bt->is_dap4_only_type())
390  throw InternalErr(__FILE__, __LINE__, "Attempt to add a DAP4 type to a DAP2 Structure.");
391 #endif
392  // Jose Garcia
393  // Now we add a copy of bt so the external user is able to destroy bt as
394  // he/she wishes. The policy is: "If it is allocated outside, it is
395  // deallocated outside, if it is allocated inside, it is deallocated
396  // inside"
397  BaseType *btp = bt->ptr_duplicate();
398  btp->set_parent(this);
399  d_vars.push_back(btp);
400 }
401 
406 void
408 {
409  if (!bt)
410  throw InternalErr(__FILE__, __LINE__, "The BaseType parameter cannot be null.");
411 #if 0
412  if (bt->is_dap4_only_type())
413  throw InternalErr(__FILE__, __LINE__, "Attempt to add a DAP4 type to a DAP2 Structure.");
414 #endif
415  bt->set_parent(this);
416  d_vars.push_back(bt);
417 }
418 
422 void
423 Constructor::del_var(const string &n)
424 {
425  // TODO remove_if? find_if?
426  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
427  if ((*i)->name() == n) {
428  BaseType *bt = *i ;
429  d_vars.erase(i) ;
430  delete bt ; bt = 0;
431  return;
432  }
433  }
434 }
435 
436 void
438 {
439  if (*i != 0) {
440  BaseType *bt = *i;
441  d_vars.erase(i);
442  delete bt;
443  }
444 }
445 
452 {
453  DBG(cerr << "Entering Constructor::read..." << endl);
454  if (!read_p()) {
455  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
456  (*i)->read();
457  }
458  set_read_p(true);
459  }
460 
461  return false;
462 }
463 
464 void
466 {
467  DBG(cerr << "Constructor::intern_data: " << name() << endl);
468  if (!read_p())
469  read(); // read() throws Error and InternalErr
470 
471  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
472  if ((*i)->send_p()) {
473  (*i)->intern_data(eval, dds);
474  }
475  }
476 }
477 
478 bool
480 {
481  dds.timeout_on();
482 
483  if (!read_p())
484  read(); // read() throws Error and InternalErr
485 
486  if (ce_eval && !eval.eval_selection(dds, dataset()))
487  return true;
488 
489  dds.timeout_off();
490 
491  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
492  if ((*i)->send_p()) {
493 #ifdef CHECKSUMS
494  XDRStreamMarshaller *sm = dynamic_cast<XDRStreamMarshaller*>(&m);
495  if (sm && sm->checksums() && (*i)->type() != dods_structure_c && (*i)->type() != dods_grid_c)
496  sm->reset_checksum();
497 
498  (*i)->serialize(eval, dds, m, false);
499 
500  if (sm && sm->checksums() && (*i)->type() != dods_structure_c && (*i)->type() != dods_grid_c)
501  sm->get_checksum();
502 #else
503  // (*i)->serialize(eval, dds, m, false);
504  // Only Sequence and Vector run the evaluator.
505  (*i)->serialize(eval, dds, m, true);
506 #endif
507  }
508  }
509 
510  return true;
511 }
512 
513 bool
515 {
516  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
517  (*i)->deserialize(um, dds, reuse);
518  }
519 
520  return false;
521 }
522 
523 void
525 {
526  throw InternalErr(__FILE__, __LINE__, "Computing a checksum alone is not supported for Constructor types.");
527 }
528 
529 void
530 Constructor::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator & eval*/)
531 {
532  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
533  if ((*i)->send_p()) {
534  (*i)->intern_data(checksum/*, dmr, eval*/);
535  }
536  }
537 }
538 
539 
551 void
552 Constructor::serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter)
553 {
554 #if 1
555  // Not used for the same reason the equivalent code in D4Group::serialize()
556  // is not used. Fail for D4Sequence and general issues with memory use.
557  //
558  // Revisit this - I had to uncomment this to get the netcdf_handler code
559  // to work - it relies on having NCStructure::read() called. The D4Sequence
560  // ::serialize() method calls read_next_instance(). What seems to be happening
561  // is that this call to read gets the first set of values, but does not store
562  // them; the call to serialize then runs the D4Sequence::serialize() method that
563  // _does_ read all of the sequence data and then serialize it. However, the first
564  // sequence instance is missing...
565  if (!read_p())
566  read(); // read() throws Error
567 #endif
568 #if 0
569  // place holder for now. There may be no need for this; only Array and Seq?
570  // jhrg 9/6/13
571  if (filter && !eval.eval_selection(dmr, dataset()))
572  return true;
573 #endif
574 
575  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
576  if ((*i)->send_p()) {
577  (*i)->serialize(m, dmr, /*eval,*/ filter);
578  }
579  }
580 }
581 
582 void
584 {
585  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
586  (*i)->deserialize(um, dmr);
587  }
588 }
589 
590 void
591 Constructor::print_decl(FILE *out, string space, bool print_semi,
592  bool constraint_info, bool constrained)
593 {
594  ostringstream oss;
595  print_decl(oss, space, print_semi, constraint_info, constrained);
596  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
597 }
598 
599 void
600 Constructor::print_decl(ostream &out, string space, bool print_semi,
601  bool constraint_info, bool constrained)
602 {
603  if (constrained && !send_p())
604  return;
605 
606  out << space << type_name() << " {\n" ;
607  for (Vars_citer i = d_vars.begin(); i != d_vars.end(); i++) {
608  (*i)->print_decl(out, space + " ", true, constraint_info, constrained);
609  }
610  out << space << "} " << id2www(name()) ;
611 
612  if (constraint_info) { // Used by test drivers only.
613  if (send_p())
614  out << ": Send True";
615  else
616  out << ": Send False";
617  }
618 
619  if (print_semi)
620  out << ";\n" ;
621 }
622 
623 void
624 Constructor::print_val(FILE *out, string space, bool print_decl_p)
625 {
626  ostringstream oss;
627  print_val(oss, space, print_decl_p);
628  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
629 }
630 
631 void
632 Constructor::print_val(ostream &out, string space, bool print_decl_p)
633 {
634  if (print_decl_p) {
635  print_decl(out, space, false);
636  out << " = " ;
637  }
638 
639  out << "{ " ;
640  for (Vars_citer i = d_vars.begin(); i != d_vars.end();
641  i++, (void)(i != d_vars.end() && out << ", ")) {
642  (*i)->print_val(out, "", false);
643  }
644 
645  out << " }" ;
646 
647  if (print_decl_p)
648  out << ";\n" ;
649 }
650 
654 void
655 Constructor::print_xml(FILE *out, string space, bool constrained)
656 {
657  XMLWriter xml(space);
658  print_xml_writer(xml, constrained);
659  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
660 }
661 
665 void
666 Constructor::print_xml(ostream &out, string space, bool constrained)
667 {
668  XMLWriter xml(space);
669  print_xml_writer(xml, constrained);
670  out << xml.get_doc();
671 }
672 
673 class PrintFieldXMLWriter : public unary_function<BaseType *, void>
674 {
675  XMLWriter &d_xml;
676  bool d_constrained;
677 public:
678  PrintFieldXMLWriter(XMLWriter &x, bool c)
679  : d_xml(x), d_constrained(c)
680  {}
681 
682  void operator()(BaseType *btp)
683  {
684  btp->print_xml_writer(d_xml, d_constrained);
685  }
686 };
687 
688 void
690 {
691  if (constrained && !send_p())
692  return;
693 
694  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
695  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
696 
697  if (!name().empty())
698  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
699  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
700 
701  // DAP2 prints attributes first. For some reason we decided that DAP4 should
702  // print them second. No idea why... jhrg 8/15/14
703  if (!is_dap4() && get_attr_table().get_size() > 0)
705 
706  bool has_variables = (var_begin() != var_end());
707  if (has_variables)
708  for_each(var_begin(), var_end(), PrintFieldXMLWriter(xml, constrained));
709 
710  if (is_dap4())
711  attributes()->print_dap4(xml);
712 
713 #if 0
714  // Moved up above so that the DDX tests for various handles will still work.
715  // jhrg 8/15/14
716  if (!is_dap4() && get_attr_table().get_size() > 0)
718 #endif
719 
720  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
721  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
722 }
723 
724 class PrintDAP4FieldXMLWriter : public unary_function<BaseType *, void>
725 {
726  XMLWriter &d_xml;
727  bool d_constrained;
728 public:
729  PrintDAP4FieldXMLWriter(XMLWriter &x, bool c) : d_xml(x), d_constrained(c) {}
730 
731  void operator()(BaseType *btp)
732  {
733  btp->print_dap4(d_xml, d_constrained);
734  }
735 };
736 
737 
738 void
739 Constructor::print_dap4(XMLWriter &xml, bool constrained)
740 {
741  if (constrained && !send_p())
742  return;
743 
744  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
745  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
746 
747  if (!name().empty())
748  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
749  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
750 
751  bool has_variables = (var_begin() != var_end());
752  if (has_variables)
753  for_each(var_begin(), var_end(), PrintDAP4FieldXMLWriter(xml, constrained));
754 
755  attributes()->print_dap4(xml);
756 
757  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
758  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
759 }
760 
761 
762 bool
763 Constructor::check_semantics(string &msg, bool all)
764 {
765  if (!BaseType::check_semantics(msg))
766  return false;
767 
768  if (!unique_names(d_vars, name(), type_name(), msg))
769  return false;
770 
771  if (all)
772  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
773  if (!(*i)->check_semantics(msg, true)) {
774  return false;
775  }
776  }
777 
778  return true;
779 }
780 
793 bool
795 {
796  return false;
797 }
798 
804 void
806 {
807  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
808  (*i)->set_in_selection(state);
809  }
810 
812 }
813 
822 void
823 Constructor::dump(ostream &strm) const
824 {
825  strm << DapIndent::LMarg << "Constructor::dump - ("
826  << (void *)this << ")" << endl ;
828  BaseType::dump(strm) ;
829  strm << DapIndent::LMarg << "vars: " << endl ;
831  Vars_citer i = d_vars.begin() ;
832  Vars_citer ie = d_vars.end() ;
833  for (; i != ie; i++) {
834  (*i)->dump(strm) ;
835  }
838 }
839 
840 } // namespace libdap
841 
void set_is_dap4(const bool v)
Definition: BaseType.h:167
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:421
virtual ~Constructor()
Definition: Constructor.cc:112
virtual void set_in_selection(bool state)
Set the in_selection property.
Definition: Constructor.cc:805
static void UnIndent()
Definition: DapIndent.cc:51
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:54
xmlTextWriterPtr get_writer()
Definition: XMLWriter.h:56
void m_duplicate(const Constructor &s)
Definition: Constructor.cc:69
virtual BaseType * var(const string &name, bool exact_match=true, btp_stack *s=0)
btp_stack no longer needed; use back pointers (BaseType::get_parent())
Definition: Constructor.cc:242
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48
std::vector< BaseType * >::reverse_iterator Vars_riter
Definition: Constructor.h:63
std::vector< BaseType * > d_vars
Definition: Constructor.h:49
virtual unsigned int width(bool constrained=false) const
Definition: Constructor.cc:224
bool is_dap4() const
Definition: BaseType.h:166
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
Definition: Constructor.cc:465
Read data from the stream made by D4StreamMarshaller.
std::vector< BaseType * >::iterator Vars_iter
Definition: Constructor.h:62
Vars_riter var_rend()
Definition: Constructor.cc:354
virtual std::string FQN() const
Definition: Constructor.cc:156
Definition: crc.h:76
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
Definition: Constructor.cc:524
BaseType * transform_to_dap4(D4Group *root, Constructor *dest)
DAP2 to DAP4 transform.
Definition: Constructor.cc:137
void print_xml_writer(XMLWriter &xml)
Definition: AttrTable.cc:1424
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
Definition: Constructor.cc:407
void timeout_off()
Definition: DDS.cc:894
virtual void add_var(BaseType *bt, Part part=nil)
Definition: Constructor.cc:382
Type
Identifies the data type.
Definition: Type.h:94
Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:306
Constructor & operator=(const Constructor &rhs)
Definition: Constructor.cc:121
virtual void set_in_selection(bool state)
Definition: BaseType.cc:624
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: Constructor.cc:169
stack< BaseType * > btp_stack
Definition: BaseType.h:149
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:639
A class for software fault reporting.
Definition: InternalErr.h:64
string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:299
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
Definition: Constructor.cc:666
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
Returns a pointer to a member of a constructor class.
Definition: BaseType.cc:664
#define DBG(x)
Definition: debug.h:58
string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:320
virtual bool is_linear()
Check to see whether this variable can be printed simply.
Definition: Constructor.cc:794
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
virtual void set_send_p(bool state)
Definition: BaseType.cc:498
Vars_riter var_rbegin()
Definition: Constructor.cc:346
const char * get_doc()
Definition: XMLWriter.cc:105
static void Indent()
Definition: DapIndent.cc:45
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net.
Definition: Constructor.cc:479
virtual BaseType * get_parent() const
Definition: BaseType.cc:657
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:237
BaseType * get_var_index(int i)
Definition: Constructor.cc:372
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
Definition: Constructor.cc:451
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: BaseType.cc:454
virtual D4Attributes * attributes()
Definition: BaseType.cc:529
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
Definition: Constructor.cc:763
virtual void dump(ostream &strm) const
dumps information about this object
Definition: Constructor.cc:823
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: Constructor.cc:514
virtual std::string FQN() const
Definition: BaseType.cc:273
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: Constructor.cc:624
string name() const
Returns the name of the class instance.
Definition: BaseType.cc:261
BaseType * m_leaf_match(const string &name, btp_stack *s=0)
Definition: Constructor.cc:269
std::vector< BaseType * >::const_iterator Vars_citer
Definition: Constructor.h:61
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:689
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
void timeout_on()
Definition: DDS.cc:886
Evaluate a constraint expression.
static ostream & LMarg(ostream &strm)
Definition: DapIndent.cc:80
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:512
The basic data type for the DODS DAP types.
Definition: BaseType.h:117
abstract base class used to marshal/serialize dap data objects
Definition: Marshaller.h:53
virtual void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
Definition: Constructor.cc:600
Vars_iter var_begin()
Definition: Constructor.cc:331
BaseType * m_exact_match(const string &name, btp_stack *s=0)
Definition: Constructor.cc:296
bool unique_names(vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)
Definition: util.cc:491
Vars_iter var_end()
Definition: Constructor.cc:339
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called ...
Vars_iter get_vars_iter(int i)
Definition: Constructor.cc:363
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:739
virtual void del_var(const string &name)
Definition: Constructor.cc:423
virtual void set_send_p(bool state)
Definition: Constructor.cc:183
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using XDR ...
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:484
string id2www(string in, const string &allowable)
Definition: escaping.cc:153
void print_dap4(XMLWriter &xml) const
unsigned int get_doc_size()
Definition: XMLWriter.cc:129
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: Constructor.cc:193
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
Definition: BaseType.cc:1111
virtual BaseType * transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: BaseType.cc:216