libdap  Updated for version 3.20.0
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 *my_pretty_pony;
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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony = 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  my_pretty_pony->type_name() << " name: " << my_pretty_pony->name() << endl;);
166 
167  //Grab the attributes!
168  AttrTable d2_attrs = *(this->attributes()->get_AttrTable(name()));
169  my_pretty_pony->set_attr_table(d2_attrs);
170 
171  // make the Enum label, and the enum's definition into DAP2 attributes for our returned item.
172  long long my_value;
173  this->value(&my_value);
174 
175  DBG(cerr << __func__ << "() - value: "<< my_value << endl;);
176 
177  string my_label = "";
178  AttrTable *enum_def = new AttrTable();
179  enum_def->set_name("d4:enum_def");
180 
181  D4EnumDef::D4EnumValueIter dIter = d_enum_def->value_begin();
182  D4EnumDef::D4EnumValueIter dEnd = d_enum_def->value_end();
183  while (dIter != dEnd) {
184  long long a_value = (*dIter).value;
185  string a_label = (*dIter).label;
186  ostringstream oss;
187  oss << a_value;
188  DBG(cerr << __func__ << "() - a_value: "<< a_value << endl;);
189  enum_def->append_attr(a_label, my_pretty_pony->type_name(), oss.str());
190  if (a_value == my_value) {
191  my_label = (*dIter).label;
192  }
193  dIter++;
194  }
195 
196  if (!my_label.empty()) my_pretty_pony->get_attr_table().append_attr("d4:enum_label", "String", my_label);
197 
198  my_pretty_pony->get_attr_table().append_container(enum_def, enum_def->get_name());
199 
200  vector<BaseType *> *result = new vector<BaseType *>();
201  result->push_back(my_pretty_pony);
202  DBG(cerr << __func__ << "() - END" << endl;);
203  return result;
204 }
205 
206 void D4Enum::m_check_value(int64_t v) const
207 {
208  switch (d_element_type) {
209  case dods_byte_c:
210  case dods_uint8_c:
211  if ((uint64_t)v > DODS_UCHAR_MAX || v < 0) {
212  ostringstream oss;
213  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
214  throw Error(oss.str());
215  }
216  break;
217  case dods_uint16_c:
218  if ((uint64_t)v > DODS_USHRT_MAX || v < 0) {
219  ostringstream oss;
220  oss << "The value " << v << " will not fit in an unsigned 16-bit integer. (" << __func__ << ")";
221  throw Error(oss.str());
222  }
223  break;
224  case dods_uint32_c:
225  if ((uint64_t)v > DODS_UINT_MAX || v < 0) {
226  ostringstream oss;
227  oss << "The value " << v << " will not fit in an unsigned 32-bit integer. (" << __func__ << ")";
228  throw Error(oss.str());
229  }
230  break;
231  case dods_uint64_c:
232  // If 'v' can never be bigger than ULLONG_MAX
233  break;
234 
235  case dods_int8_c:
236  if (v > DODS_SCHAR_MAX || v < DODS_SCHAR_MIN) {
237  ostringstream oss;
238  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
239  throw Error(oss.str());
240  }
241 
242  break;
243  case dods_int16_c:
244  if (v > DODS_SHRT_MAX || v < DODS_SHRT_MIN) {
245  ostringstream oss;
246  oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")";
247  throw Error(oss.str());
248  }
249  break;
250  case dods_int32_c:
251  if (v > DODS_INT_MAX || v < DODS_INT_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_int64_c:
258  // There's no value 'v' can have that won't fit into a 64-bit int.
259  break;
260  default:
261  assert(!"illegal type for D4Enum");
262  }
263 }
264 
265 D4Enum::D4Enum(const string &name, const string &enum_type) :
266  BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(dods_null_c), d_enum_def(0)
267 {
268  d_element_type = get_type(enum_type.c_str());
269 
270  if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c;
271  set_is_signed(d_element_type);
272 }
273 
274 D4Enum::D4Enum(const string &name, Type type) :
275  BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(type), d_enum_def(0)
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, const string &dataset, Type type) :
282  BaseType(name, dataset, 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 // Explicit instantiation of the template member function 'value(T *)'.
289 // This is required in order to have the library contain these member
290 // functions when its own code does not use them. Normally, C++ instantiates
291 // templates when they are used, and this forces that process so the
292 // library file contains the various versions of the member function.
293 template void D4Enum::value<dods_byte>(dods_byte *v) const;
294 template void D4Enum::value<dods_int16>(dods_int16 *v) const;
295 template void D4Enum::value<dods_uint16>(dods_uint16 *v) const;
296 template void D4Enum::value<dods_int32>(dods_int32 *v) const;
297 template void D4Enum::value<dods_uint32>(dods_uint32 *v) const;
298 template void D4Enum::value<dods_int64>(dods_int64 *v) const;
299 template void D4Enum::value<dods_uint64>(dods_uint64 *v) const;
300 
301 template void D4Enum::set_value<dods_byte>(dods_byte v, bool check_value);
302 template void D4Enum::set_value<dods_int16>(dods_int16 v, bool check_value);
303 template void D4Enum::set_value<dods_uint16>(dods_uint16 v, bool check_value);
304 template void D4Enum::set_value<dods_int32>(dods_int32 v, bool check_value);
305 template void D4Enum::set_value<dods_uint32>(dods_uint32 v, bool check_value);
306 template void D4Enum::set_value<dods_int64>(dods_int64 v, bool check_value);
307 template void D4Enum::set_value<dods_uint64>(dods_uint64 v, bool check_value);
308 
309 void
310 D4Enum::set_enumeration(D4EnumDef *enum_def) {
311  d_enum_def = enum_def;
312  d_element_type = enum_def->type();
313 }
314 
315 void
317 {
318  DBG(cerr << __func__ << ": element type: " << ::libdap::type_name(d_element_type) << endl);
319 
320  switch (d_element_type) {
321  case dods_byte_c:
322  case dods_uint8_c:
323  case dods_int8_c: {
324  dods_byte v = static_cast<dods_byte>(d_buf);
325  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint8_t));
326  break;
327  }
328  case dods_uint16_c:
329  case dods_int16_c: {
330  dods_int16 v = static_cast<dods_int16>(d_buf);
331  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint16_t));
332  break;
333  }
334  case dods_uint32_c:
335  case dods_int32_c: {
336  dods_int32 v = static_cast<dods_int32>(d_buf);
337  checksum.AddData(reinterpret_cast<uint8_t*>(&v), sizeof(uint32_t));
338  break;
339  }
340  case dods_uint64_c:
341  case dods_int64_c:
342  checksum.AddData(reinterpret_cast<uint8_t*>(&d_buf), sizeof(uint64_t));
343  break;
344 
345  default:
346  assert(!"illegal type for D4Enum");
347  }
348 }
349 
350 void
351 D4Enum::set_is_signed(Type t)
352 {
353  switch (t) {
354  case dods_byte_c:
355  case dods_uint8_c:
356  case dods_uint16_c:
357  case dods_uint32_c:
358  case dods_uint64_c:
359  d_is_signed = false;
360  break;
361 
362  case dods_int8_c:
363  case dods_int16_c:
364  case dods_int32_c:
365  case dods_int64_c:
366  d_is_signed = true;
367  break;
368 
369  default:
370 #if 0
371  // I removed this because it hinders testing and is no better
372  // than throwing an exception. jhrg 3/29/18
373  assert(!"illegal type for D4Enum");
374 #endif
375  throw InternalErr(__FILE__, __LINE__, "Illegal type");
376  }
377 }
378 
391 void
392 D4Enum::serialize(D4StreamMarshaller &m, DMR &, /*ConstraintEvaluator &,*/ bool)
393 {
394  if (!read_p())
395  read(); // read() throws Error
396 
397  switch (d_element_type) {
398  case dods_byte_c:
399  case dods_uint8_c:
400  m.put_byte(d_buf);
401  break;
402  case dods_uint16_c:
403  m.put_uint16(d_buf);
404  break;
405  case dods_uint32_c:
406  m.put_uint32(d_buf);
407  break;
408  case dods_uint64_c:
409  m.put_uint64(d_buf);
410  break;
411 
412  case dods_int8_c:
413  m.put_int8(d_buf);
414  break;
415  case dods_int16_c:
416  m.put_int16(d_buf);
417  break;
418  case dods_int32_c:
419  m.put_int32(d_buf);
420  break;
421  case dods_int64_c:
422  m.put_int64(d_buf);
423  break;
424  default:
425  assert(!"illegal type for D4Enum");
426  }
427 }
428 
429 void
431 {
432  switch (d_element_type) {
433  case dods_byte_c:
434  case dods_uint8_c: {
435  dods_byte v;
436  um.get_byte(v);
437  d_buf = v;
438  break;
439  }
440  case dods_uint16_c: {
441  dods_uint16 v;
442  um.get_uint16(v);
443  d_buf = v;
444  break;
445  }
446  case dods_uint32_c: {
447  dods_uint32 v;
448  um.get_uint32(v);
449  d_buf = v;
450  break;
451  }
452  case dods_uint64_c: {
453  dods_uint64 v;
454  um.get_uint64(v);
455  d_buf = v;
456  break;
457  }
458 
459  case dods_int8_c: {
460  dods_int8 v;
461  um.get_int8(v);
462  d_buf = v;
463  break;
464  }
465  case dods_int16_c: {
466  dods_int16 v;
467  um.get_int16(v);
468  d_buf = v;
469  break;
470  }
471  case dods_int32_c: {
472  dods_int32 v;
473  um.get_int32(v);
474  d_buf = v;
475  break;
476  }
477  case dods_int64_c: {
478  dods_int64 v;
479  um.get_int64(v);
480  d_buf = v;
481  break;
482  }
483  default:
484  assert(!"illegal type for D4Enum");
485  }
486 }
487 
488 unsigned int D4Enum::val2buf(void *val, bool)
489 {
490  if (!val)
491  throw InternalErr("The incoming pointer does not contain any data.");
492 
493  switch (d_element_type) {
494  case dods_byte_c:
495  case dods_uint8_c:
496  d_buf = *(dods_byte*)val;
497  break;
498  case dods_uint16_c:
499  d_buf = *(dods_uint16*)val;
500  break;
501  case dods_uint32_c:
502  d_buf = *(dods_uint32*)val;
503  break;
504  case dods_uint64_c:
505  d_buf = *(dods_uint64*)val;
506  break;
507 
508  case dods_int8_c:
509  d_buf = *(dods_int8*)val;
510  break;
511  case dods_int16_c:
512  d_buf = *(dods_int16*)val;
513  break;
514  case dods_int32_c:
515  d_buf = *(dods_int32*)val;
516  break;
517  case dods_int64_c:
518  d_buf = *(dods_int64*)val;
519  break;
520  default:
521  assert(!"illegal type for D4Enum");
522  }
523 
524  return width();
525 }
526 
527 unsigned int D4Enum::buf2val(void **val)
528 {
529  if (!val)
530  throw InternalErr("NULL pointer");
531 
532  switch (d_element_type) {
533  case dods_byte_c:
534  case dods_uint8_c:
535  if (!*val) *val = new dods_byte;
536  *(dods_byte *) * val = d_buf;
537  break;
538  case dods_uint16_c:
539  if (!*val) *val = new dods_uint16;
540  *(dods_uint16 *) * val = d_buf;
541  break;
542  case dods_uint32_c:
543  if (!*val) *val = new dods_uint32;
544  *(dods_uint32 *) * val = d_buf;
545  break;
546  case dods_uint64_c:
547  if (!*val) *val = new dods_uint64;
548  *(dods_uint64 *) * val = d_buf;
549  break;
550 
551  case dods_int8_c:
552  if (!*val) *val = new dods_int8;
553  *(dods_int8*) * val = d_buf;
554  break;
555  case dods_int16_c:
556  if (!*val) *val = new dods_int16;
557  *(dods_int16 *) * val = d_buf;
558  break;
559  case dods_int32_c:
560  if (!*val) *val = new dods_int32;
561  *(dods_int32 *) * val = d_buf;
562  break;
563  case dods_int64_c:
564  if (!*val) *val = new dods_int64;
565  *(dods_int64 *) * val = d_buf;
566  break;
567  default:
568  assert(!"illegal type for D4Enum");
569  }
570 
571  return width();
572 }
573 
574 void D4Enum::print_val(ostream &out, string space, bool print_decl_p)
575 {
576  if (print_decl_p) {
577  print_decl(out, space, false);
578  out << " = ";
579  }
580 
581  DBG(cerr << "Enum union value: " << hex << d_buf << dec << endl);
582 
583  if (is_signed()) {
584  int64_t v;
585  value(&v);
586  out << v;
587  }
588  else {
589  uint64_t v;
590  value(&v);
591  out << v;
592  }
593 
594  if (print_decl_p)
595  out << ";" << endl;
596 }
597 
604 void
605 D4Enum::print_xml_writer(XMLWriter &xml, bool constrained)
606 {
607  if (constrained && !send_p())
608  return;
609 
610  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)"Enum") < 0)
611  throw InternalErr(__FILE__, __LINE__, "Could not write Enum element");
612 
613  if (!name().empty())
614  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
615  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
616 
617 
618  string path = d_enum_def->name();
619  // Not every D4EnumDef is a member of an instance of D4EnumDefs - the D4EnumDefs instance
620  // holds a reference to the D4Group that holds the Enum definitions.
621  // TODO Should this be changed - so the EnumDef holds a reference to its parent Group?
622  if (d_enum_def->parent()) {
623  // print the FQN for the enum def; D4Group::FQN() includes the trailing '/'
624  path = static_cast<D4Group*>(d_enum_def->parent()->parent())->FQN() + path;
625  }
626  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "enum", (const xmlChar*)path.c_str()) < 0)
627  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for enum");
628 
629  attributes()->print_dap4(xml);
630 
631  if (get_attr_table().get_size() > 0)
633 
634  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
635  throw InternalErr(__FILE__, __LINE__, "Could not end Enum element");
636 }
637 
638 
639 bool
641 {
642  // Get the arg's value.
643  if (!read_p() && !read())
644  throw InternalErr(__FILE__, __LINE__, "This value not read!");
645 
646  // Get the second arg's value.
647  if (!b->read_p() && !b->read())
648  throw InternalErr(__FILE__, __LINE__, "This value not read!");
649 
650  switch (b->type()) {
651  case dods_int8_c:
652  return Cmp<dods_int64, dods_int8>(op, d_buf, static_cast<Int8*>(b)->value());
653  case dods_byte_c:
654  return SUCmp<dods_int64, dods_byte>(op, d_buf, static_cast<Byte*>(b)->value());
655  case dods_int16_c:
656  return Cmp<dods_int64, dods_int16>(op, d_buf, static_cast<Int16*>(b)->value());
657  case dods_uint16_c:
658  return SUCmp<dods_int64, dods_uint16>(op, d_buf, static_cast<UInt16*>(b)->value());
659  case dods_int32_c:
660  return Cmp<dods_int64, dods_int32>(op, d_buf, static_cast<Int32*>(b)->value());
661  case dods_uint32_c:
662  return SUCmp<dods_int64, dods_uint32>(op, d_buf, static_cast<UInt32*>(b)->value());
663 #if 0
664  // FIXME
665  case dods_int64_c:
666  return Cmp<dods_int64, dods_int64>(op, d_buf, static_cast<D4Enum*>(b)->value());
667  case dods_uint64_c:
668  return SUCmp<dods_int64, dods_uint64>(op, d_buf, static_cast<D4Enum*>(b)->value());
669 #endif
670  case dods_float32_c:
671  return Cmp<dods_int64, dods_float32>(op, d_buf, static_cast<Float32*>(b)->value());
672  case dods_float64_c:
673  return Cmp<dods_int64, dods_float64>(op, d_buf, static_cast<Float64*>(b)->value());
674  default:
675  return false;
676  }
677 
678  return false;
679 }
680 
689 void
690 D4Enum::dump(ostream &strm) const
691 {
692  strm << DapIndent::LMarg << "D4Enum::dump - (" << (void *) this << ")" << endl;
693  DapIndent::Indent();
694  BaseType::dump(strm);
695  strm << DapIndent::LMarg << "value: " << d_buf << endl;
696  DapIndent::UnIndent();
697 }
698 
699 } // namespace libdap
700 
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:891
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:472
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:312
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:995
AttrTable * get_AttrTable(const std::string name)
copy attributes from DAP4 to DAP2
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:283
unsigned int val2buf(void *, bool)
Loads class data.
Definition: D4Enum.cc:488
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:574
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: AlarmHandler.h:35
A class for software fault reporting.
Definition: InternalErr.h:64
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
Definition: D4Enum.cc:92
virtual std::string FQN() const
Definition: BaseType.cc:324
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:750
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:392
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:690
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:357
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:316
virtual bool set_value(const dods_byte value)
Definition: Byte.cc:234
virtual D4Attributes * attributes()
Definition: BaseType.cc:591
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:430
virtual void print_xml_writer(XMLWriter &xml, bool constrained)
Definition: D4Enum.cc:605
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:574
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:371
Holds a 64-bit (double precision) floating point value.
Definition: Float64.h:60
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:582
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:90
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: D4Enum.cc:640
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:546
unsigned int buf2val(void **)
Reads the class data.
Definition: D4Enum.cc:527
bool is_integer_type(Type t)
Definition: util.cc:906
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:350