libdap  Updated for version 3.20.9
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 D4Group *
192 D4Group::find_child_grp(const string &grp_name)
193 {
194  auto g = find_if(grp_begin(), grp_end(),
195  [grp_name](const D4Group *g) { return g->name() == grp_name; });
196  return (g == grp_end()) ? 0: *g;
197 }
198 
199 // TODO Add constraint param? jhrg 11/17/13
200 BaseType *
201 D4Group::find_first_var_that_uses_dimension(D4Dimension *dim)
202 {
203  // for each group, starting with the root group
204  // for each variable in the group that is marked to send and is an array
205  // return the btp if it uses the D4Dimension
206  // if it contains child groups, search those
207  // return the btp if it uses the D4Dimension
208  // return null
209 
210  // exhaustive breadth-first search for 'dim
211 
212  // root group
213  for (Vars_iter i = var_begin(), e = var_end(); i != e; ++i) {
214  if ((*i)->send_p() && (*i)->type() == dods_array_c) {
215  Array *a = static_cast<Array*>(*i);
216  for (Array::Dim_iter di = a->dim_begin(), de = a->dim_end(); di != de; ++di) {
217  if (a->dimension_D4dim(di) == dim)
218  return a;
219  }
220  }
221  }
222 
223  for (groupsIter i = grp_begin(), e = grp_end(); i != e; ++i) {
224  BaseType *btp = (*i)->find_first_var_that_uses_dimension(dim);
225  if (btp) return btp;
226  }
227 
228  return 0;
229 }
230 
231 BaseType *
232 D4Group::find_first_var_that_uses_enumeration(D4EnumDef *enum_def)
233 {
234  // for each group, starting with the root group
235  // for each variable in the group that is marked to send and is an array
236  // return the btp if it uses the D4EnumDef
237  // if it contains child groups, search those
238  // return the btp if it uses the D4EnumDef
239  // return null
240 
241  // exhaustive breadth-first search for 'dim
242 
243  // root group
244  for (Vars_iter i = var_begin(), e = var_end(); i != e; ++i) {
245  if ((*i)->send_p() && (*i)->type() == dods_enum_c) {
246  D4Enum *e = static_cast<D4Enum*>(*i);
247  if (e->enumeration() == enum_def)
248  return e;
249  }
250  }
251 
252  for (groupsIter i = grp_begin(), e = grp_end(); i != e; ++i) {
253  BaseType *btp = (*i)->find_first_var_that_uses_enumeration(enum_def);
254  if (btp) return btp;
255  }
256 
257  return 0;
258 }
259 
269 D4Dimension *
270 D4Group::find_dim(const string &path)
271 {
272  string lpath = path; // get a mutable copy
273 
274  // special-case for the root group
275  if (lpath[0] == '/') {
276  if (name() != "/")
277  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
278  else
279  lpath = lpath.substr(1);
280  }
281 
282  string::size_type pos = lpath.find('/');
283  if (pos == string::npos) {
284  // name looks like 'bar'
285  return dims()->find_dim(lpath);
286  }
287 
288  // name looks like foo/bar/baz where foo and bar must be groups
289  string grp_name = lpath.substr(0, pos);
290  lpath = lpath.substr(pos + 1);
291 
292  D4Group *grp = find_child_grp(grp_name);
293  return (grp == 0) ? 0: grp->find_dim(lpath);
294 }
295 
296 Array *
297 D4Group::find_map_source(const string &path)
298 {
299  BaseType *map_source = m_find_map_source_helper(path);
300 
301  // TODO more complete semantic checking jhrg 10/16/13
302  if (map_source && map_source->type() == dods_array_c) return static_cast<Array*>(map_source);
303 
304  return 0;
305 }
306 
307 BaseType *
308 D4Group::m_find_map_source_helper(const string &path)
309 {
310  string lpath = path; // get a mutable copy
311 
312  // special-case for the root group
313  if (lpath[0] == '/') {
314  if (name() != "/")
315  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
316  else
317  lpath = lpath.substr(1);
318  }
319 
320  string::size_type pos = lpath.find('/');
321  if (pos == string::npos) {
322  // name looks like 'bar'
323  return var(lpath);
324  }
325 
326  // name looks like foo/bar/baz where foo an bar must be groups
327  string grp_name = lpath.substr(0, pos);
328  lpath = lpath.substr(pos + 1);
329 
330  D4Group *grp = find_child_grp(grp_name);
331  return (grp == 0) ? 0: grp->var(lpath);
332 }
333 
334 D4EnumDef *
335 D4Group::find_enum_def(const string &path)
336 {
337  string lpath = path; // get a mutable copy
338 
339  // special-case for the root group
340  if (lpath[0] == '/') {
341  if (name() != "/")
342  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
343  else
344  lpath = lpath.substr(1);
345  }
346 
347  string::size_type pos = lpath.find('/');
348  if (pos == string::npos) {
349  // name looks like 'bar'
350  return enum_defs()->find_enum_def(lpath);
351  }
352 
353  // name looks like foo/bar/baz where foo and bar must be groups
354  string grp_name = lpath.substr(0, pos);
355  lpath = lpath.substr(pos + 1);
356 
357  D4Group *grp = find_child_grp(grp_name);
358  return (grp == 0) ? 0: grp->enum_defs()->find_enum_def(lpath);
359 }
360 
368 BaseType *
369 D4Group::find_var(const string &path)
370 {
371  string lpath = path; // get a mutable copy
372 
373  // special-case for the root group
374  if (lpath[0] == '/') {
375  if (name() != "/")
376  throw InternalErr(__FILE__, __LINE__, "Lookup of a FQN starting in non-root group.");
377  else
378  lpath = lpath.substr(1);
379  }
380 
381  string::size_type pos = lpath.find('/');
382  if (pos == string::npos) {
383  // name looks like 'bar' or bar.baz; lookup in the Constructor that's part of the Group
384  return var(lpath);
385  }
386 
387  // name looks like foo/bar/baz where foo and bar must be groups
388  string grp_name = lpath.substr(0, pos);
389  lpath = lpath.substr(pos + 1);
390 
391  D4Group *grp = find_child_grp(grp_name);
392  return (grp == 0) ? 0 : grp->find_var(lpath);
393 }
394 
401 long
402 D4Group::request_size(bool constrained)
403 {
404  long long size = 0;
405  // variables
406  Constructor::Vars_iter v = var_begin();
407  while (v != var_end()) {
408  if (constrained) {
409  if ((*v)->send_p())
410  size += (*v)->width(constrained);
411  }
412  else {
413  size += (*v)->width(constrained);
414  }
415 
416  ++v;
417  }
418 
419  // groups
420  groupsIter g = d_groups.begin();
421  while (g != d_groups.end())
422  size += (*g++)->request_size(constrained);
423 
424  return size / 1024;
425 }
426 
439 uint64_t D4Group::request_size_kb(bool constrained)
440 {
441  uint64_t size = 0;
442  // variables
443  Constructor::Vars_iter v = var_begin();
444  while (v != var_end()) {
445  if (constrained) {
446  if ((*v)->send_p())
447  size += (*v)->width(constrained);
448  }
449  else {
450  size += (*v)->width(constrained);
451  }
452  ++v;
453  }
454  // groups
455  groupsIter g = d_groups.begin();
456  while (g != d_groups.end())
457  size += (*g++)->request_size(constrained);
458 
459  return size / 1024;
460 }
461 
462 
463 void
465 {
466  groupsIter g = d_groups.begin();
467  while (g != d_groups.end())
468  (*g++)->set_read_p(state);
469 
471 }
472 
473 void
475 {
476  groupsIter g = d_groups.begin();
477  while (g != d_groups.end())
478  (*g++)->set_send_p(state);
479 
481 }
482 
483 void
484 D4Group::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/)
485 {
486  groupsIter g = d_groups.begin();
487  while (g != d_groups.end())
488  (*g++)->intern_data(/*checksum, dmr, eval*/);
489 
490  // Specialize how the top-level variables in any Group are sent; include
491  // a checksum for them. A subset operation might make an interior set of
492  // variables, but the parent structure will still be present and the checksum
493  // will be computed for that structure. In other words, DAP4 does not try
494  // to sort out which variables are the 'real' top-level variables and instead
495  // simply computes the CRC for whatever appears as a variable in the root
496  // group.
497  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
498  // Only send the stuff in the current subset.
499  if ((*i)->send_p()) {
500 #if 0
501  checksum.Reset();
502 #endif
503  (*i)->intern_data(/*checksum, dmr, eval*/);
504 #if 0
505  D4Attribute *a = new D4Attribute("DAP4_Checksum_CRC32", attr_str_c);
506 
507  ostringstream oss;
508  oss.setf(ios::hex, ios::basefield);
509  oss << setfill('0') << setw(8) << checksum.GetCrc32();
510  a->add_value(oss.str());
511 #if INCLUDE_SOURCE_BYTE_ORDER
512  if (um.is_source_big_endian())
513  a->add_value("source:big-endian");
514  else
515  a->add_value("source:little-endian");
516 #endif
517  (*i)->attributes()->add_attribute_nocopy(a);
518  DBG(cerr << "CRC32: " << oss.str() << " for " << (*i)->name() << endl);
519 #endif
520  }
521  }
522 }
523 
535 void
536 D4Group::serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter)
537 {
538 #if 0
539  // This will call Constructor read which will, for everything but a Sequence,
540  // read all of the data in one shot. However, the serialize() methods for the
541  // Arrays, Structures, etc., also have read() calls in them and those can be
542  // used to control how long the data are in memory, e.g., limiting the lifetime
543  // of a large array and avoiding having overlapping arrays when they are not
544  // needed. For a sequence read() has different semantics. It is called once
545  // for every instance and the read_p flag is not used.
546  if (!read_p())
547  read(); // read() throws Error
548 #endif
549 
550  groupsIter g = d_groups.begin();
551  while (g != d_groups.end())
552  (*g++)->serialize(m, dmr, filter);
553 
554  // Specialize how the top-level variables in any Group are sent; include
555  // a checksum for them. A subset operation might make an interior set of
556  // variables, but the parent structure will still be present and the checksum
557  // will be computed for that structure. In other words, DAP4 does not try
558  // to sort out which variables are the 'real' top-level variables and instead
559  // simply computes the CRC for whatever appears as a variable in the root
560  // group.
561  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
562  // Only send the stuff in the current subset.
563  if ((*i)->send_p()) {
564  m.reset_checksum();
565 
566  DBG(cerr << "Serializing variable " << (*i)->type_name() << " " << (*i)->name() << endl);
567  (*i)->serialize(m, dmr, filter);
568 
569  DBG(cerr << "Wrote CRC32: " << m.get_checksum() << " for " << (*i)->name() << endl);
570  m.put_checksum();
571  }
572  }
573 }
574 
576 {
577  groupsIter g = d_groups.begin();
578  while (g != d_groups.end()) {
579  DBG(cerr << "Deserializing group " << (*g)->name() << endl);
580  (*g++)->deserialize(um, dmr);
581  }
582  // Specialize how the top-level variables in any Group are received; read
583  // their checksum and store the value in a magic attribute of the variable
584  for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) {
585  DBG(cerr << "Deserializing variable " << (*i)->type_name() << " " << (*i)->name() << endl);
586  (*i)->deserialize(um, dmr);
587 
588  D4Attribute *a = new D4Attribute("DAP4_Checksum_CRC32", attr_str_c);
589  string crc = um.get_checksum_str();
590  a->add_value(crc);
591 #if INCLUDE_SOURCE_BYTE_ORDER
592  if (um.is_source_big_endian())
593  a->add_value("source:big-endian");
594  else
595  a->add_value("source:little-endian");
596 #endif
597  DBG(cerr << "Read CRC32: " << crc << " for " << (*i)->name() << endl);
598  (*i)->attributes()->add_attribute_nocopy(a);
599  }
600 }
601 
602 void
603 D4Group::print_dap4(XMLWriter &xml, bool constrained)
604 {
605  if (!name().empty() && name() != "/") {
606  // For named groups, if constrained is true only print if this group
607  // has variables that are marked for transmission. For the root group
608  // this test is not made.
609  if (constrained && !send_p())
610  return;
611 
612  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*) type_name().c_str()) < 0)
613  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
614 
615  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*) name().c_str()) < 0)
616  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
617  }
618 
619  // dims
620  if (!dims()->empty())
621  dims()->print_dap4(xml, constrained);
622 
623  // enums
624  if (!enum_defs()->empty())
625  enum_defs()->print_dap4(xml, constrained);
626 
627  // variables
628  Constructor::Vars_iter v = var_begin();
629  while (v != var_end())
630  (*v++)->print_dap4(xml, constrained);
631 
632  // attributes
633  attributes()->print_dap4(xml);
634 
635  // groups
636  groupsIter g = d_groups.begin();
637  while (g != d_groups.end())
638  (*g++)->print_dap4(xml, constrained);
639 
640  if (!name().empty() && name() != "/") {
641  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
642  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
643  }
644 }
645 #if 0
662 vector<BaseType *> *
663 D4Group::transform_to_dap2(AttrTable *parent_attr_table)
664 {
665  return transform_to_dap2(parent_attr_table, false);
666 }
667 #endif
691 vector<BaseType *> *
693 {
694  DBG( cerr << __func__ << "() - BEGIN ("<< name() << ")" << endl);
695 
696  vector<BaseType *> *results = new vector<BaseType *>(); // LEAK
697 
698  // Get the D4Group's attributes
699 #if 0
700  AttrTable *group_attrs = attributes()->get_AttrTable(name());
701 #else
702  AttrTable *group_attrs = new AttrTable();
703  attributes()->transform_attrs_to_dap2(group_attrs);
704  group_attrs->set_name(name());
705 #endif
706 
707  // If this is the root group then copy all of its attributes into the parent_attr_table.
708  // The group_attrs AttrTable* above will be replaced by the parent_attr_table.
709  bool is_root = (name() == "/");
710 
711  if (is_root) {
712  assert(name() == "/");
713  for (AttrTable::Attr_iter i = group_attrs->attr_begin(), e = group_attrs->attr_end(); i != e; ++i) {
714  if ((*i)->type == Attr_container) {
715  // copy the source container so that the DAS passed in can be
716  // deleted after calling this method.
717  AttrTable *at = new AttrTable(*(*i)->attributes);
718  parent_attr_table->append_container(at, at->get_name());
719  }
720  else {
721  parent_attr_table->append_attr((*i)->name, AttrType_to_String((*i)->type), (*i)->attr);
722  }
723  }
724  delete group_attrs;
725  group_attrs = parent_attr_table;
726  }
727 
728  // Now we process the child variables of this group
729 
730  vector<BaseType *> dropped_vars;
731  for (D4Group::Vars_citer i = var_begin(), e = var_end(); i != e; ++i) {
732 
733  DBG( cerr << __func__ << "() - Processing member variable '" << (*i)->name() <<
734  "' root: " << (is_root?"true":"false") << endl);
735 
736  vector<BaseType *> *new_vars = (*i)->transform_to_dap2(group_attrs);
737  if (new_vars) { // Might be un-mappable
738  // It's not so game on..
739  for (vector<BaseType*>::iterator vi = new_vars->begin(), ve = new_vars->end(); vi != ve; vi++) {
740  string new_name = (is_root ? "" : FQN()) + (*vi)->name();
741  (*vi)->set_name(new_name);
742  (*vi)->set_parent(NULL);
743  results->push_back((*vi));
744 #if 0
745  (*vi) = NULL;
746 #endif
747  DBG( cerr << __func__ << "() - Added member variable '" << (*i)->name() << "' " <<
748  "to results vector. root: "<< (is_root?"true":"false") << endl);
749  }
750 
751  delete new_vars;
752  }
753  else {
754  DBG( cerr << __func__ << "() - Dropping member variable " << (*i)->name() <<
755  " root: " << (is_root?"true":"false") << endl);
756  // Got back a NULL, so we are dropping this var.
757  dropped_vars.push_back(*i);
758  }
759  }
760 
761  // Process dropped DAP4 vars
762  DBG( cerr << __func__ << "() - Processing " << dropped_vars.size() << " Dropped Variable(s)" << endl);
763 
764  AttrTable *dv_attr_table = make_dropped_vars_attr_table(&dropped_vars);
765  if (dv_attr_table) {
766  group_attrs->append_container(dv_attr_table, dv_attr_table->get_name());
767  }
768 
769  // Get all the child groups.
770  for (D4Group::groupsIter gi = grp_begin(), ge = grp_end(); gi != ge; ++gi) {
771  vector<BaseType *> *d2_vars = (*gi)->transform_to_dap2(group_attrs);
772  if (d2_vars) {
773  for (vector<BaseType *>::iterator i = d2_vars->begin(), e = d2_vars->end(); i != e; ++i) {
774  results->push_back(*i);
775  }
776  }
777  delete d2_vars;
778  }
779 
780  if (!is_root) {
781  group_attrs->set_name(name());
782  parent_attr_table->append_container(group_attrs, group_attrs->get_name());
783  }
784 
785  return results;
786 }
787 
788 
789 } /* namespace libdap */
A multidimensional array of identical data types.
Definition: Array.h:113
std::vector< dimension >::iterator Dim_iter
Definition: Array.h:206
Contains the attributes for a dataset.
Definition: AttrTable.h:143
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition: AttrTable.cc:410
virtual void set_name(const string &n)
Set the name of this attribute table.
Definition: AttrTable.cc:245
virtual Attr_iter attr_end()
Definition: AttrTable.cc:719
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
Definition: AttrTable.cc:307
virtual Attr_iter attr_begin()
Definition: AttrTable.cc:711
virtual string get_name() const
Get the name of this attribute table.
Definition: AttrTable.cc:238
The basic data type for the DODS DAP types.
Definition: BaseType.h:118
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:379
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:320
virtual BaseType * get_parent() const
Definition: BaseType.cc:751
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:480
virtual D4Attributes * attributes()
Definition: BaseType.cc:599
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:554
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:126
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:365
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
Vars_iter var_end()
Definition: Constructor.cc:364
virtual void set_send_p(bool state)
Definition: Constructor.cc:208
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
Definition: Constructor.cc:476
Vars_iter var_begin()
Definition: Constructor.cc:356
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: Constructor.cc:218
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
D4Dimensions * dims()
Get the dimensions defined for this Group.
Definition: D4Group.h:83
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:270
virtual void intern_data()
Read data into this variable.
Definition: D4Group.cc:484
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: D4Group.cc:464
BaseType * find_var(const string &name)
Definition: D4Group.cc:369
virtual std::string FQN() const
Definition: D4Group.cc:185
groupsIter grp_begin()
Get an iterator to the start of the values.
Definition: D4Group.h:112
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
Definition: D4Group.cc:575
virtual void set_send_p(bool state)
Definition: D4Group.cc:474
uint64_t request_size_kb(bool constrained)
Get the estimated size of a response in kilobytes. This method looks at the variables in the DDS and ...
Definition: D4Group.cc:439
groupsIter grp_end()
Get an iterator to the end of the values.
Definition: D4Group.h:115
D4EnumDefs * enum_defs()
Get the enumerations defined for this Group.
Definition: D4Group.h:98
virtual BaseType * ptr_duplicate()
Definition: D4Group.cc:160
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
Transform the D4Group's variables to DAP2 variables.
Definition: D4Group.cc:692
long request_size(bool constrained)
Definition: D4Group.cc:402
D4Group(const string &name)
Definition: D4Group.cc:119
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: D4Group.cc:603
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false)
Serialize a Group.
Definition: D4Group.cc:536
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
virtual void put_checksum()
Write the checksum Write the checksum for the data sent since the last call to reset_checksum() to th...
Read data from the stream made by D4StreamMarshaller.
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...
A class for software fault reporting.
Definition: InternalErr.h:65
top level DAP object to house generic methods
Definition: AlarmHandler.h:36
string AttrType_to_String(const AttrType at)
Definition: AttrTable.cc:97