libdap  Updated for version 3.20.10
libdap4 is an implementation of OPeNDAP's DAP protocol.
BaseType.cc
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 // (c) COPYRIGHT URI/MIT 1994-1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 
32 // Implementation for BaseType.
33 //
34 // jhrg 9/6/94
35 
36 #include "config.h"
37 
38 #include <cstdio> // for stdin and stdout
39 
40 #include <sstream>
41 #include <string>
42 
43 //#define DODS_DEBUG
44 
45 #include "BaseType.h"
46 #include "Byte.h"
47 #include "Int16.h"
48 #include "UInt16.h"
49 #include "Int32.h"
50 #include "UInt32.h"
51 #include "Float32.h"
52 #include "Float64.h"
53 #include "Str.h"
54 #include "Url.h"
55 #include "Array.h"
56 #include "Structure.h"
57 #include "Sequence.h"
58 #include "Grid.h"
59 
60 #include "D4Attributes.h"
61 #include "DMR.h"
62 #include "XMLWriter.h"
63 #include "D4BaseTypeFactory.h"
64 
65 #include "InternalErr.h"
66 
67 #include "util.h"
68 #include "escaping.h"
69 #include "DapIndent.h"
70 
71 #include "debug.h"
72 
73 using namespace std;
74 
75 namespace libdap {
76 
77 // Protected copy mfunc
78 
85 void
86 BaseType::m_duplicate(const BaseType &bt)
87 {
88  DBG(cerr << "In BaseType::m_duplicate for " << bt.name() << endl);
89 
90  d_name = bt.d_name;
91  d_type = bt.d_type;
92  d_dataset = bt.d_dataset;
93  d_is_read = bt.d_is_read; // added, reza
94  d_is_send = bt.d_is_send; // added, reza
95  d_in_selection = bt.d_in_selection;
96  d_is_synthesized = bt.d_is_synthesized; // 5/11/2001 jhrg
97 
98  d_parent = bt.d_parent; // copy pointers 6/4/2001 jhrg
99 
100  d_attr = bt.d_attr; // Deep copy.
101 
102  if (bt.d_attributes)
103  d_attributes = new D4Attributes(*bt.d_attributes); // deep copy
104  else
105  d_attributes = 0; // init to null if not used.
106 
107  d_is_dap4 = bt.d_is_dap4;
108 
109  DBG(cerr << "Exiting BaseType::m_duplicate for " << bt.name() << endl);
110 }
111 
112 // Public mfuncs
113 
126 BaseType::BaseType(const string &n, const Type &t, bool is_dap4)
127 : d_name(n), d_type(t), d_dataset(""), d_is_read(false), d_is_send(false),
128  d_parent(0), d_attributes(0), d_is_dap4(is_dap4),
129  d_in_selection(false), d_is_synthesized(false)
130 {}
131 
144 BaseType::BaseType(const string &n, const string &d, const Type &t, bool is_dap4)
145 : d_name(n), d_type(t), d_dataset(d), d_is_read(false), d_is_send(false),
146  d_parent(0), d_attributes(0), d_is_dap4(is_dap4),
147  d_in_selection(false), d_is_synthesized(false)
148 {}
149 
151 BaseType::BaseType(const BaseType &copy_from) : DapObj()
152 {
153  DBG(cerr << "In BaseTpe::copy_ctor for " << copy_from.name() << endl);
154  m_duplicate(copy_from);
155 }
156 
157 BaseType::~BaseType()
158 {
159  DBG2(cerr << "Entering ~BaseType (" << this << ")" << endl);
160 
161  if (d_attributes)
162  delete d_attributes;
163 
164  DBG2(cerr << "Exiting ~BaseType" << endl);
165 }
166 
167 BaseType &
168 BaseType::operator=(const BaseType &rhs)
169 {
170  if (this == &rhs)
171  return *this;
172  m_duplicate(rhs);
173  return *this;
174 }
175 
181 {
182  ostringstream oss;
183  oss << "BaseType (" << this << "):" << endl
184  << " _name: " << name() << endl
185  << " _type: " << type_name() << endl
186  << " _dataset: " << d_dataset << endl
187  << " _read_p: " << d_is_read << endl
188  << " _send_p: " << d_is_send << endl
189  << " _synthesized_p: " << d_is_synthesized << endl
190  << " d_parent: " << d_parent << endl
191  << " d_attr: " << hex << &d_attr << dec << endl;
192 
193  return oss.str();
194 }
195 
211 void
213 {
214  BaseType *dest = ptr_duplicate();
215  // If it's already a DAP4 object then we can just return it!
216  if(!is_dap4()){
218  dest->set_is_dap4(true);
219  }
220  container->add_var_nocopy(dest);
221 }
222 
223 
254 std::vector<BaseType *> *
256 {
257  BaseType *dest = this->ptr_duplicate();
258  // convert the d4 attributes to a dap2 attribute table.
259  // HK-403. jhrg 6/17/19
260 #if 0
261  AttrTable *attrs = this->attributes()->get_AttrTable(name());
262  dest->set_attr_table(*attrs);
263 #else
264  if (dest->get_attr_table().get_size() == 0) {
266  dest->get_attr_table().set_name(name());
267  }
268 #endif
269 
270  dest->set_is_dap4(false);
271 
272  vector<BaseType *> *result = new vector<BaseType *>();
273  result->push_back(dest);
274  return result;
275 }
276 
277 
286 void
287 BaseType::dump(ostream &strm) const
288 {
289  strm << DapIndent::LMarg << "BaseType::dump - ("
290  << (void *)this << ")" << endl ;
291  DapIndent::Indent() ;
292 
293  strm << DapIndent::LMarg << "name: " << name() << endl ;
294  strm << DapIndent::LMarg << "type: " << type_name() << endl ;
295  strm << DapIndent::LMarg << "dataset: " << d_dataset << endl ;
296  strm << DapIndent::LMarg << "read_p: " << d_is_read << endl ;
297  strm << DapIndent::LMarg << "send_p: " << d_is_send << endl ;
298  strm << DapIndent::LMarg << "synthesized_p: " << d_is_synthesized << endl ;
299  strm << DapIndent::LMarg << "parent: " << (void *)d_parent << endl ;
300  strm << DapIndent::LMarg << "attributes: " << endl ;
301  DapIndent::Indent() ;
302 
303  if (d_attributes)
304  d_attributes->dump(strm);
305  else
306  d_attr.dump(strm) ;
307 
308  DapIndent::UnIndent() ;
309 
310  DapIndent::UnIndent() ;
311 }
312 
315 string
317 {
318  return d_name;
319 }
320 
327 string
329 {
330  if (get_parent() == 0)
331  return name();
332  else if (get_parent()->type() == dods_group_c)
333  return get_parent()->FQN() + name();
334  else
335  return get_parent()->FQN() + "." + name();
336 }
337 
339 void
340 BaseType::set_name(const string &n)
341 {
342  string name = n;
343  d_name = www2id(name); // www2id writes into its param.
344 }
345 
353 string
355 {
356  return d_dataset;
357 }
358 
360 Type
362 {
363  return d_type;
364 }
365 
367 void
369 {
370  d_type = t;
371 }
372 
374 string
376 {
377  if (is_dap4())
378  return libdap::D4type_name(d_type);
379  else
380  return libdap::D2type_name(d_type);
381 }
382 
388 bool
390 {
391  return libdap::is_simple_type(type());
392 }
393 
397 bool
399 {
400  return libdap::is_vector_type(type());
401 }
402 
407 bool
409 {
411 }
412 
438 int
440 {
441  return 1;
442 }
443 
447 bool
449 {
450  return d_is_synthesized;
451 }
452 
458 void
460 {
461  d_is_synthesized = state;
462 }
463 
464 // Return the state of d_is_read (true if the value of the variable has been
465 // read (and is in memory) false otherwise).
466 
475 bool
477 {
478  return d_is_read;
479 }
480 
511 void
513 {
514  // The this comment is/was wrong!
515  // The is_synthesized property was not being used and the more I thought
516  // about how this was coded, the more this code below seemed like a bad idea.
517  // Once the property was set, the read_p property could not be changed.
518  // That seems a little silly. Also, I think I need to use this is_synthesized
519  // property for some of the server function code I'm working on for Raytheon,
520  // and I'd like to be able to control the read_p property! jhrg 3/9/15
521 
522  // What's true: The is_synthesized property is used by
523  // 'projection functions' in the freeform handler. It might be better
524  // to modify the FFtypes to support this behavior, but for now I'm returning
525  // the library to its old behavior. That this change (setting is_read
526  // of the value of is_syn...) broke the FF handler was not detected
527  // because the FF tests were not being run due to an error in the FF
528  // bes-testsuite Makefile.am). jhrg 9/9/15
529 
530 #if 1
531  if (!d_is_synthesized) {
532  d_is_read = state;
533  }
534 #else
535  d_is_read = state;
536 #endif
537 }
538 
549 bool
551 {
552  return d_is_send;
553 }
554 
563 void
565 {
566  DBG2(cerr << "Calling BaseType::set_send_p() for: " << this->name()
567  << endl);
568  d_is_send = state;
569 }
570 
571 
577 AttrTable &
579 {
580  return d_attr;
581 }
582 
585 void
587 {
588  d_attr = at;
589 }
590 
594 D4Attributes *
596 {
597  if (!d_attributes) d_attributes = new D4Attributes();
598  return d_attributes;
599 }
600 
601 void
602 BaseType::set_attributes(D4Attributes *attrs)
603 {
604  d_attributes = new D4Attributes(*attrs);
605 }
606 
607 void
608 BaseType::set_attributes_nocopy(D4Attributes *attrs)
609 {
610  d_attributes = attrs;
611 }
613 
641 
642  DBG(cerr << __func__ << "() - BEGIN name:'" << name() << "'" << endl);
643 
644  AttrTable *at = at_container->get_attr_table(name());
645  DBG(cerr << __func__ << "() - at: "<< (void *) at << endl);
646 
647 
648  if (at) {
649  at->set_is_global_attribute(false);
650  DBG(cerr << __func__ << "() - Processing AttrTable: " << at->get_name() << endl);
651 
652  AttrTable::Attr_iter at_p = at->attr_begin();
653  while (at_p != at->attr_end()) {
654  DBG(cerr << __func__ << "() - Attribute '" << at->get_name(at_p) << "' is type: " << at->get_type(at_p) << endl);
655  if (at->get_attr_type(at_p) == Attr_container){
656  // An attribute container may actually represent a child member variable. When
657  // that's the case we don't want to add the container to the parent type, but
658  // rather let any child of BaseType deal with those containers in the child's
659  // overridden transfer_attributes() method.
660  // We capitalize on the magic of the BaseType API and utilize the var() method
661  // to check for a child variable of the same name and, if one exists, we'll skip
662  // this AttrTable and let a child constructor class like Grid or Constructor
663  // deal with it.
664  BaseType *bt = var(at->get_name(at_p),true);
665  if(bt==0){
666  DBG(cerr << __func__ << "() - Adding container '" << at->get_name(at_p) << endl);
667  get_attr_table().append_container(new AttrTable(*at->get_attr_table(at_p)), at->get_name(at_p));
668  }
669  else {
670  DBG(cerr << __func__ << "() - Found child var: '"<< bt->type_name()<< " " << bt->name() << " (address:" << (void *) bt << ")" << endl);
671  DBG(cerr << __func__ << "() - Skipping container '" << at->get_name(at_p) << endl);
672  }
673  }
674  else {
675  DBG(cerr << __func__ << "() - Adding Attribute '" << at->get_name(at_p) << endl);
676  get_attr_table().append_attr(at->get_name(at_p), at->get_type(at_p), at->get_attr_vector(at_p));
677  }
678  at_p++;
679  }
680  }
681  else {
682  DBG(cerr << __func__ << "() - Unable to locate AttrTable '" << name() << "' SKIPPING" << endl);
683 
684  }
685 }
686 
698 bool
700 {
701  return d_in_selection;
702 }
703 
713 void
715 {
716  d_in_selection = state;
717 }
718 
719 // Protected method.
728 void
730 {
731  if (!dynamic_cast<Constructor *>(parent)
732  && !dynamic_cast<Vector *>(parent)
733  && parent != 0)
734  throw InternalErr("Call to set_parent with incorrect variable type.");
735 
736  d_parent = parent;
737 }
738 
739 // Public method.
740 
746 BaseType *
748 {
749  return d_parent;
750 }
751 
752 // Documented in the header file.
753 BaseType *
754 BaseType::var(const string &/*name*/, bool /*exact_match*/, btp_stack */*s*/)
755 {
756  return static_cast<BaseType *>(0);
757 }
758 
775 BaseType *
776 BaseType::var(const string &, btp_stack &)
777 {
778  return static_cast<BaseType *>(0);
779 }
780 
810 void
812 {
813  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var unimplemented");
814 }
815 
816 void
817 BaseType::add_var_nocopy(BaseType *, Part)
818 {
819  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var_nocopy unimplemented");
820 }
821 
894 bool
896 {
897  if (d_is_read)
898  return true;
899 
900  throw InternalErr("Unimplemented BaseType::read() method called for the variable named: " + name());
901 }
902 
903 void
905 {
906 #if USE_LOCAL_TIMEOUT_SCHEME
907  dds.timeout_on();
908 #endif
909  DBG2(cerr << "BaseType::intern_data: " << name() << endl);
910  if (!read_p())
911  read(); // read() throws Error and InternalErr
912 #if USE_LOCAL_TIMEOUT_SCHEME
913  dds.timeout_off();
914 #endif
915 }
916 
922 void
923 BaseType::intern_data(/*Crc32 &checksum, DMR &, ConstraintEvaluator &*/)
924 {
925  if (!read_p())
926  read(); // read() throws Error and InternalErr
927 #if 0
928  compute_checksum(checksum);
929 #endif
930 }
931 
932 bool
934 {
935  throw InternalErr(__FILE__, __LINE__, "The DAP2 serialize() method has not been implemented for " + type_name());
936 }
937 
938 bool
940 {
941  throw InternalErr(__FILE__, __LINE__, "The DAP2 deserialize() method has not been implemented for " + type_name());
942 }
943 
944 void
945 BaseType::serialize(D4StreamMarshaller &, DMR &, /*ConstraintEvaluator &,*/ bool)
946 {
947  throw InternalErr(__FILE__, __LINE__, "The DAP4 serialize() method has not been implemented for " + type_name());
948 }
949 
950 void
952 {
953  throw InternalErr(__FILE__, __LINE__, "The DAP4 deserialize() method has not been implemented for " + type_name());
954 }
955 
998 void
999 BaseType::print_decl(FILE *out, string space, bool print_semi,
1000  bool constraint_info, bool constrained)
1001 {
1002  ostringstream oss;
1003  print_decl(oss, space, print_semi, constraint_info, constrained);
1004  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1005 }
1006 
1049 void
1050 BaseType::print_decl(ostream &out, string space, bool print_semi,
1051  bool constraint_info, bool constrained)
1052 {
1053  // if printing the constrained declaration, exit if this variable was not
1054  // selected.
1055  if (constrained && !send_p())
1056  return;
1057 
1058  out << space << type_name() << " " << id2www(name()) ;
1059 
1060  if (constraint_info) {
1061  if (send_p())
1062  out << ": Send True" ;
1063  else
1064  out << ": Send False" ;
1065  }
1066 
1067  if (print_semi)
1068  out << ";\n" ;
1069 }
1070 
1085 void
1086 BaseType::print_val(FILE *out, string space, bool print_decl_p)
1087 {
1088  ostringstream oss;
1089  print_val(oss, space, print_decl_p);
1090  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1091 }
1092 
1100 void
1101 BaseType::print_xml(FILE *out, string space, bool constrained)
1102 {
1103  XMLWriter xml(space);
1104  print_xml_writer(xml, constrained);
1105  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
1106 }
1107 
1115 void
1116 BaseType::print_xml(ostream &out, string space, bool constrained)
1117 {
1118  XMLWriter xml(space);
1119  print_xml_writer(xml, constrained);
1120  out << xml.get_doc();
1121 }
1122 
1129 void
1130 BaseType::print_xml_writer(XMLWriter &xml, bool constrained)
1131 {
1132  if (constrained && !send_p())
1133  return;
1134 
1135  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
1136  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
1137 
1138  if (!name().empty())
1139  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
1140  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
1141 
1142  if (is_dap4())
1143  attributes()->print_dap4(xml);
1144 
1145  if (!is_dap4() && get_attr_table().get_size() > 0)
1147 
1148  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1149  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
1150 }
1151 
1159 void
1160 BaseType::print_dap4(XMLWriter &xml, bool constrained)
1161 {
1162  print_xml_writer(xml, constrained);
1163 }
1164 
1165 // Compares the object's current state with the semantics of a particular
1166 // type. This will typically be defined in ctor classes (which have
1167 // complicated semantics). For BaseType, an object is semantically correct if
1168 // it has both a non-null name and type.
1169 //
1170 // NB: This is not the same as an invariant -- during the parse objects exist
1171 // but have no name. Also, the bool ALL defaults to false for BaseType. It is
1172 // used by children of CtorType.
1173 //
1174 // Returns: true if the object is semantically correct, false otherwise.
1175 
1204 bool
1205 BaseType::check_semantics(string &msg, bool)
1206 {
1207  bool sem = (d_type != dods_null_c && name().length());
1208 
1209  if (!sem)
1210  msg = "Every variable must have both a name and a type\n";
1211 
1212  return sem;
1213 }
1214 
1251 bool
1253 {
1254  // Even though ops is a public method, it can never be called because
1255  // they will never have a BaseType object since this class is abstract,
1256  // however any of the child classes could by mistake call BaseType::ops
1257  // so this is an internal error. Jose Garcia
1258  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1259 }
1260 
1277 bool
1279 {
1280  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1281 }
1282 
1294 unsigned int
1295 BaseType::width(bool /* constrained */) const
1296 {
1297  throw InternalErr(__FILE__, __LINE__, "not implemented");
1298 }
1299 
1300 } // namespace libdap
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 AttrTable * get_attr_table(const string &name)
Get an attribute container.
Definition: AttrTable.cc:607
virtual Attr_iter attr_end()
Definition: AttrTable.cc:719
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
Definition: AttrTable.cc:613
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
Definition: AttrTable.cc:653
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
void print_xml_writer(XMLWriter &xml)
Definition: AttrTable.cc:1425
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
Definition: AttrTable.cc:231
virtual void dump(ostream &strm) const
dumps information about this object
Definition: AttrTable.cc:1510
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
Definition: AttrTable.cc:621
The basic data type for the DODS DAP types.
Definition: BaseType.h:118
virtual BaseType * ptr_duplicate()=0
void m_duplicate(const BaseType &bt)
Perform a deep copy.
Definition: BaseType.cc:86
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1130
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:375
virtual void intern_data()
Read data into this variable.
Definition: BaseType.cc:923
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:895
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: BaseType.cc:939
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:578
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:316
virtual void set_in_selection(bool state)
Definition: BaseType.cc:714
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:999
virtual BaseType * get_parent() const
Definition: BaseType.cc:747
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:476
virtual unsigned int width(bool constrained=false) const
How many bytes does this variable use Return the number of bytes of storage this variable uses....
Definition: BaseType.cc:1295
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: BaseType.cc:512
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:354
virtual bool d4_ops(BaseType *b, int op)
Evaluator a relop for DAP4.
Definition: BaseType.cc:1278
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:586
virtual void set_synthesized_p(bool state)
Definition: BaseType.cc:459
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:729
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: BaseType.cc:439
void dump(ostream &strm) const override
dumps information about this object
Definition: BaseType.cc:287
virtual string toString()
Definition: BaseType.cc:180
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
Definition: BaseType.cc:398
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
Definition: BaseType.cc:1101
virtual void set_name(const string &n)
Sets the name of the class instance.
Definition: BaseType.cc:340
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: BaseType.cc:1252
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
Definition: BaseType.cc:408
virtual D4Attributes * attributes()
Definition: BaseType.cc:595
virtual std::string FQN() const
Definition: BaseType.cc:328
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:550
virtual bool is_simple_type() const
Returns true if the instance is a numeric, string or URL type variable.
Definition: BaseType.cc:389
virtual void set_send_p(bool state)
Definition: BaseType.cc:564
virtual void compute_checksum(Crc32 &checksum)=0
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: BaseType.cc:212
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net, then remove them from the object.
Definition: BaseType.cc:933
virtual void add_var(BaseType *bt, Part part=nil)
Add a variable.
Definition: BaseType.cc:811
virtual void transfer_attributes(AttrTable *at)
Definition: BaseType.cc:640
virtual bool is_in_selection()
Is this variable part of the current selection?
Definition: BaseType.cc:699
virtual bool synthesized_p()
Definition: BaseType.cc:448
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
Definition: BaseType.cc:1205
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:126
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr)
Returns a pointer to a member of a constructor class.
Definition: BaseType.cc:754
virtual void set_type(const Type &t)
Sets the type of the class instance.
Definition: BaseType.cc:368
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:361
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: BaseType.cc:1086
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1160
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
Definition: BaseType.cc:255
Evaluate a constraint expression.
void add_var_nocopy(BaseType *bt, Part part=nil) override
Definition: Constructor.cc:345
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
virtual void dump(ostream &strm) const
dumps information about this object
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Read data from the stream made by D4StreamMarshaller.
libdap base object for common functionality of libdap objects
Definition: DapObj.h:51
A class for software fault reporting.
Definition: InternalErr.h:65
abstract base class used to marshal/serialize dap data objects
Definition: Marshaller.h:50
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:55
Holds a one-dimensional collection of DAP2 data types.
Definition: Vector.h:81
top level DAP object to house generic methods
Definition: AlarmHandler.h:36
Type
Identifies the data type.
Definition: Type.h:94
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
bool is_simple_type(Type t)
Returns true if the instance is a numeric, string or URL type variable.
Definition: util.cc:778
string D2type_name(Type t)
Returns the type of the class instance as a string. Supports all DAP2 types and not the DAP4-only typ...
Definition: util.cc:652
string D4type_name(Type t)
Returns the type of the class instance as a string. Supports all DAP4 types and not the DAP2-only typ...
Definition: util.cc:697
bool is_constructor_type(Type t)
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
Definition: util.cc:862
bool is_vector_type(Type t)
Returns true if the instance is a vector (i.e., array) type variable.
Definition: util.cc:818
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48
string id2www(string in, const string &allowable)
Definition: escaping.cc:153