libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
D4Group.cc
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
4 // Access Protocol.
5 
6 // Copyright (c) 2013 OPeNDAP, Inc.
7 // Author: James Gallagher <jgallagher@opendap.org>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 #include "config.h"
26 
27 //#define DODS_DEBUG
28 
29 #include <cassert>
30 
31 #include <iostream>
32 #include <sstream>
33 #include <iomanip>
34 
35 #include <stdint.h>
36 
37 #include "crc.h"
38 
39 #include "BaseType.h"
40 #include "Array.h"
41 
42 #include "XMLWriter.h"
43 #include "D4Attributes.h"
44 #include "D4Dimensions.h"
45 #include "D4Group.h"
46 #include "D4Enum.h"
47 
48 #include "D4StreamMarshaller.h"
49 #include "D4StreamUnMarshaller.h"
50 
51 #include "debug.h"
52 
58 #undef INCLUDE_SOURCE_BYTE_ORDER
59 
60 namespace libdap {
61 
62 void D4Group::m_duplicate(const D4Group &g)
63 {
64  DBG(cerr << "In D4Group::m_duplicate for " << g.name() << endl);
65 
66  // dims; deep copy, this is the parent
67  if (g.d_dims) {
68  d_dims = new D4Dimensions(*(g.d_dims));
69  d_dims->set_parent(this);
70 
71  // Update all of the D4Dimension weak pointers in the Array objects.
72  // This is a hack - we know that Constructor::m_duplicate() has been
73  // called at this point and any Array instances have dimension pointers
74  // that reference the 'old' dimensions (g.d_dims) and not the 'new'
75  // dimensions made above. Scan every array and re-wire the weak pointers.
76  // jhrg 8/15/14
77  Vars_citer vi = d_vars.begin();
78  while (vi != d_vars.end()) {
79  if ((*vi)->type() == dods_array_c)
80  static_cast<Array*>(*vi)->update_dimension_pointers(g.d_dims, d_dims);
81  ++vi;
82  }
83  }
84 
85 #if 0
86  // Moved this block up inside the if because g.d_dims might be false. jhrg 9/14/15
87  Vars_citer vi = d_vars.begin();
88  while (vi != d_vars.end()) {
89  if ((*vi)->type() == dods_array_c)
90  static_cast<Array*>(*vi)->update_dimension_pointers(g.d_dims, d_dims);
91  ++vi;
92  }
93 #endif
94 
95  // enums; deep copy
96  if (g.d_enum_defs) d_enum_defs = new D4EnumDefs(*g.d_enum_defs);
97 
98  // groups
99  groupsCIter i = g.d_groups.begin();
100  while(i != g.d_groups.end()) {
101  // Only D4Groups are in the d_groups container.
102  D4Group *g = static_cast<D4Group*>((*i++)->ptr_duplicate());
103  add_group_nocopy(g);
104  }
105 
106  DBG(cerr << "Exiting D4Group::m_duplicate" << endl);
107 }
108 
119 D4Group::D4Group(const string &name)
120  : Constructor(name, dods_group_c, /*is_dap4*/true), d_dims(0), d_enum_defs(0)
121 {}
122 
133 D4Group::D4Group(const string &name, const string &dataset)
134  : Constructor(name, dataset, dods_group_c, /*is_dap4*/true), d_dims(0), d_enum_defs(0)
135 {}
136 
138 D4Group::D4Group(const D4Group &rhs) : Constructor(rhs), d_dims(0), d_enum_defs(0)
139 {
140  DBG(cerr << "In D4Group::copy_ctor for " << rhs.name() << endl);
141  m_duplicate(rhs);
142 }
143 
144 D4Group::~D4Group()
145 {
146  delete d_dims;
147  delete d_enum_defs;
148 
149  groupsIter i = d_groups.begin();
150  while(i != d_groups.end())
151  delete *i++;
152 }
153 
154 #if 0
155 D4Group *
156 
157 // I think this was a mistake. jhrg 11/17/16
158 #endif
159 BaseType *
161 {
162  return new D4Group(*this);
163 }
164 
165 D4Group &
166 D4Group::operator=(const D4Group &rhs)
167 {
168  if (this == &rhs)
169  return *this;
170 
171  dynamic_cast<Constructor &>(*this) = rhs; // run Constructor=
172 
173  m_duplicate(rhs);
174 
175  return *this;
176 }
177 
184 string
186 {
187  // The root group is named "/" (always)
188  return (name() == "/") ? "/" : static_cast<D4Group*>(get_parent())->FQN() + name() + "/";
189 }
190 
191 // Note that in order for this to work the second argument must not be a reference.
192 // jhrg 8/20/13
193 static bool
194 name_eq(D4Group *g, const string name)
195 {
196  return g->name() == name;
197 }
198 
199 D4Group *
200 D4Group::find_child_grp(const string &grp_name)
201 {
202  groupsIter g = find_if(grp_begin(), grp_end(), bind2nd(ptr_fun(name_eq), grp_name));
203  return (g == grp_end()) ? 0: *g;
204 }
205 
206 // TODO Add constraint param? jhrg 11/17/13
207 BaseType *
208 D4Group::find_first_var_that_uses_dimension(D4Dimension *dim)
209 {
210  // for each group, starting with the root group
211  // for each variable in the group that is marked to send and is an array
212  // return the btp if it uses the D4Dimension
213  // if it contains child groups, search those
214  // return the btp if it uses the D4Dimension
215  // return null
216 
217  // exhaustive breadth-first search for 'dim
218 
219  // root group
220  for (Vars_iter i = var_begin(), e = var_end(); i != e; ++i) {
221  if ((*i)->send_p() && (*i)->type() == dods_array_c) {
222  Array *a = static_cast<Array*>(*i);
223  for (Array::Dim_iter di = a->dim_begin(), de = a->dim_end(); di != de; ++di) {
224  if (a->dimension_D4dim(di) == dim)
225  return a;
226  }
227  }
228  }
229 
230  for (groupsIter i = grp_begin(), e = grp_end(); i != e; ++i) {
231  BaseType *btp = (*i)->find_first_var_that_uses_dimension(dim);
232  if (btp) return btp;
233  }
234 
235  return 0;
236 }
237 
238 BaseType *
239 D4Group::find_first_var_that_uses_enumeration(D4EnumDef *enum_def)
240 {
241  // for each group, starting with the root group
242  // for each variable in the group that is marked to send and is an array
243  // return the btp if it uses the D4EnumDef
244  // if it contains child groups, search those
245  // return the btp if it uses the D4EnumDef
246  // return null
247 
248  // exhaustive breadth-first search for 'dim
249 
250  // root group
251  for (Vars_iter i = var_begin(), e = var_end(); i != e; ++i) {
252  if ((*i)->send_p() && (*i)->type() == dods_enum_c) {
253  D4Enum *e = static_cast<D4Enum*>(*i);
254  if (e->enumeration() == enum_def)
255  return e;
256  }
257  }
258 
259  for (groupsIter i = grp_begin(), e = grp_end(); i != e; ++i) {
260  BaseType *btp = (*i)->find_first_var_that_uses_enumeration(enum_def);
261  if (btp) return btp;
262  }
263 
264  return 0;
265 }
266 
276 D4Dimension *
277 D4Group::find_dim(const string &path)
278 {
279  string lpath = path; // get a mutable copy
280 
281  // special-case for the root group
282  if (lpath[0] == '/') {
283  if (name() != "/")
284  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
285  else
286  lpath = lpath.substr(1);
287  }
288 
289  string::size_type pos = lpath.find('/');
290  if (pos == string::npos) {
291  // name looks like 'bar'
292  return dims()->find_dim(lpath);
293  }
294 
295  // name looks like foo/bar/baz where foo and bar must be groups
296  string grp_name = lpath.substr(0, pos);
297  lpath = lpath.substr(pos + 1);
298 
299  D4Group *grp = find_child_grp(grp_name);
300  return (grp == 0) ? 0: grp->find_dim(lpath);
301 }
302 
303 Array *
304 D4Group::find_map_source(const string &path)
305 {
306  BaseType *map_source = m_find_map_source_helper(path);
307 
308  // TODO more complete semantic checking jhrg 10/16/13
309  if (map_source && map_source->type() == dods_array_c) return static_cast<Array*>(map_source);
310 
311  return 0;
312 }
313 
314 BaseType *
315 D4Group::m_find_map_source_helper(const string &path)
316 {
317  string lpath = path; // get a mutable copy
318 
319  // special-case for the root group
320  if (lpath[0] == '/') {
321  if (name() != "/")
322  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
323  else
324  lpath = lpath.substr(1);
325  }
326 
327  string::size_type pos = lpath.find('/');
328  if (pos == string::npos) {
329  // name looks like 'bar'
330  return var(lpath);
331  }
332 
333  // name looks like foo/bar/baz where foo an bar must be groups
334  string grp_name = lpath.substr(0, pos);
335  lpath = lpath.substr(pos + 1);
336 
337  D4Group *grp = find_child_grp(grp_name);
338  return (grp == 0) ? 0: grp->var(lpath);
339 }
340 
341 D4EnumDef *
342 D4Group::find_enum_def(const string &path)
343 {
344  string lpath = path; // get a mutable copy
345 
346  // special-case for the root group
347  if (lpath[0] == '/') {
348  if (name() != "/")
349  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
350  else
351  lpath = lpath.substr(1);
352  }
353 
354  string::size_type pos = lpath.find('/');
355  if (pos == string::npos) {
356  // name looks like 'bar'
357  return enum_defs()->find_enum_def(lpath);
358  }
359 
360  // name looks like foo/bar/baz where foo and bar must be groups
361  string grp_name = lpath.substr(0, pos);
362  lpath = lpath.substr(pos + 1);
363 
364  D4Group *grp = find_child_grp(grp_name);
365  return (grp == 0) ? 0: grp->enum_defs()->find_enum_def(lpath);
366 }
367 
375 BaseType *
376 D4Group::find_var(const string &path)
377 {
378  string lpath = path; // get a mutable copy
379 
380  // special-case for the root group
381  if (lpath[0] == '/') {
382  if (name() != "/")
383  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
384  else
385  lpath = lpath.substr(1);
386  }
387 
388  string::size_type pos = lpath.find('/');
389  if (pos == string::npos) {
390  // name looks like 'bar' or bar.baz; lookup in the Constructor that's part of the Group
391  return var(lpath);
392  }
393 
394  // name looks like foo/bar/baz where foo and bar must be groups
395  string grp_name = lpath.substr(0, pos);
396  lpath = lpath.substr(pos + 1);
397 
398  D4Group *grp = find_child_grp(grp_name);
399  return (grp == 0) ? 0 : grp->find_var(lpath);
400 }
401 
408 long
409 D4Group::request_size(bool constrained)
410 {
411  long long size = 0;
412  // variables
413  Constructor::Vars_iter v = var_begin();
414  while (v != var_end()) {
415  if (constrained) {
416  if ((*v)->send_p())
417  size += (*v)->width(constrained);
418  }
419  else {
420  size += (*v)->width(constrained);
421  }
422 
423  ++v;
424  }
425 
426  // groups
427  groupsIter g = d_groups.begin();
428  while (g != d_groups.end())
429  size += (*g++)->request_size(constrained);
430 
431  return size / 1024;
432 }
433 
434 void
436 {
437  groupsIter g = d_groups.begin();
438  while (g != d_groups.end())
439  (*g++)->set_read_p(state);
440 
442 }
443 
444 void
446 {
447  groupsIter g = d_groups.begin();
448  while (g != d_groups.end())
449  (*g++)->set_send_p(state);
450 
452 }
453 
454 void
455 D4Group::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/)
456 {
457  groupsIter g = d_groups.begin();
458  while (g != d_groups.end())
459  (*g++)->intern_data(/*checksum, dmr, eval*/);
460 
461  // Specialize how the top-level variables in any Group are sent; include
462  // a checksum for them. A subset operation might make an interior set of
463  // variables, but the parent structure will still be present and the checksum
464  // will be computed for that structure. In other words, DAP4 does not try
465  // to sort out which variables are the 'real' top-level variables and instead
466  // simply computes the CRC for whatever appears as a variable in the root
467  // group.
468  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
469  // Only send the stuff in the current subset.
470  if ((*i)->send_p()) {
471 #if 0
472  checksum.Reset();
473 #endif
474  (*i)->intern_data(/*checksum, dmr, eval*/);
475 #if 0
476  D4Attribute *a = new D4Attribute("DAP4_Checksum_CRC32", attr_str_c);
477 
478  ostringstream oss;
479  oss.setf(ios::hex, ios::basefield);
480  oss << setfill('0') << setw(8) << checksum.GetCrc32();
481  a->add_value(oss.str());
482 #if INCLUDE_SOURCE_BYTE_ORDER
483  if (um.is_source_big_endian())
484  a->add_value("source:big-endian");
485  else
486  a->add_value("source:little-endian");
487 #endif
488  (*i)->attributes()->add_attribute_nocopy(a);
489  DBG(cerr << "CRC32: " << oss.str() << " for " << (*i)->name() << endl);
490 #endif
491  }
492  }
493 }
494 
506 void
507 D4Group::serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter)
508 {
509 #if 0
510  // This will call Constructor read which will, for everything but a Sequence,
511  // read all of the data in one shot. However, the serialize() methods for the
512  // Arrays, Structures, etc., also have read() calls in them and those can be
513  // used to control how long the data are in memory, e.g., limiting the lifetime
514  // of a large array and avoiding having overlapping arrays when they are not
515  // needed. For a sequence read() has different semantics. It is called once
516  // for every instance and the read_p flag is not used.
517  if (!read_p())
518  read(); // read() throws Error
519 #endif
520 
521  groupsIter g = d_groups.begin();
522  while (g != d_groups.end())
523  (*g++)->serialize(m, dmr, filter);
524 
525  // Specialize how the top-level variables in any Group are sent; include
526  // a checksum for them. A subset operation might make an interior set of
527  // variables, but the parent structure will still be present and the checksum
528  // will be computed for that structure. In other words, DAP4 does not try
529  // to sort out which variables are the 'real' top-level variables and instead
530  // simply computes the CRC for whatever appears as a variable in the root
531  // group.
532  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
533  // Only send the stuff in the current subset.
534  if ((*i)->send_p()) {
535  m.reset_checksum();
536 
537  DBG(cerr << "Serializing variable " << (*i)->type_name() << " " << (*i)->name() << endl);
538  (*i)->serialize(m, dmr, filter);
539 
540  DBG(cerr << "Wrote CRC32: " << m.get_checksum() << " for " << (*i)->name() << endl);
541  m.put_checksum();
542  }
543  }
544 }
545 
547 {
548  groupsIter g = d_groups.begin();
549  while (g != d_groups.end()) {
550  DBG(cerr << "Deserializing group " << (*g)->name() << endl);
551  (*g++)->deserialize(um, dmr);
552  }
553  // Specialize how the top-level variables in any Group are received; read
554  // their checksum and store the value in a magic attribute of the variable
555  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
556  DBG(cerr << "Deserializing variable " << (*i)->type_name() << " " << (*i)->name() << endl);
557  (*i)->deserialize(um, dmr);
558 
559  D4Attribute *a = new D4Attribute("DAP4_Checksum_CRC32", attr_str_c);
560  string crc = um.get_checksum_str();
561  a->add_value(crc);
562 #if INCLUDE_SOURCE_BYTE_ORDER
563  if (um.is_source_big_endian())
564  a->add_value("source:big-endian");
565  else
566  a->add_value("source:little-endian");
567 #endif
568  DBG(cerr << "Read CRC32: " << crc << " for " << (*i)->name() << endl);
569  (*i)->attributes()->add_attribute_nocopy(a);
570  }
571 }
572 
573 void
574 D4Group::print_dap4(XMLWriter &xml, bool constrained)
575 {
576  if (!name().empty() && name() != "/") {
577  // For named groups, if constrained is true only print if this group
578  // has variables that are marked for transmission. For the root group
579  // this test is not made.
580  if (constrained && !send_p())
581  return;
582 
583  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*) type_name().c_str()) < 0)
584  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
585 
586  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*) name().c_str()) < 0)
587  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
588  }
589 
590  // dims
591  if (!dims()->empty())
592  dims()->print_dap4(xml, constrained);
593 
594  // enums
595  if (!enum_defs()->empty())
596  enum_defs()->print_dap4(xml, constrained);
597 
598  // variables
599  Constructor::Vars_iter v = var_begin();
600  while (v != var_end())
601  (*v++)->print_dap4(xml, constrained);
602 
603  // attributes
604  attributes()->print_dap4(xml);
605 
606  // groups
607  groupsIter g = d_groups.begin();
608  while (g != d_groups.end())
609  (*g++)->print_dap4(xml, constrained);
610 
611  if (!name().empty() && name() != "/") {
612  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
613  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
614  }
615 }
616 #if 0
617 
633 vector<BaseType *> *
634 D4Group::transform_to_dap2(AttrTable *parent_attr_table)
635 {
636  return transform_to_dap2(parent_attr_table, false);
637 }
638 #endif
639 
662 vector<BaseType *> *
664 {
665  DBG( cerr << __func__ << "() - BEGIN ("<< name() << ")" << endl);
666 
667  vector<BaseType *> *results = new vector<BaseType *>(); // LEAK
668 
669  // Get the D4Group's attributes
670 #if 0
671  AttrTable *group_attrs = attributes()->get_AttrTable(name());
672 #else
673  AttrTable *group_attrs = new AttrTable();
674  attributes()->transform_attrs_to_dap2(group_attrs);
675  group_attrs->set_name(name());
676 #endif
677 
678  // If this is the root group then copy all of its attributes into the parent_attr_table.
679  // The group_attrs AttrTable* above will be replaced by the parent_attr_table.
680  bool is_root = (name() == "/");
681 
682  if (is_root) {
683  assert(name() == "/");
684  for (AttrTable::Attr_iter i = group_attrs->attr_begin(), e = group_attrs->attr_end(); i != e; ++i) {
685  if ((*i)->type == Attr_container) {
686  // copy the source container so that the DAS passed in can be
687  // deleted after calling this method.
688  AttrTable *at = new AttrTable(*(*i)->attributes);
689  parent_attr_table->append_container(at, at->get_name());
690  }
691  else {
692  parent_attr_table->append_attr((*i)->name, AttrType_to_String((*i)->type), (*i)->attr);
693  }
694  }
695  delete group_attrs;
696  group_attrs = parent_attr_table;
697  }
698 
699  // Now we process the child variables of this group
700 
701  vector<BaseType *> dropped_vars;
702  for (D4Group::Vars_citer i = var_begin(), e = var_end(); i != e; ++i) {
703 
704  DBG( cerr << __func__ << "() - Processing member variable '" << (*i)->name() <<
705  "' root: " << (is_root?"true":"false") << endl);
706 
707  vector<BaseType *> *new_vars = (*i)->transform_to_dap2(group_attrs);
708  if (new_vars) { // Might be un-mappable
709  // It's not so game on..
710  for (vector<BaseType*>::iterator vi = new_vars->begin(), ve = new_vars->end(); vi != ve; vi++) {
711  string new_name = (is_root ? "" : FQN()) + (*vi)->name();
712  (*vi)->set_name(new_name);
713  (*vi)->set_parent(NULL);
714  results->push_back((*vi));
715 #if 0
716  (*vi) = NULL;
717 #endif
718  DBG( cerr << __func__ << "() - Added member variable '" << (*i)->name() << "' " <<
719  "to results vector. root: "<< (is_root?"true":"false") << endl);
720  }
721 
722  delete new_vars;
723  }
724  else {
725  DBG( cerr << __func__ << "() - Dropping member variable " << (*i)->name() <<
726  " root: " << (is_root?"true":"false") << endl);
727  // Got back a NULL, so we are dropping this var.
728  dropped_vars.push_back(*i);
729  }
730  }
731 
732  // Process dropped DAP4 vars
733  DBG( cerr << __func__ << "() - Processing " << dropped_vars.size() << " Dropped Variable(s)" << endl);
734 
735  AttrTable *dv_attr_table = make_dropped_vars_attr_table(&dropped_vars);
736  if (dv_attr_table) {
737  group_attrs->append_container(dv_attr_table, dv_attr_table->get_name());
738  }
739 
740  // Get all the child groups.
741  for (D4Group::groupsIter gi = grp_begin(), ge = grp_end(); gi != ge; ++gi) {
742  vector<BaseType *> *d2_vars = (*gi)->transform_to_dap2(group_attrs);
743  if (d2_vars) {
744  for (vector<BaseType *>::iterator i = d2_vars->begin(), e = d2_vars->end(); i != e; ++i) {
745  results->push_back(*i);
746  }
747  }
748  delete d2_vars;
749  }
750 
751  if (!is_root) {
752  group_attrs->set_name(name());
753  parent_attr_table->append_container(group_attrs, group_attrs->get_name());
754  }
755 
756  return results;
757 }
758 
759 
760 } /* namespace libdap */
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:480
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:320
bool is_source_big_endian() const
Is the data source we are reading from a big-endian machine? We need this because the value of the CR...
virtual Attr_iter attr_end()
Definition: AttrTable.cc:719
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:267
Contains the attributes for a dataset.
Definition: AttrTable.h:142
string AttrType_to_String(const AttrType at)
Definition: AttrTable.cc:97
D4Dimension * find_dim(const string &path)
Find the dimension using a path. Using the DAP4 name syntax, lookup a dimension. The dimension must b...
Definition: D4Group.cc:277
virtual string get_name() const
Get the name of this attribute table.
Definition: AttrTable.cc:238
Read data from the stream made by D4StreamMarshaller.
D4Group(const string &name)
Definition: D4Group.cc:119
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false)
Serialize a Group.
Definition: D4Group.cc:507
top level DAP object to house generic methods
Definition: AISConnect.cc:30
A class for software fault reporting.
Definition: InternalErr.h:64
Dim_iter dim_end()
Definition: Array.cc:696
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
Holds a DAP4 enumeration.
Definition: D4Enum.h:61
virtual BaseType * ptr_duplicate()
Definition: D4Group.cc:160
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4&#39;s receiv...
long request_size(bool constrained)
Definition: D4Group.cc:409
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition: AttrTable.cc:410
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:365
std::vector< dimension >::iterator Dim_iter
Definition: Array.h:206
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
Definition: Constructor.cc:476
groupsIter grp_end()
Get an iterator to the end of the values.
Definition: D4Group.h:114
virtual D4Attributes * attributes()
Definition: BaseType.cc:599
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
Definition: D4Group.cc:546
virtual void intern_data()
Read data into this variable.
Definition: D4Group.cc:455
virtual Attr_iter attr_begin()
Definition: AttrTable.cc:711
groupsIter grp_begin()
Get an iterator to the start of the values.
Definition: D4Group.h:111
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
Transform the D4Group&#39;s variables to DAP2 variables.
Definition: D4Group.cc:663
virtual BaseType * get_parent() const
Definition: BaseType.cc:751
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
Definition: AttrTable.cc:307
The basic data type for the DODS DAP types.
Definition: BaseType.h:117
Dim_iter dim_begin()
Definition: Array.cc:690
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:379
Vars_iter var_begin()
Definition: Constructor.cc:356
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: D4Group.cc:574
virtual std::string FQN() const
Definition: D4Group.cc:185
Vars_iter var_end()
Definition: Constructor.cc:364
virtual void set_name(const string &n)
Set the name of this attribute table.
Definition: AttrTable.cc:245
virtual void put_checksum()
Write the checksum Write the checksum for the data sent since the last call to reset_checksum() to th...
D4EnumDefs * enum_defs()
Get the enumerations defined for this Group.
Definition: D4Group.h:97
virtual void set_send_p(bool state)
Definition: Constructor.cc:208
A multidimensional array of identical data types.
Definition: Array.h:112
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:554
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: D4Group.cc:435
virtual void set_send_p(bool state)
Definition: D4Group.cc:445
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:358
BaseType * find_var(const string &name)
Definition: D4Group.cc:376
D4Dimensions * dims()
Get the dimensions defined for this Group.
Definition: D4Group.h:82
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: Constructor.cc:218