libdap  Updated for version 3.20.6
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  DBG(cerr << "Entering BaseType::operator=" << endl);
171  if (this == &rhs)
172  return *this;
173 
174  m_duplicate(rhs);
175 
176  DBG(cerr << "Exiting BaseType::operator=" << endl);
177  return *this;
178 }
179 
185 {
186  ostringstream oss;
187  oss << "BaseType (" << this << "):" << endl
188  << " _name: " << name() << endl
189  << " _type: " << type_name() << endl
190  << " _dataset: " << d_dataset << endl
191  << " _read_p: " << d_is_read << endl
192  << " _send_p: " << d_is_send << endl
193  << " _synthesized_p: " << d_is_synthesized << endl
194  << " d_parent: " << d_parent << endl
195  << " d_attr: " << hex << &d_attr << dec << endl;
196 
197  return oss.str();
198 }
199 
215 void
217 {
218  BaseType *dest = ptr_duplicate();
219  // If it's already a DAP4 object then we can just return it!
220  if(!is_dap4()){
222  dest->set_is_dap4(true);
223  }
224  container->add_var_nocopy(dest);
225 }
226 
227 
258 std::vector<BaseType *> *
260 {
261  BaseType *dest = this->ptr_duplicate();
262  // convert the d4 attributes to a dap2 attribute table.
263  // HK-403. jhrg 6/17/19
264 #if 0
265  AttrTable *attrs = this->attributes()->get_AttrTable(name());
266  dest->set_attr_table(*attrs);
267 #else
268  if (dest->get_attr_table().get_size() == 0) {
270  dest->get_attr_table().set_name(name());
271  }
272 #endif
273 
274  dest->set_is_dap4(false);
275 
276  vector<BaseType *> *result = new vector<BaseType *>();
277  result->push_back(dest);
278  return result;
279 }
280 
281 
290 void
291 BaseType::dump(ostream &strm) const
292 {
293  strm << DapIndent::LMarg << "BaseType::dump - ("
294  << (void *)this << ")" << endl ;
295  DapIndent::Indent() ;
296 
297  strm << DapIndent::LMarg << "name: " << name() << endl ;
298  strm << DapIndent::LMarg << "type: " << type_name() << endl ;
299  strm << DapIndent::LMarg << "dataset: " << d_dataset << endl ;
300  strm << DapIndent::LMarg << "read_p: " << d_is_read << endl ;
301  strm << DapIndent::LMarg << "send_p: " << d_is_send << endl ;
302  strm << DapIndent::LMarg << "synthesized_p: " << d_is_synthesized << endl ;
303  strm << DapIndent::LMarg << "parent: " << (void *)d_parent << endl ;
304  strm << DapIndent::LMarg << "attributes: " << endl ;
305  DapIndent::Indent() ;
306 
307  if (d_attributes)
308  d_attributes->dump(strm);
309  else
310  d_attr.dump(strm) ;
311 
312  DapIndent::UnIndent() ;
313 
314  DapIndent::UnIndent() ;
315 }
316 
319 string
321 {
322  return d_name;
323 }
324 
331 string
333 {
334  if (get_parent() == 0)
335  return name();
336  else if (get_parent()->type() == dods_group_c)
337  return get_parent()->FQN() + name();
338  else
339  return get_parent()->FQN() + "." + name();
340 }
341 
343 void
344 BaseType::set_name(const string &n)
345 {
346  string name = n;
347  d_name = www2id(name); // www2id writes into its param.
348 }
349 
357 string
359 {
360  return d_dataset;
361 }
362 
364 Type
366 {
367  return d_type;
368 }
369 
371 void
373 {
374  d_type = t;
375 }
376 
378 string
380 {
381  if (is_dap4())
382  return libdap::D4type_name(d_type);
383  else
384  return libdap::D2type_name(d_type);
385 }
386 
392 bool
394 {
395  return libdap::is_simple_type(type());
396 }
397 
401 bool
403 {
404  return libdap::is_vector_type(type());
405 }
406 
411 bool
413 {
415 }
416 
442 int
444 {
445  return 1;
446 }
447 
451 bool
453 {
454  return d_is_synthesized;
455 }
456 
462 void
464 {
465  d_is_synthesized = state;
466 }
467 
468 // Return the state of d_is_read (true if the value of the variable has been
469 // read (and is in memory) false otherwise).
470 
479 bool
481 {
482  return d_is_read;
483 }
484 
515 void
517 {
518  // The this comment is/was wrong!
519  // The is_synthesized property was not being used and the more I thought
520  // about how this was coded, the more this code below seemed like a bad idea.
521  // Once the property was set, the read_p property could not be changed.
522  // That seems a little silly. Also, I think I need to use this is_synthesized
523  // property for some of the server function code I'm working on for Raytheon,
524  // and I'd like to be able to control the read_p property! jhrg 3/9/15
525 
526  // What's true: The is_synthesized property is used by
527  // 'projection functions' in the freeform handler. It might be better
528  // to modify the FFtypes to support this behavior, but for now I'm returning
529  // the library to its old behavior. That this change (setting is_read
530  // of the value of is_syn...) broke the FF handler was not detected
531  // because the FF tests were not being run due to an error in the FF
532  // bes-testsuite Makefile.am). jhrg 9/9/15
533 
534 #if 1
535  if (!d_is_synthesized) {
536  d_is_read = state;
537  }
538 #else
539  d_is_read = state;
540 #endif
541 }
542 
553 bool
555 {
556  return d_is_send;
557 }
558 
567 void
569 {
570  DBG2(cerr << "Calling BaseType::set_send_p() for: " << this->name()
571  << endl);
572  d_is_send = state;
573 }
574 
575 
581 AttrTable &
583 {
584  return d_attr;
585 }
586 
589 void
591 {
592  d_attr = at;
593 }
594 
598 D4Attributes *
600 {
601  if (!d_attributes) d_attributes = new D4Attributes();
602  return d_attributes;
603 }
604 
605 void
606 BaseType::set_attributes(D4Attributes *attrs)
607 {
608  d_attributes = new D4Attributes(*attrs);
609 }
610 
611 void
612 BaseType::set_attributes_nocopy(D4Attributes *attrs)
613 {
614  d_attributes = attrs;
615 }
617 
645 
646  DBG(cerr << __func__ << "() - BEGIN name:'" << name() << "'" << endl);
647 
648  AttrTable *at = at_container->get_attr_table(name());
649  DBG(cerr << __func__ << "() - at: "<< (void *) at << endl);
650 
651 
652  if (at) {
653  at->set_is_global_attribute(false);
654  DBG(cerr << __func__ << "() - Processing AttrTable: " << at->get_name() << endl);
655 
656  AttrTable::Attr_iter at_p = at->attr_begin();
657  while (at_p != at->attr_end()) {
658  DBG(cerr << __func__ << "() - Attribute '" << at->get_name(at_p) << "' is type: " << at->get_type(at_p) << endl);
659  if (at->get_attr_type(at_p) == Attr_container){
660  // An attribute container may actually represent a child member variable. When
661  // that's the case we don't want to add the container to the parent type, but
662  // rather let any child of BaseType deal with those containers in the child's
663  // overridden transfer_attributes() method.
664  // We capitalize on the magic of the BaseType API and utilize the var() method
665  // to check for a child variable of the same name and, if one exists, we'll skip
666  // this AttrTable and let a child constructor class like Grid or Constructor
667  // deal with it.
668  BaseType *bt = var(at->get_name(at_p),true);
669  if(bt==0){
670  DBG(cerr << __func__ << "() - Adding container '" << at->get_name(at_p) << endl);
671  get_attr_table().append_container(new AttrTable(*at->get_attr_table(at_p)), at->get_name(at_p));
672  }
673  else {
674  DBG(cerr << __func__ << "() - Found child var: '"<< bt->type_name()<< " " << bt->name() << " (address:" << (void *) bt << ")" << endl);
675  DBG(cerr << __func__ << "() - Skipping container '" << at->get_name(at_p) << endl);
676  }
677  }
678  else {
679  DBG(cerr << __func__ << "() - Adding Attribute '" << at->get_name(at_p) << endl);
680  get_attr_table().append_attr(at->get_name(at_p), at->get_type(at_p), at->get_attr_vector(at_p));
681  }
682  at_p++;
683  }
684  }
685  else {
686  DBG(cerr << __func__ << "() - Unable to locate AttrTable '" << name() << "' SKIPPING" << endl);
687 
688  }
689 }
690 
702 bool
704 {
705  return d_in_selection;
706 }
707 
717 void
719 {
720  d_in_selection = state;
721 }
722 
723 // Protected method.
732 void
734 {
735  if (!dynamic_cast<Constructor *>(parent)
736  && !dynamic_cast<Vector *>(parent)
737  && parent != 0)
738  throw InternalErr("Call to set_parent with incorrect variable type.");
739 
740  d_parent = parent;
741 }
742 
743 // Public method.
744 
750 BaseType *
752 {
753  return d_parent;
754 }
755 
756 // Documented in the header file.
757 BaseType *
758 BaseType::var(const string &/*name*/, bool /*exact_match*/, btp_stack */*s*/)
759 {
760  return static_cast<BaseType *>(0);
761 }
762 
779 BaseType *
780 BaseType::var(const string &, btp_stack &)
781 {
782  return static_cast<BaseType *>(0);
783 }
784 
814 void
816 {
817  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var unimplemented");
818 }
819 
820 void
821 BaseType::add_var_nocopy(BaseType *, Part)
822 {
823  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var_nocopy unimplemented");
824 }
825 
898 bool
900 {
901  if (d_is_read)
902  return true;
903 
904  throw InternalErr("Unimplemented BaseType::read() method called for the variable named: " + name());
905 }
906 
907 void
909 {
910 #if USE_LOCAL_TIMEOUT_SCHEME
911  dds.timeout_on();
912 #endif
913  DBG2(cerr << "BaseType::intern_data: " << name() << endl);
914  if (!read_p())
915  read(); // read() throws Error and InternalErr
916 #if USE_LOCAL_TIMEOUT_SCHEME
917  dds.timeout_off();
918 #endif
919 }
920 
926 void
927 BaseType::intern_data(/*Crc32 &checksum, DMR &, ConstraintEvaluator &*/)
928 {
929  if (!read_p())
930  read(); // read() throws Error and InternalErr
931 #if 0
932  compute_checksum(checksum);
933 #endif
934 }
935 
936 bool
938 {
939  throw InternalErr(__FILE__, __LINE__, "The DAP2 serialize() method has not been implemented for " + type_name());
940 }
941 
942 bool
944 {
945  throw InternalErr(__FILE__, __LINE__, "The DAP2 deserialize() method has not been implemented for " + type_name());
946 }
947 
948 void
949 BaseType::serialize(D4StreamMarshaller &, DMR &, /*ConstraintEvaluator &,*/ bool)
950 {
951  throw InternalErr(__FILE__, __LINE__, "The DAP4 serialize() method has not been implemented for " + type_name());
952 }
953 
954 void
956 {
957  throw InternalErr(__FILE__, __LINE__, "The DAP4 deserialize() method has not been implemented for " + type_name());
958 }
959 
1002 void
1003 BaseType::print_decl(FILE *out, string space, bool print_semi,
1004  bool constraint_info, bool constrained)
1005 {
1006  ostringstream oss;
1007  print_decl(oss, space, print_semi, constraint_info, constrained);
1008  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1009 }
1010 
1053 void
1054 BaseType::print_decl(ostream &out, string space, bool print_semi,
1055  bool constraint_info, bool constrained)
1056 {
1057  // if printing the constrained declaration, exit if this variable was not
1058  // selected.
1059  if (constrained && !send_p())
1060  return;
1061 
1062  out << space << type_name() << " " << id2www(name()) ;
1063 
1064  if (constraint_info) {
1065  if (send_p())
1066  out << ": Send True" ;
1067  else
1068  out << ": Send False" ;
1069  }
1070 
1071  if (print_semi)
1072  out << ";\n" ;
1073 }
1074 
1089 void
1090 BaseType::print_val(FILE *out, string space, bool print_decl_p)
1091 {
1092  ostringstream oss;
1093  print_val(oss, space, print_decl_p);
1094  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1095 }
1096 
1104 void
1105 BaseType::print_xml(FILE *out, string space, bool constrained)
1106 {
1107  XMLWriter xml(space);
1108  print_xml_writer(xml, constrained);
1109  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
1110 }
1111 
1119 void
1120 BaseType::print_xml(ostream &out, string space, bool constrained)
1121 {
1122  XMLWriter xml(space);
1123  print_xml_writer(xml, constrained);
1124  out << xml.get_doc();
1125 }
1126 
1133 void
1134 BaseType::print_xml_writer(XMLWriter &xml, bool constrained)
1135 {
1136  if (constrained && !send_p())
1137  return;
1138 
1139  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
1140  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
1141 
1142  if (!name().empty())
1143  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
1144  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
1145 
1146  if (is_dap4())
1147  attributes()->print_dap4(xml);
1148 
1149  if (!is_dap4() && get_attr_table().get_size() > 0)
1151 
1152  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1153  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
1154 }
1155 
1163 void
1164 BaseType::print_dap4(XMLWriter &xml, bool constrained)
1165 {
1166  print_xml_writer(xml, constrained);
1167 }
1168 
1169 // Compares the object's current state with the semantics of a particular
1170 // type. This will typically be defined in ctor classes (which have
1171 // complicated semantics). For BaseType, an object is semantically correct if
1172 // it has both a non-null name and type.
1173 //
1174 // NB: This is not the same as an invariant -- during the parse objects exist
1175 // but have no name. Also, the bool ALL defaults to false for BaseType. It is
1176 // used by children of CtorType.
1177 //
1178 // Returns: true if the object is semantically correct, false otherwise.
1179 
1208 bool
1209 BaseType::check_semantics(string &msg, bool)
1210 {
1211  bool sem = (d_type != dods_null_c && name().length());
1212 
1213  if (!sem)
1214  msg = "Every variable must have both a name and a type\n";
1215 
1216  return sem;
1217 }
1218 
1255 bool
1257 {
1258  // Even though ops is a public method, it can never be called because
1259  // they will never have a BaseType object since this class is abstract,
1260  // however any of the child classes could by mistake call BaseType::ops
1261  // so this is an internal error. Jose Garcia
1262  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1263 }
1264 
1281 bool
1283 {
1284  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1285 }
1286 
1298 unsigned int
1299 BaseType::width(bool /* constrained */) const
1300 {
1301  throw InternalErr(__FILE__, __LINE__, "not implemented");
1302 }
1303 
1304 } // namespace libdap
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:899
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
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:54
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 bool d4_ops(BaseType *b, int op)
Evaluator a relop for DAP4.
Definition: BaseType.cc:1282
virtual void dump(ostream &strm) const
dumps information about this object
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1164
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:291
virtual Attr_iter attr_end()
Definition: AttrTable.cc:719
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
Definition: BaseType.cc:1105
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48
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:859
Contains the attributes for a dataset.
Definition: AttrTable.h:142
virtual void set_name(const string &n)
Sets the name of the class instance.
Definition: BaseType.cc:344
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: BaseType.cc:943
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
Definition: AttrTable.cc:613
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1134
virtual string get_name() const
Get the name of this attribute table.
Definition: AttrTable.cc:238
Read data from the stream made by D4StreamMarshaller.
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:126
STL namespace.
bool is_vector_type(Type t)
Returns true if the instance is a vector (i.e., array) type variable.
Definition: util.cc:815
void print_xml_writer(XMLWriter &xml)
Definition: AttrTable.cc:1425
virtual bool is_simple_type() const
Returns true if the instance is a numeric, string or URL type variable.
Definition: BaseType.cc:393
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
Definition: Constructor.cc:432
virtual void add_var(BaseType *bt, Part part=nil)
Add a variable.
Definition: BaseType.cc:815
Type
Identifies the data type.
Definition: Type.h:94
virtual string toString()
Definition: BaseType.cc:184
virtual void set_in_selection(bool state)
Definition: BaseType.cc:718
virtual bool is_in_selection()
Is this variable part of the current selection?
Definition: BaseType.cc:703
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:733
top level DAP object to house generic methods
Definition: AISConnect.cc:30
A class for software fault reporting.
Definition: InternalErr.h:64
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
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
Definition: BaseType.cc:402
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 print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: BaseType.cc:1090
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:937
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: BaseType.cc:443
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4&#39;s receiv...
virtual void set_send_p(bool state)
Definition: BaseType.cc:568
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:412
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition: AttrTable.cc:410
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
Definition: AttrTable.cc:607
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:365
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:694
virtual void set_type(const Type &t)
Sets the type of the class instance.
Definition: BaseType.cc:372
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: BaseType.cc:516
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: BaseType.cc:216
bool is_simple_type(Type t)
Returns true if the instance is a numeric, string or URL type variable.
Definition: util.cc:775
virtual D4Attributes * attributes()
Definition: BaseType.cc:599
virtual void intern_data()
Read data into this variable.
Definition: BaseType.cc:927
virtual bool synthesized_p()
Definition: BaseType.cc:452
virtual Attr_iter attr_begin()
Definition: AttrTable.cc:711
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
Definition: BaseType.cc:259
void m_duplicate(const BaseType &bt)
Perform a deep copy.
Definition: BaseType.cc:86
Evaluate a constraint expression.
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:582
virtual BaseType * get_parent() const
Definition: BaseType.cc:751
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
Definition: AttrTable.cc:307
The basic data type for the DODS DAP types.
Definition: BaseType.h:117
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:649
libdap base object for common functionality of libdap objects
Definition: DapObj.h:50
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
Definition: AttrTable.cc:621
abstract base class used to marshal/serialize dap data objects
Definition: Marshaller.h:50
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:379
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:590
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: BaseType.cc:1256
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
Definition: AttrTable.cc:653
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
virtual void dump(ostream &strm) const
dumps information about this object
Definition: AttrTable.cc:1510
virtual void transfer_attributes(AttrTable *at)
Definition: BaseType.cc:644
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
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:1299
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:554
string id2www(string in, const string &allowable)
Definition: escaping.cc:153
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:358
virtual bool check_semantics(string &msg, bool all=false)
Compare an object&#39;s current state with the semantics of its type.
Definition: BaseType.cc:1209
virtual void set_synthesized_p(bool state)
Definition: BaseType.cc:463