libdap  Updated for version 3.18.3
Constructor.cc
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 //#define DODS_DEBUG
36 
37 #include <string>
38 #include <sstream>
39 #include <algorithm>
40 #include <functional>
41 
42 #include <stdint.h>
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 
112 Constructor::~Constructor()
113 {
114  Vars_iter i = d_vars.begin();
115  while (i != d_vars.end()) {
116  delete *i++;
117  }
118 }
119 
120 Constructor &
121 Constructor::operator=(const Constructor &rhs)
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 
330 Constructor::Vars_iter
332 {
333  return d_vars.begin() ;
334 }
335 
338 Constructor::Vars_iter
340 {
341  return d_vars.end() ;
342 }
343 
345 Constructor::Vars_riter
347 {
348  return d_vars.rbegin();
349 }
350 
353 Constructor::Vars_riter
355 {
356  return d_vars.rend();
357 }
358 
362 Constructor::Vars_iter
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
437 Constructor::del_var(Vars_iter i)
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 #if USE_LOCAL_TIMEOUT_SCHEME
482  dds.timeout_on();
483 #endif
484  if (!read_p())
485  read(); // read() throws Error and InternalErr
486 
487  if (ce_eval && !eval.eval_selection(dds, dataset()))
488  return true;
489 #if USE_LOCAL_TIMEOUT_SCHEME
490  dds.timeout_off();
491 #endif
492  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
493  if ((*i)->send_p()) {
494 #ifdef CHECKSUMS
495  XDRStreamMarshaller *sm = dynamic_cast<XDRStreamMarshaller*>(&m);
496  if (sm && sm->checksums() && (*i)->type() != dods_structure_c && (*i)->type() != dods_grid_c)
497  sm->reset_checksum();
498 
499  (*i)->serialize(eval, dds, m, false);
500 
501  if (sm && sm->checksums() && (*i)->type() != dods_structure_c && (*i)->type() != dods_grid_c)
502  sm->get_checksum();
503 #else
504  // (*i)->serialize(eval, dds, m, false);
505  // Only Sequence and Vector run the evaluator.
506  (*i)->serialize(eval, dds, m, true);
507 #endif
508  }
509  }
510 
511  return true;
512 }
513 
514 bool
516 {
517  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
518  (*i)->deserialize(um, dds, reuse);
519  }
520 
521  return false;
522 }
523 
524 void
526 {
527  throw InternalErr(__FILE__, __LINE__, "Computing a checksum alone is not supported for Constructor types.");
528 }
529 
530 void
531 Constructor::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator & eval*/)
532 {
533  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
534  if ((*i)->send_p()) {
535  (*i)->intern_data(/*checksum, dmr, eval*/);
536  }
537  }
538 }
539 
540 
552 void
553 Constructor::serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter)
554 {
555 #if 1
556  // Not used for the same reason the equivalent code in D4Group::serialize()
557  // is not used. Fail for D4Sequence and general issues with memory use.
558  //
559  // Revisit this - I had to uncomment this to get the netcdf_handler code
560  // to work - it relies on having NCStructure::read() called. The D4Sequence
561  // ::serialize() method calls read_next_instance(). What seems to be happening
562  // is that this call to read gets the first set of values, but does not store
563  // them; the call to serialize then runs the D4Sequence::serialize() method that
564  // _does_ read all of the sequence data and then serialize it. However, the first
565  // sequence instance is missing...
566  if (!read_p())
567  read(); // read() throws Error
568 #endif
569 #if 0
570  // place holder for now. There may be no need for this; only Array and Seq?
571  // jhrg 9/6/13
572  if (filter && !eval.eval_selection(dmr, dataset()))
573  return true;
574 #endif
575 
576  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
577  if ((*i)->send_p()) {
578  (*i)->serialize(m, dmr, /*eval,*/ filter);
579  }
580  }
581 }
582 
583 void
585 {
586  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
587  (*i)->deserialize(um, dmr);
588  }
589 }
590 
591 void
592 Constructor::print_decl(FILE *out, string space, bool print_semi,
593  bool constraint_info, bool constrained)
594 {
595  ostringstream oss;
596  print_decl(oss, space, print_semi, constraint_info, constrained);
597  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
598 }
599 
600 void
601 Constructor::print_decl(ostream &out, string space, bool print_semi,
602  bool constraint_info, bool constrained)
603 {
604  if (constrained && !send_p())
605  return;
606 
607  out << space << type_name() << " {\n" ;
608  for (Vars_citer i = d_vars.begin(); i != d_vars.end(); i++) {
609  (*i)->print_decl(out, space + " ", true, constraint_info, constrained);
610  }
611  out << space << "} " << id2www(name()) ;
612 
613  if (constraint_info) { // Used by test drivers only.
614  if (send_p())
615  out << ": Send True";
616  else
617  out << ": Send False";
618  }
619 
620  if (print_semi)
621  out << ";\n" ;
622 }
623 
624 void
625 Constructor::print_val(FILE *out, string space, bool print_decl_p)
626 {
627  ostringstream oss;
628  print_val(oss, space, print_decl_p);
629  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
630 }
631 
632 void
633 Constructor::print_val(ostream &out, string space, bool print_decl_p)
634 {
635  if (print_decl_p) {
636  print_decl(out, space, false);
637  out << " = " ;
638  }
639 
640  out << "{ " ;
641  for (Vars_citer i = d_vars.begin(), e = d_vars.end(); i != e;
642  i++, (void)(i != e && out << ", ")) {
643 
644  DBG(cerr << (*i)->name() << " isa " << (*i)->type_name() << endl);
645 
646  (*i)->print_val(out, "", false);
647  }
648 
649  out << " }" ;
650 
651  if (print_decl_p)
652  out << ";\n" ;
653 }
654 
658 void
659 Constructor::print_xml(FILE *out, string space, bool constrained)
660 {
661  XMLWriter xml(space);
662  print_xml_writer(xml, constrained);
663  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
664 }
665 
669 void
670 Constructor::print_xml(ostream &out, string space, bool constrained)
671 {
672  XMLWriter xml(space);
673  print_xml_writer(xml, constrained);
674  out << xml.get_doc();
675 }
676 
677 class PrintFieldXMLWriter : public unary_function<BaseType *, void>
678 {
679  XMLWriter &d_xml;
680  bool d_constrained;
681 public:
682  PrintFieldXMLWriter(XMLWriter &x, bool c)
683  : d_xml(x), d_constrained(c)
684  {}
685 
686  void operator()(BaseType *btp)
687  {
688  btp->print_xml_writer(d_xml, d_constrained);
689  }
690 };
691 
692 void
694 {
695  if (constrained && !send_p())
696  return;
697 
698  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
699  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
700 
701  if (!name().empty())
702  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
703  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
704 
705  // DAP2 prints attributes first. For some reason we decided that DAP4 should
706  // print them second. No idea why... jhrg 8/15/14
707  if (!is_dap4() && get_attr_table().get_size() > 0)
709 
710  bool has_variables = (var_begin() != var_end());
711  if (has_variables)
712  for_each(var_begin(), var_end(), PrintFieldXMLWriter(xml, constrained));
713 
714  if (is_dap4())
715  attributes()->print_dap4(xml);
716 
717 #if 0
718  // Moved up above so that the DDX tests for various handles will still work.
719  // jhrg 8/15/14
720  if (!is_dap4() && get_attr_table().get_size() > 0)
722 #endif
723 
724  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
725  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
726 }
727 
728 class PrintDAP4FieldXMLWriter : public unary_function<BaseType *, void>
729 {
730  XMLWriter &d_xml;
731  bool d_constrained;
732 public:
733  PrintDAP4FieldXMLWriter(XMLWriter &x, bool c) : d_xml(x), d_constrained(c) {}
734 
735  void operator()(BaseType *btp)
736  {
737  btp->print_dap4(d_xml, d_constrained);
738  }
739 };
740 
741 
742 void
743 Constructor::print_dap4(XMLWriter &xml, bool constrained)
744 {
745  if (constrained && !send_p())
746  return;
747 
748  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
749  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
750 
751  if (!name().empty())
752  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
753  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
754 
755  bool has_variables = (var_begin() != var_end());
756  if (has_variables)
757  for_each(var_begin(), var_end(), PrintDAP4FieldXMLWriter(xml, constrained));
758 
759  attributes()->print_dap4(xml);
760 
761  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
762  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
763 }
764 
765 
766 bool
767 Constructor::check_semantics(string &msg, bool all)
768 {
769  if (!BaseType::check_semantics(msg))
770  return false;
771 
772  if (!unique_names(d_vars, name(), type_name(), msg))
773  return false;
774 
775  if (all)
776  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
777  if (!(*i)->check_semantics(msg, true)) {
778  return false;
779  }
780  }
781 
782  return true;
783 }
784 
797 bool
799 {
800  return false;
801 }
802 
808 void
810 {
811  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
812  (*i)->set_in_selection(state);
813  }
814 
816 }
817 
826 void
827 Constructor::dump(ostream &strm) const
828 {
829  strm << DapIndent::LMarg << "Constructor::dump - ("
830  << (void *)this << ")" << endl ;
831  DapIndent::Indent() ;
832  BaseType::dump(strm) ;
833  strm << DapIndent::LMarg << "vars: " << endl ;
834  DapIndent::Indent() ;
835  Vars_citer i = d_vars.begin() ;
836  Vars_citer ie = d_vars.end() ;
837  for (; i != ie; i++) {
838  (*i)->dump(strm) ;
839  }
840  DapIndent::UnIndent() ;
841  DapIndent::UnIndent() ;
842 }
843 
844 } // namespace libdap
845 
virtual unsigned int width(bool constrained=false) const
Definition: Constructor.cc:224
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:425
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:265
virtual void set_in_selection(bool state)
Set the in_selection property.
Definition: Constructor.cc:809
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:54
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1085
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:236
virtual std::string FQN() const
Definition: Constructor.cc:156
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
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1055
Read data from the stream made by D4StreamMarshaller.
Vars_riter var_rend()
Definition: Constructor.cc:354
Definition: crc.h:76
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:125
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:525
STL namespace.
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
virtual void add_var(BaseType *bt, Part part=nil)
Definition: Constructor.cc:382
Type
Identifies the data type.
Definition: Type.h:94
virtual void set_in_selection(bool state)
Definition: BaseType.cc:639
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: Constructor.cc:169
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:654
A class for software fault reporting.
Definition: InternalErr.h:64
virtual std::string FQN() const
Definition: BaseType.cc:277
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
Definition: Constructor.cc:670
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:679
virtual bool is_linear()
Check to see whether this variable can be printed simply.
Definition: Constructor.cc:798
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4&#39;s receiv...
virtual void set_send_p(bool state)
Definition: BaseType.cc:513
Vars_riter var_rbegin()
Definition: Constructor.cc:346
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net, then remove them from the object.
Definition: Constructor.cc:479
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:310
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:461
virtual D4Attributes * attributes()
Definition: BaseType.cc:544
virtual bool check_semantics(string &msg, bool all=false)
Compare an object&#39;s current state with the semantics of its type.
Definition: Constructor.cc:767
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: Constructor.cc:515
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: Constructor.cc:625
virtual void dump(ostream &strm) const
dumps information about this object
Definition: Constructor.cc:827
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:693
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
Evaluate a constraint expression.
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:527
virtual BaseType * get_parent() const
Definition: BaseType.cc:672
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:50
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:601
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:324
Vars_iter var_begin()
Definition: Constructor.cc:331
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 and is called ...
Vars_iter get_vars_iter(int i)
Definition: Constructor.cc:363
virtual void intern_data()
Read data into this variable.
Definition: Constructor.cc:531
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:743
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 serialize dap data objects to a C++ iostream using XDR. ...
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:499
string id2www(string in, const string &allowable)
Definition: escaping.cc:153
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:303
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&#39;s current state with the semantics of its type.
Definition: BaseType.cc:1130
virtual BaseType * transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: BaseType.cc:215