libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
D4Enum.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) 2013 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 #include "config.h"
27 
28 // #define DODS_DEBUG
29 
30 #include <cassert>
31 #include <sstream>
32 
33 #include <libxml/encoding.h>
34 
35 #include "Byte.h" // synonymous with UInt8 and Char
36 #include "Int8.h"
37 #include "Int16.h"
38 #include "UInt16.h"
39 #include "Int32.h"
40 #include "UInt32.h"
41 #include "Int64.h"
42 #include "UInt64.h"
43 
44 #include "D4Group.h"
45 #include "D4Enum.h"
46 #include "D4EnumDefs.h"
47 #include "D4Attributes.h"
48 
49 #include "Float32.h"
50 #include "Float64.h"
51 
52 #include "D4StreamMarshaller.h"
53 #include "D4StreamUnMarshaller.h"
54 
55 #include "Operators.h"
56 #include "InternalErr.h"
57 #include "dods-datatypes.h"
58 #include "dods-limits.h"
59 #include "util.h"
60 #include "debug.h"
61 #include "DapIndent.h"
62 
63 using std::cerr;
64 using std::endl;
65 
66 namespace libdap {
67 
68 // Private
69 void D4Enum::m_duplicate(const D4Enum &src)
70 {
71  d_buf = src.d_buf;
72  d_element_type = src.d_element_type;
73  d_enum_def = src.d_enum_def;
74 #if 0
75  // The enum_def is a weak pointer managed by D4Group. We just copy it
76  // and do not delete it. jhrg 10/19/15
77  d_enum_def = src.d_enum_def == 0 ? 0 : new D4EnumDef(*(src.d_enum_def));
78 #endif
79  d_is_signed = src.d_is_signed;
80 }
81 
91 vector<BaseType *> *
93 {
94  BaseType *btp;
95 
96  DBG(cerr << __func__ << "() - BEGIN" << endl;);
97 
98  switch (d_element_type) {
99  case dods_byte_c:
100  case dods_int8_c:
101  case dods_uint8_c: {
102  Byte *var = new Byte(name());
103  dods_byte val;
104  this->value(&val);
105  var->set_value(val);
106  btp = var;
107  break;
108  }
109  case dods_uint16_c: {
110  UInt16 *var = new UInt16(name());
111  dods_uint16 val;
112  this->value(&val);
113  var->set_value(val);
114  btp = var;
115  break;
116  }
117  case dods_uint32_c: {
118  UInt32 *var = new UInt32(name());
119  dods_uint32 val;
120  this->value(&val);
121  var->set_value(val);
122  btp = var;
123  break;
124  }
125  case dods_uint64_c: {
126  UInt64 *var = new UInt64(name());
127  dods_uint64 val;
128  this->value(&val);
129  var->set_value(val);
130  btp = var;
131  break;
132  }
133  case dods_int16_c: {
134  Int16 *var = new Int16(name());
135  dods_int16 val;
136  this->value(&val);
137  var->set_value(val);
138  btp = var;
139  break;
140  }
141  case dods_int32_c: {
142  Int32 *var = new Int32(name());
143  dods_int32 val;
144  this->value(&val);
145  var->set_value(val);
146  btp = var;
147  break;
148  }
149  case dods_int64_c: {
150  Int64 *var = new Int64(name());
151  dods_int64 val;
152  this->value(&val);
153  var->set_value(val);
154  btp = var;
155  break;
156  }
157  default: {
158  ostringstream oss;
159  oss << "Unknown D4Enum type:" << d_element_type << ", name: " << name() << endl;
160  throw InternalErr(__FILE__, __LINE__, oss.str());
161  }
162  }
163 
164  DBG( cerr << __func__ << "() - Processing Enum type:"<<
165  btp->type_name() << " name: " << btp->name() << endl;);
166 
167  // Grab the attributes!
168 #if 0
169  AttrTable d2_attrs = *(this->attributes()->get_AttrTable(name()));
170  btp->set_attr_table(d2_attrs);
171 #else
172  if (btp->get_attr_table().get_size() == 0) {
174  btp->get_attr_table().set_name(name());
175  }
176 #endif
177 
178  // make the Enum label, and the enum's definition into DAP2 attributes for our returned item.
179  long long my_value;
180  this->value(&my_value);
181 
182  DBG(cerr << __func__ << "() - value: "<< my_value << endl;);
183 
184  string my_label = "";
185  AttrTable *enum_def = new AttrTable();
186  enum_def->set_name("d4:enum_def");
187 
188  D4EnumDef::D4EnumValueIter dIter = d_enum_def->value_begin();
189  D4EnumDef::D4EnumValueIter dEnd = d_enum_def->value_end();
190  while (dIter != dEnd) {
191  long long a_value = (*dIter).value;
192  string a_label = (*dIter).label;
193  ostringstream oss;
194  oss << a_value;
195  DBG(cerr << __func__ << "() - a_value: "<< a_value << endl;);
196  enum_def->append_attr(a_label, btp->type_name(), oss.str());
197  if (a_value == my_value) {
198  my_label = (*dIter).label;
199  }
200  dIter++;
201  }
202 
203  if (!my_label.empty()) btp->get_attr_table().append_attr("d4:enum_label", "String", my_label);
204 
205  btp->get_attr_table().append_container(enum_def, enum_def->get_name());
206 
207  vector<BaseType *> *result = new vector<BaseType *>();
208  result->push_back(btp);
209  DBG(cerr << __func__ << "() - END" << endl;);
210  return result;
211 }
212 
213 void D4Enum::m_check_value(int64_t v) const
214 {
215  switch (d_element_type) {
216  case dods_byte_c:
217  case dods_uint8_c:
218  if ((uint64_t)v > DODS_UCHAR_MAX || v < 0) {
219  ostringstream oss;
220  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
221  throw Error(oss.str());
222  }
223  break;
224  case dods_uint16_c:
225  if ((uint64_t)v > DODS_USHRT_MAX || v < 0) {
226  ostringstream oss;
227  oss << "The value " << v << " will not fit in an unsigned 16-bit integer. (" << __func__ << ")";
228  throw Error(oss.str());
229  }
230  break;
231  case dods_uint32_c:
232  if ((uint64_t)v > DODS_UINT_MAX || v < 0) {
233  ostringstream oss;
234  oss << "The value " << v << " will not fit in an unsigned 32-bit integer. (" << __func__ << ")";
235  throw Error(oss.str());
236  }
237  break;
238  case dods_uint64_c:
239  // If 'v' can never be bigger than ULLONG_MAX
240  break;
241 
242  case dods_int8_c:
243  if (v > DODS_SCHAR_MAX || v < DODS_SCHAR_MIN) {
244  ostringstream oss;
245  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
246  throw Error(oss.str());
247  }
248 
249  break;
250  case dods_int16_c:
251  if (v > DODS_SHRT_MAX || v < DODS_SHRT_MIN) {
252  ostringstream oss;
253  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
254  throw Error(oss.str());
255  }
256  break;
257  case dods_int32_c:
258  if (v > DODS_INT_MAX || v < DODS_INT_MIN) {
259  ostringstream oss;
260  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
261  throw Error(oss.str());
262  }
263  break;
264  case dods_int64_c:
265  // There's no value 'v' can have that won't fit into a 64-bit int.
266  break;
267  default:
268  assert(!"illegal type for D4Enum");
269  }
270 }
271 
272 D4Enum::D4Enum(const string &name, const string &enum_type) :
273  BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(dods_null_c), d_enum_def(0)
274 {
275  d_element_type = get_type(enum_type.c_str());
276 
277  if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c;
278  set_is_signed(d_element_type);
279 }
280 
281 D4Enum::D4Enum(const string &name, Type type) :
282  BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(type), d_enum_def(0)
283 {
284  if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c;
285  set_is_signed(d_element_type);
286 }
287 
288 D4Enum::D4Enum(const string &name, const string &dataset, Type type) :
289  BaseType(name, dataset, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(type), d_enum_def(0)
290 {
291  if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c;
292  set_is_signed(d_element_type);
293 }
294 
295 // Explicit instantiation of the template member function 'value(T *)'.
296 // This is required in order to have the library contain these member
297 // functions when its own code does not use them. Normally, C++ instantiates
298 // templates when they are used, and this forces that process so the
299 // library file contains the various versions of the member function.
300 template void D4Enum::value<dods_byte>(dods_byte *v) const;
301 template void D4Enum::value<dods_int16>(dods_int16 *v) const;
302 template void D4Enum::value<dods_uint16>(dods_uint16 *v) const;
303 template void D4Enum::value<dods_int32>(dods_int32 *v) const;
304 template void D4Enum::value<dods_uint32>(dods_uint32 *v) const;
305 template void D4Enum::value<dods_int64>(dods_int64 *v) const;
306 template void D4Enum::value<dods_uint64>(dods_uint64 *v) const;
307 
308 template void D4Enum::set_value<dods_byte>(dods_byte v, bool check_value);
309 template void D4Enum::set_value<dods_int16>(dods_int16 v, bool check_value);
310 template void D4Enum::set_value<dods_uint16>(dods_uint16 v, bool check_value);
311 template void D4Enum::set_value<dods_int32>(dods_int32 v, bool check_value);
312 template void D4Enum::set_value<dods_uint32>(dods_uint32 v, bool check_value);
313 template void D4Enum::set_value<dods_int64>(dods_int64 v, bool check_value);
314 template void D4Enum::set_value<dods_uint64>(dods_uint64 v, bool check_value);
315 
316 void
317 D4Enum::set_enumeration(D4EnumDef *enum_def) {
318  d_enum_def = enum_def;
319  d_element_type = enum_def->type();
320 }
321 
322 void
324 {
325  DBG(cerr << __func__ << ": element type: " << ::libdap::type_name(d_element_type) << endl);
326 
327  switch (d_element_type) {
328  case dods_byte_c:
329  case dods_uint8_c:
330  case dods_int8_c: {
331  dods_byte v = static_cast<dods_byte>(d_buf);
332  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint8_t));
333  break;
334  }
335  case dods_uint16_c:
336  case dods_int16_c: {
337  dods_int16 v = static_cast<dods_int16>(d_buf);
338  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint16_t));
339  break;
340  }
341  case dods_uint32_c:
342  case dods_int32_c: {
343  dods_int32 v = static_cast<dods_int32>(d_buf);
344  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint32_t));
345  break;
346  }
347  case dods_uint64_c:
348  case dods_int64_c:
349  checksum.AddData(reinterpret_cast<uint8_t*>(&d_buf), sizeof(uint64_t));
350  break;
351 
352  default:
353  assert(!"illegal type for D4Enum");
354  }
355 }
356 
357 void
358 D4Enum::set_is_signed(Type t)
359 {
360  switch (t) {
361  case dods_byte_c:
362  case dods_uint8_c:
363  case dods_uint16_c:
364  case dods_uint32_c:
365  case dods_uint64_c:
366  d_is_signed = false;
367  break;
368 
369  case dods_int8_c:
370  case dods_int16_c:
371  case dods_int32_c:
372  case dods_int64_c:
373  d_is_signed = true;
374  break;
375 
376  default:
377 #if 0
378  // I removed this because it hinders testing and is no better
379  // than throwing an exception. jhrg 3/29/18
380  assert(!"illegal type for D4Enum");
381 #endif
382  throw InternalErr(__FILE__, __LINE__, "Illegal type");
383  }
384 }
385 
398 void
399 D4Enum::serialize(D4StreamMarshaller &m, DMR &, /*ConstraintEvaluator &,*/ bool)
400 {
401  if (!read_p())
402  read(); // read() throws Error
403 
404  switch (d_element_type) {
405  case dods_byte_c:
406  case dods_uint8_c:
407  m.put_byte(d_buf);
408  break;
409  case dods_uint16_c:
410  m.put_uint16(d_buf);
411  break;
412  case dods_uint32_c:
413  m.put_uint32(d_buf);
414  break;
415  case dods_uint64_c:
416  m.put_uint64(d_buf);
417  break;
418 
419  case dods_int8_c:
420  m.put_int8(d_buf);
421  break;
422  case dods_int16_c:
423  m.put_int16(d_buf);
424  break;
425  case dods_int32_c:
426  m.put_int32(d_buf);
427  break;
428  case dods_int64_c:
429  m.put_int64(d_buf);
430  break;
431  default:
432  assert(!"illegal type for D4Enum");
433  }
434 }
435 
436 void
438 {
439  switch (d_element_type) {
440  case dods_byte_c:
441  case dods_uint8_c: {
442  dods_byte v;
443  um.get_byte(v);
444  d_buf = v;
445  break;
446  }
447  case dods_uint16_c: {
448  dods_uint16 v;
449  um.get_uint16(v);
450  d_buf = v;
451  break;
452  }
453  case dods_uint32_c: {
454  dods_uint32 v;
455  um.get_uint32(v);
456  d_buf = v;
457  break;
458  }
459  case dods_uint64_c: {
460  dods_uint64 v;
461  um.get_uint64(v);
462  d_buf = v;
463  break;
464  }
465 
466  case dods_int8_c: {
467  dods_int8 v;
468  um.get_int8(v);
469  d_buf = v;
470  break;
471  }
472  case dods_int16_c: {
473  dods_int16 v;
474  um.get_int16(v);
475  d_buf = v;
476  break;
477  }
478  case dods_int32_c: {
479  dods_int32 v;
480  um.get_int32(v);
481  d_buf = v;
482  break;
483  }
484  case dods_int64_c: {
485  dods_int64 v;
486  um.get_int64(v);
487  d_buf = v;
488  break;
489  }
490  default:
491  assert(!"illegal type for D4Enum");
492  }
493 }
494 
495 unsigned int D4Enum::val2buf(void *val, bool)
496 {
497  if (!val)
498  throw InternalErr("The incoming pointer does not contain any data.");
499 
500  switch (d_element_type) {
501  case dods_byte_c:
502  case dods_uint8_c:
503  d_buf = *(dods_byte*)val;
504  break;
505  case dods_uint16_c:
506  d_buf = *(dods_uint16*)val;
507  break;
508  case dods_uint32_c:
509  d_buf = *(dods_uint32*)val;
510  break;
511  case dods_uint64_c:
512  d_buf = *(dods_uint64*)val;
513  break;
514 
515  case dods_int8_c:
516  d_buf = *(dods_int8*)val;
517  break;
518  case dods_int16_c:
519  d_buf = *(dods_int16*)val;
520  break;
521  case dods_int32_c:
522  d_buf = *(dods_int32*)val;
523  break;
524  case dods_int64_c:
525  d_buf = *(dods_int64*)val;
526  break;
527  default:
528  assert(!"illegal type for D4Enum");
529  }
530 
531  return width();
532 }
533 
534 unsigned int D4Enum::buf2val(void **val)
535 {
536  if (!val)
537  throw InternalErr("NULL pointer");
538 
539  switch (d_element_type) {
540  case dods_byte_c:
541  case dods_uint8_c:
542  if (!*val) *val = new dods_byte;
543  *(dods_byte *) * val = d_buf;
544  break;
545  case dods_uint16_c:
546  if (!*val) *val = new dods_uint16;
547  *(dods_uint16 *) * val = d_buf;
548  break;
549  case dods_uint32_c:
550  if (!*val) *val = new dods_uint32;
551  *(dods_uint32 *) * val = d_buf;
552  break;
553  case dods_uint64_c:
554  if (!*val) *val = new dods_uint64;
555  *(dods_uint64 *) * val = d_buf;
556  break;
557 
558  case dods_int8_c:
559  if (!*val) *val = new dods_int8;
560  *(dods_int8*) * val = d_buf;
561  break;
562  case dods_int16_c:
563  if (!*val) *val = new dods_int16;
564  *(dods_int16 *) * val = d_buf;
565  break;
566  case dods_int32_c:
567  if (!*val) *val = new dods_int32;
568  *(dods_int32 *) * val = d_buf;
569  break;
570  case dods_int64_c:
571  if (!*val) *val = new dods_int64;
572  *(dods_int64 *) * val = d_buf;
573  break;
574  default:
575  assert(!"illegal type for D4Enum");
576  }
577 
578  return width();
579 }
580 
581 void D4Enum::print_val(ostream &out, string space, bool print_decl_p)
582 {
583  if (print_decl_p) {
584  print_decl(out, space, false);
585  out << " = ";
586  }
587 
588  DBG(cerr << "Enum union value: " << hex << d_buf << dec << endl);
589 
590  if (is_signed()) {
591  int64_t v;
592  value(&v);
593  out << v;
594  }
595  else {
596  uint64_t v;
597  value(&v);
598  out << v;
599  }
600 
601  if (print_decl_p)
602  out << ";" << endl;
603 }
604 
611 void
612 D4Enum::print_xml_writer(XMLWriter &xml, bool constrained)
613 {
614  if (constrained && !send_p())
615  return;
616 
617  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)"Enum") < 0)
618  throw InternalErr(__FILE__, __LINE__, "Could not write Enum element");
619 
620  if (!name().empty())
621  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
622  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
623 
624 
625  string path = d_enum_def->name();
626  // Not every D4EnumDef is a member of an instance of D4EnumDefs - the D4EnumDefs instance
627  // holds a reference to the D4Group that holds the Enum definitions.
628  // TODO Should this be changed - so the EnumDef holds a reference to its parent Group?
629  if (d_enum_def->parent()) {
630  // print the FQN for the enum def; D4Group::FQN() includes the trailing '/'
631  path = static_cast<D4Group*>(d_enum_def->parent()->parent())->FQN() + path;
632  }
633  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "enum", (const xmlChar*)path.c_str()) < 0)
634  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for enum");
635 
636  attributes()->print_dap4(xml);
637 
638  if (get_attr_table().get_size() > 0)
640 
641  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
642  throw InternalErr(__FILE__, __LINE__, "Could not end Enum element");
643 }
644 
645 
646 bool
648 {
649  // Get the arg's value.
650  if (!read_p() && !read())
651  throw InternalErr(__FILE__, __LINE__, "This value not read!");
652 
653  // Get the second arg's value.
654  if (!b->read_p() && !b->read())
655  throw InternalErr(__FILE__, __LINE__, "This value not read!");
656 
657  switch (b->type()) {
658  case dods_int8_c:
659  return Cmp<dods_int64, dods_int8>(op, d_buf, static_cast<Int8*>(b)->value());
660  case dods_byte_c:
661  return Cmp<dods_int64, dods_byte>(op, d_buf, static_cast<Byte*>(b)->value());
662  case dods_int16_c:
663  return Cmp<dods_int64, dods_int16>(op, d_buf, static_cast<Int16*>(b)->value());
664  case dods_uint16_c:
665  return Cmp<dods_int64, dods_uint16>(op, d_buf, static_cast<UInt16*>(b)->value());
666  case dods_int32_c:
667  return Cmp<dods_int64, dods_int32>(op, d_buf, static_cast<Int32*>(b)->value());
668  case dods_uint32_c:
669  return Cmp<dods_int64, dods_uint32>(op, d_buf, static_cast<UInt32*>(b)->value());
670 #if 0
671  // FIXME
672  case dods_int64_c:
673  return Cmp<dods_int64, dods_int64>(op, d_buf, static_cast<D4Enum*>(b)->value());
674  case dods_uint64_c:
675  return Cmp<dods_int64, dods_uint64>(op, d_buf, static_cast<D4Enum*>(b)->value());
676 #endif
677  case dods_float32_c:
678  return Cmp<dods_int64, dods_float32>(op, d_buf, static_cast<Float32*>(b)->value());
679  case dods_float64_c:
680  return Cmp<dods_int64, dods_float64>(op, d_buf, static_cast<Float64*>(b)->value());
681  default:
682  return false;
683  }
684 }
685 
694 void
695 D4Enum::dump(ostream &strm) const
696 {
697  strm << DapIndent::LMarg << "D4Enum::dump - (" << (void *) this << ")" << endl;
698  DapIndent::Indent();
699  BaseType::dump(strm);
700  strm << DapIndent::LMarg << "value: " << d_buf << endl;
701  DapIndent::UnIndent();
702 }
703 
704 } // namespace libdap
705 
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:899
Holds an 8-bit signed integer value.
Definition: Int8.h:42
Holds a64-bit signed integer.
Definition: Int64.h:49
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
virtual void print_decl(FILE *out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
Definition: BaseType.cc:1003
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:291
unsigned int val2buf(void *, bool)
Loads class data.
Definition: D4Enum.cc:495
Contains the attributes for a dataset.
Definition: AttrTable.h:142
virtual unsigned int width(bool=false) const
Return the number of bytes in an instance of an Enum. This returns the number of bytes an instance of...
Definition: D4Enum.h:175
virtual string get_name() const
Get the name of this attribute table.
Definition: AttrTable.cc:238
Read data from the stream made by D4StreamMarshaller.
Holds an unsigned 16-bit integer.
Definition: UInt16.h:57
Definition: crc.h:76
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:126
void print_xml_writer(XMLWriter &xml)
Definition: AttrTable.cc:1425
virtual void print_val(ostream &out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: D4Enum.cc:581
Type
Identifies the data type.
Definition: Type.h:94
Holds a 32-bit floating point value.
Definition: Float32.h:61
top level DAP object to house generic methods
Definition: AISConnect.cc:30
A class for software fault reporting.
Definition: InternalErr.h:64
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
Convert an Enum to a DAP2 int type.
Definition: D4Enum.cc:92
virtual std::string FQN() const
Definition: BaseType.cc:332
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
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:758
Holds a DAP4 enumeration.
Definition: D4Enum.h:61
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false)
Serialize a D4Enum Use the (integer) data type associated with an Enumeration definition to serialize...
Definition: D4Enum.cc:399
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4&#39;s receiv...
Holds a 16-bit signed integer value.
Definition: Int16.h:59
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition: AttrTable.cc:410
virtual void dump(ostream &strm) const
dumps information about this object
Definition: D4Enum.cc:695
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:365
ObjectType get_type(const string &value)
Definition: mime_util.cc:326
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
Definition: D4Enum.cc:323
virtual bool set_value(const dods_byte value)
Definition: Byte.cc:234
virtual D4Attributes * attributes()
Definition: BaseType.cc:599
Holds a 64-bit unsigned integer.
Definition: UInt64.h:49
void AddData(const uint8_t *pData, const uint32_t length)
Definition: crc.h:98
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
Definition: D4Enum.cc:437
virtual void print_xml_writer(XMLWriter &xml, bool constrained)
Definition: D4Enum.cc:612
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:582
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
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:379
Holds a 64-bit (double precision) floating point value.
Definition: Float64.h:60
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:590
Holds a single byte.
Definition: Byte.h:60
void value(T *v) const
Get the value of an Enum Get the value of this instance. The caller is responsible for using a type T...
Definition: D4Enum.h:140
A class for error processing.
Definition: Error.h:92
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: D4Enum.cc:647
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
Definition: AttrTable.cc:231
virtual void set_name(const string &n)
Set the name of this attribute table.
Definition: AttrTable.cc:245
Holds a 32-bit unsigned integer.
Definition: UInt32.h:59
string type_name(Type t)
Definition: util.cc:760
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:554
unsigned int buf2val(void **)
Reads the class data.
Definition: D4Enum.cc:534
bool is_integer_type(Type t)
Definition: util.cc:900
Holds a 32-bit signed integer.
Definition: Int32.h:65
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:358