libdap  Updated for version 3.20.2
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  AttrTable *attrs = this->attributes()->get_AttrTable(name());
264  dest->set_attr_table(*attrs);
265  dest->set_is_dap4(false);
266  // attrs->print(cerr,"",true);
267 
268  vector<BaseType *> *result = new vector<BaseType *>();
269  result->push_back(dest);
270  return result;
271 }
272 
273 
282 void
283 BaseType::dump(ostream &strm) const
284 {
285  strm << DapIndent::LMarg << "BaseType::dump - ("
286  << (void *)this << ")" << endl ;
287  DapIndent::Indent() ;
288 
289  strm << DapIndent::LMarg << "name: " << name() << endl ;
290  strm << DapIndent::LMarg << "type: " << type_name() << endl ;
291  strm << DapIndent::LMarg << "dataset: " << d_dataset << endl ;
292  strm << DapIndent::LMarg << "read_p: " << d_is_read << endl ;
293  strm << DapIndent::LMarg << "send_p: " << d_is_send << endl ;
294  strm << DapIndent::LMarg << "synthesized_p: " << d_is_synthesized << endl ;
295  strm << DapIndent::LMarg << "parent: " << (void *)d_parent << endl ;
296  strm << DapIndent::LMarg << "attributes: " << endl ;
297  DapIndent::Indent() ;
298 
299  if (d_attributes)
300  d_attributes->dump(strm);
301  else
302  d_attr.dump(strm) ;
303 
304  DapIndent::UnIndent() ;
305 
306  DapIndent::UnIndent() ;
307 }
308 
311 string
313 {
314  return d_name;
315 }
316 
323 string
325 {
326  if (get_parent() == 0)
327  return name();
328  else if (get_parent()->type() == dods_group_c)
329  return get_parent()->FQN() + name();
330  else
331  return get_parent()->FQN() + "." + name();
332 }
333 
335 void
336 BaseType::set_name(const string &n)
337 {
338  string name = n;
339  d_name = www2id(name); // www2id writes into its param.
340 }
341 
349 string
351 {
352  return d_dataset;
353 }
354 
356 Type
358 {
359  return d_type;
360 }
361 
363 void
365 {
366  d_type = t;
367 }
368 
370 string
372 {
373  if (is_dap4())
374  return libdap::D4type_name(d_type);
375  else
376  return libdap::D2type_name(d_type);
377 }
378 
384 bool
386 {
387  return libdap::is_simple_type(type());
388 }
389 
393 bool
395 {
396  return libdap::is_vector_type(type());
397 }
398 
403 bool
405 {
407 }
408 
434 int
436 {
437  return 1;
438 }
439 
443 bool
445 {
446  return d_is_synthesized;
447 }
448 
454 void
456 {
457  d_is_synthesized = state;
458 }
459 
460 // Return the state of d_is_read (true if the value of the variable has been
461 // read (and is in memory) false otherwise).
462 
471 bool
473 {
474  return d_is_read;
475 }
476 
507 void
509 {
510  // The this comment is/was wrong!
511  // The is_synthesized property was not being used and the more I thought
512  // about how this was coded, the more this code below seemed like a bad idea.
513  // Once the property was set, the read_p property could not be changed.
514  // That seems a little silly. Also, I think I need to use this is_synthesized
515  // property for some of the server function code I'm working on for Raytheon,
516  // and I'd like to be able to control the read_p property! jhrg 3/9/15
517 
518  // What's true: The is_synthesized property is used by
519  // 'projection functions' in the freeform handler. It might be better
520  // to modify the FFtypes to support this behavior, but for now I'm returning
521  // the library to its old behavior. That this change (setting is_read
522  // of the value of is_syn...) broke the FF handler was not detected
523  // because the FF tests were not being run due to an error in the FF
524  // bes-testsuite Makefile.am). jhrg 9/9/15
525 
526 #if 1
527  if (!d_is_synthesized) {
528  d_is_read = state;
529  }
530 #else
531  d_is_read = state;
532 #endif
533 }
534 
545 bool
547 {
548  return d_is_send;
549 }
550 
559 void
561 {
562  DBG2(cerr << "Calling BaseType::set_send_p() for: " << this->name()
563  << endl);
564  d_is_send = state;
565 }
566 
567 
573 AttrTable &
575 {
576  return d_attr;
577 }
578 
581 void
583 {
584  d_attr = at;
585 }
586 
590 D4Attributes *
592 {
593  if (!d_attributes) d_attributes = new D4Attributes();
594  return d_attributes;
595 }
596 
597 void
598 BaseType::set_attributes(D4Attributes *attrs)
599 {
600  d_attributes = new D4Attributes(*attrs);
601 }
602 
603 void
604 BaseType::set_attributes_nocopy(D4Attributes *attrs)
605 {
606  d_attributes = attrs;
607 }
609 
637 
638  DBG(cerr << __func__ << "() - BEGIN name:'" << name() << "'" << endl);
639 
640  AttrTable *at = at_container->get_attr_table(name());
641  DBG(cerr << __func__ << "() - at: "<< (void *) at << endl);
642 
643 
644  if (at) {
645  at->set_is_global_attribute(false);
646  DBG(cerr << __func__ << "() - Processing AttrTable: " << at->get_name() << endl);
647 
648  AttrTable::Attr_iter at_p = at->attr_begin();
649  while (at_p != at->attr_end()) {
650  DBG(cerr << __func__ << "() - Attribute '" << at->get_name(at_p) << "' is type: " << at->get_type(at_p) << endl);
651  if (at->get_attr_type(at_p) == Attr_container){
652  // An attribute container may actually represent a child member variable. When
653  // that's the case we don't want to add the container to the parent type, but
654  // rather let any child of BaseType deal with those containers in the child's
655  // overridden transfer_attributes() method.
656  // We capitalize on the magic of the BaseType API and utilize the var() method
657  // to check for a child variable of the same name and, if one exists, we'll skip
658  // this AttrTable and let a child constructor class like Grid or Constructor
659  // deal with it.
660  BaseType *bt = var(at->get_name(at_p),true);
661  if(bt==0){
662  DBG(cerr << __func__ << "() - Adding container '" << at->get_name(at_p) << endl);
663  get_attr_table().append_container(new AttrTable(*at->get_attr_table(at_p)), at->get_name(at_p));
664  }
665  else {
666  DBG(cerr << __func__ << "() - Found child var: '"<< bt->type_name()<< " " << bt->name() << " (address:" << (void *) bt << ")" << endl);
667  DBG(cerr << __func__ << "() - Skipping container '" << at->get_name(at_p) << endl);
668  }
669  }
670  else {
671  DBG(cerr << __func__ << "() - Adding Attribute '" << at->get_name(at_p) << endl);
672  get_attr_table().append_attr(at->get_name(at_p), at->get_type(at_p), at->get_attr_vector(at_p));
673  }
674  at_p++;
675  }
676  }
677  else {
678  DBG(cerr << __func__ << "() - Unable to locate AttrTable '" << name() << "' SKIPPING" << endl);
679 
680  }
681 }
682 
694 bool
696 {
697  return d_in_selection;
698 }
699 
709 void
711 {
712  d_in_selection = state;
713 }
714 
715 // Protected method.
724 void
726 {
727  if (!dynamic_cast<Constructor *>(parent)
728  && !dynamic_cast<Vector *>(parent)
729  && parent != 0)
730  throw InternalErr("Call to set_parent with incorrect variable type.");
731 
732  d_parent = parent;
733 }
734 
735 // Public method.
736 
742 BaseType *
744 {
745  return d_parent;
746 }
747 
748 // Documented in the header file.
749 BaseType *
750 BaseType::var(const string &/*name*/, bool /*exact_match*/, btp_stack */*s*/)
751 {
752  return static_cast<BaseType *>(0);
753 }
754 
771 BaseType *
772 BaseType::var(const string &, btp_stack &)
773 {
774  return static_cast<BaseType *>(0);
775 }
776 
806 void
808 {
809  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var unimplemented");
810 }
811 
812 void
813 BaseType::add_var_nocopy(BaseType *, Part)
814 {
815  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var_nocopy unimplemented");
816 }
817 
890 bool
892 {
893  if (d_is_read)
894  return true;
895 
896  throw InternalErr("Unimplemented BaseType::read() method called for the variable named: " + name());
897 }
898 
899 void
901 {
902 #if USE_LOCAL_TIMEOUT_SCHEME
903  dds.timeout_on();
904 #endif
905  DBG2(cerr << "BaseType::intern_data: " << name() << endl);
906  if (!read_p())
907  read(); // read() throws Error and InternalErr
908 #if USE_LOCAL_TIMEOUT_SCHEME
909  dds.timeout_off();
910 #endif
911 }
912 
918 void
919 BaseType::intern_data(/*Crc32 &checksum, DMR &, ConstraintEvaluator &*/)
920 {
921  if (!read_p())
922  read(); // read() throws Error and InternalErr
923 #if 0
924  compute_checksum(checksum);
925 #endif
926 }
927 
928 bool
930 {
931  throw InternalErr(__FILE__, __LINE__, "The DAP2 serialize() method has not been implemented for " + type_name());
932 }
933 
934 bool
936 {
937  throw InternalErr(__FILE__, __LINE__, "The DAP2 deserialize() method has not been implemented for " + type_name());
938 }
939 
940 void
941 BaseType::serialize(D4StreamMarshaller &, DMR &, /*ConstraintEvaluator &,*/ bool)
942 {
943  throw InternalErr(__FILE__, __LINE__, "The DAP4 serialize() method has not been implemented for " + type_name());
944 }
945 
946 void
948 {
949  throw InternalErr(__FILE__, __LINE__, "The DAP4 deserialize() method has not been implemented for " + type_name());
950 }
951 
994 void
995 BaseType::print_decl(FILE *out, string space, bool print_semi,
996  bool constraint_info, bool constrained)
997 {
998  ostringstream oss;
999  print_decl(oss, space, print_semi, constraint_info, constrained);
1000  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1001 }
1002 
1045 void
1046 BaseType::print_decl(ostream &out, string space, bool print_semi,
1047  bool constraint_info, bool constrained)
1048 {
1049  // if printing the constrained declaration, exit if this variable was not
1050  // selected.
1051  if (constrained && !send_p())
1052  return;
1053 
1054  out << space << type_name() << " " << id2www(name()) ;
1055 
1056  if (constraint_info) {
1057  if (send_p())
1058  out << ": Send True" ;
1059  else
1060  out << ": Send False" ;
1061  }
1062 
1063  if (print_semi)
1064  out << ";\n" ;
1065 }
1066 
1081 void
1082 BaseType::print_val(FILE *out, string space, bool print_decl_p)
1083 {
1084  ostringstream oss;
1085  print_val(oss, space, print_decl_p);
1086  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1087 }
1088 
1096 void
1097 BaseType::print_xml(FILE *out, string space, bool constrained)
1098 {
1099  XMLWriter xml(space);
1100  print_xml_writer(xml, constrained);
1101  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
1102 }
1103 
1111 void
1112 BaseType::print_xml(ostream &out, string space, bool constrained)
1113 {
1114  XMLWriter xml(space);
1115  print_xml_writer(xml, constrained);
1116  out << xml.get_doc();
1117 }
1118 
1125 void
1126 BaseType::print_xml_writer(XMLWriter &xml, bool constrained)
1127 {
1128  if (constrained && !send_p())
1129  return;
1130 
1131  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
1132  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
1133 
1134  if (!name().empty())
1135  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
1136  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
1137 
1138  if (is_dap4())
1139  attributes()->print_dap4(xml);
1140 
1141  if (!is_dap4() && get_attr_table().get_size() > 0)
1143 
1144  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1145  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
1146 }
1147 
1155 void
1156 BaseType::print_dap4(XMLWriter &xml, bool constrained)
1157 {
1158  print_xml_writer(xml, constrained);
1159 }
1160 
1161 // Compares the object's current state with the semantics of a particular
1162 // type. This will typically be defined in ctor classes (which have
1163 // complicated semantics). For BaseType, an object is semantically correct if
1164 // it has both a non-null name and type.
1165 //
1166 // NB: This is not the same as an invariant -- during the parse objects exist
1167 // but have no name. Also, the bool ALL defaults to false for BaseType. It is
1168 // used by children of CtorType.
1169 //
1170 // Returns: true if the object is semantically correct, false otherwise.
1171 
1200 bool
1201 BaseType::check_semantics(string &msg, bool)
1202 {
1203  bool sem = (d_type != dods_null_c && name().length());
1204 
1205  if (!sem)
1206  msg = "Every variable must have both a name and a type\n";
1207 
1208  return sem;
1209 }
1210 
1247 bool
1249 {
1250  // Even though ops is a public method, it can never be called because
1251  // they will never have a BaseType object since this class is abstract,
1252  // however any of the child classes could by mistake call BaseType::ops
1253  // so this is an internal error. Jose Garcia
1254  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1255 }
1256 
1273 bool
1275 {
1276  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1277 }
1278 
1292 unsigned int
1293 BaseType::width(bool /* constrained */) const
1294 {
1295  throw InternalErr(__FILE__, __LINE__, "not implemented");
1296 #if 0
1297  return width(constrained);
1298 #endif
1299 }
1300 
1301 } // namespace libdap
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:891
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
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:995
AttrTable * get_AttrTable(const std::string name)
copy attributes from DAP4 to DAP2
virtual bool d4_ops(BaseType *b, int op)
Evaluator a relop for DAP4.
Definition: BaseType.cc:1274
virtual void dump(ostream &strm) const
dumps information about this object
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1156
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:283
virtual Attr_iter attr_end()
Definition: AttrTable.cc:719
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
Definition: BaseType.cc:1097
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:863
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:336
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: BaseType.cc:935
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:1126
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:817
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:385
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:807
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:710
virtual bool is_in_selection()
Is this variable part of the current selection?
Definition: BaseType.cc:695
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:725
top level DAP object to house generic methods
Definition: AlarmHandler.h:35
A class for software fault reporting.
Definition: InternalErr.h:64
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
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
Definition: BaseType.cc:394
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:1082
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:929
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: BaseType.cc:435
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:560
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:404
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:357
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:364
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: BaseType.cc:508
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:591
virtual void intern_data()
Read data into this variable.
Definition: BaseType.cc:919
virtual bool synthesized_p()
Definition: BaseType.cc:444
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:574
virtual BaseType * get_parent() const
Definition: BaseType.cc:743
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:371
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:582
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: BaseType.cc:1248
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
Definition: AttrTable.cc:653
virtual void dump(ostream &strm) const
dumps information about this object
Definition: AttrTable.cc:1510
virtual void transfer_attributes(AttrTable *at)
Definition: BaseType.cc:636
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 use Return the number of bytes of storage this variable uses. For scalar types, this is pretty simple (an int32 uses 4 bytes, etc.). For arrays and Constructors, it is a bit more complex. Note that a scalar String variable uses sizeof(String*) bytes, not the length of the string. In other words, the value returned is independent of the type. Also note width() of a String array returns the number of elements in the array times sizeof(String*). That is, each different array size is a different data type.
Definition: BaseType.cc:1293
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:546
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:350
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:1201
virtual void set_synthesized_p(bool state)
Definition: BaseType.cc:455