libdap  Updated for version 3.19.1
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 
70 #include "debug.h"
71 
72 using namespace std;
73 
74 namespace libdap {
75 
76 // Protected copy mfunc
77 
84 void
85 BaseType::m_duplicate(const BaseType &bt)
86 {
87  DBG(cerr << "In BaseType::m_duplicate for " << bt.name() << endl);
88 
89  d_name = bt.d_name;
90  d_type = bt.d_type;
91  d_dataset = bt.d_dataset;
92  d_is_read = bt.d_is_read; // added, reza
93  d_is_send = bt.d_is_send; // added, reza
94  d_in_selection = bt.d_in_selection;
95  d_is_synthesized = bt.d_is_synthesized; // 5/11/2001 jhrg
96 
97  d_parent = bt.d_parent; // copy pointers 6/4/2001 jhrg
98 
99  d_attr = bt.d_attr; // Deep copy.
100 
101  if (bt.d_attributes)
102  d_attributes = new D4Attributes(*bt.d_attributes); // deep copy
103  else
104  d_attributes = 0; // init to null if not used.
105 
106  d_is_dap4 = bt.d_is_dap4;
107 
108  DBG(cerr << "Exiting BaseType::m_duplicate for " << bt.name() << endl);
109 }
110 
111 // Public mfuncs
112 
125 BaseType::BaseType(const string &n, const Type &t, bool is_dap4)
126 : d_name(n), d_type(t), d_dataset(""), d_is_read(false), d_is_send(false),
127  d_parent(0), d_attributes(0), d_is_dap4(is_dap4),
128  d_in_selection(false), d_is_synthesized(false)
129 {}
130 
143 BaseType::BaseType(const string &n, const string &d, const Type &t, bool is_dap4)
144 : d_name(n), d_type(t), d_dataset(d), d_is_read(false), d_is_send(false),
145  d_parent(0), d_attributes(0), d_is_dap4(is_dap4),
146  d_in_selection(false), d_is_synthesized(false)
147 {}
148 
150 BaseType::BaseType(const BaseType &copy_from) : DapObj()
151 {
152  DBG(cerr << "In BaseTpe::copy_ctor for " << copy_from.name() << endl);
153  m_duplicate(copy_from);
154 }
155 
156 BaseType::~BaseType()
157 {
158  DBG2(cerr << "Entering ~BaseType (" << this << ")" << endl);
159 
160  if (d_attributes)
161  delete d_attributes;
162 
163  DBG2(cerr << "Exiting ~BaseType" << endl);
164 }
165 
166 BaseType &
167 BaseType::operator=(const BaseType &rhs)
168 {
169  DBG(cerr << "Entering BaseType::operator=" << endl);
170  if (this == &rhs)
171  return *this;
172 
173  m_duplicate(rhs);
174 
175  DBG(cerr << "Exiting BaseType::operator=" << endl);
176  return *this;
177 }
178 
184 {
185  ostringstream oss;
186  oss << "BaseType (" << this << "):" << endl
187  << " _name: " << name() << endl
188  << " _type: " << type_name() << endl
189  << " _dataset: " << d_dataset << endl
190  << " _read_p: " << d_is_read << endl
191  << " _send_p: " << d_is_send << endl
192  << " _synthesized_p: " << d_is_synthesized << endl
193  << " d_parent: " << d_parent << endl
194  << " d_attr: " << hex << &d_attr << dec << endl;
195 
196  return oss.str();
197 }
198 
214 void
216 {
217  BaseType *dest = ptr_duplicate();
218  // If it's already a DAP4 object then we can just return it!
219  if(!is_dap4()){
221  dest->set_is_dap4(true);
222  }
223  container->add_var_nocopy(dest);
224 }
225 
226 
257 std::vector<BaseType *> *
259 {
260  BaseType *dest = this->ptr_duplicate();
261  // convert the d4 attributes to a dap2 attribute table.
262  AttrTable *attrs = this->attributes()->get_AttrTable(name());
263  dest->set_attr_table(*attrs);
264  dest->set_is_dap4(false);
265  // attrs->print(cerr,"",true);
266 
267  vector<BaseType *> *result = new vector<BaseType *>();
268  result->push_back(dest);
269  return result;
270 }
271 
272 
281 void
282 BaseType::dump(ostream &strm) const
283 {
284  strm << DapIndent::LMarg << "BaseType::dump - ("
285  << (void *)this << ")" << endl ;
286  DapIndent::Indent() ;
287 
288  strm << DapIndent::LMarg << "name: " << name() << endl ;
289  strm << DapIndent::LMarg << "type: " << type_name() << endl ;
290  strm << DapIndent::LMarg << "dataset: " << d_dataset << endl ;
291  strm << DapIndent::LMarg << "read_p: " << d_is_read << endl ;
292  strm << DapIndent::LMarg << "send_p: " << d_is_send << endl ;
293  strm << DapIndent::LMarg << "synthesized_p: " << d_is_synthesized << endl ;
294  strm << DapIndent::LMarg << "parent: " << (void *)d_parent << endl ;
295  strm << DapIndent::LMarg << "attributes: " << endl ;
296  DapIndent::Indent() ;
297 
298  if (d_attributes)
299  d_attributes->dump(strm);
300  else
301  d_attr.dump(strm) ;
302 
303  DapIndent::UnIndent() ;
304 
305  DapIndent::UnIndent() ;
306 }
307 
310 string
312 {
313  return d_name;
314 }
315 
322 string
324 {
325  if (get_parent() == 0)
326  return name();
327  else if (get_parent()->type() == dods_group_c)
328  return get_parent()->FQN() + name();
329  else
330  return get_parent()->FQN() + "." + name();
331 }
332 
334 void
335 BaseType::set_name(const string &n)
336 {
337  string name = n;
338  d_name = www2id(name); // www2id writes into its param.
339 }
340 
348 string
350 {
351  return d_dataset;
352 }
353 
355 Type
357 {
358  return d_type;
359 }
360 
362 void
364 {
365  d_type = t;
366 }
367 
369 string
371 {
372  if (is_dap4())
373  return libdap::D4type_name(d_type);
374  else
375  return libdap::D2type_name(d_type);
376 }
377 
383 bool
385 {
386  return libdap::is_simple_type(type());
387 }
388 
392 bool
394 {
395  return libdap::is_vector_type(type());
396 }
397 
402 bool
404 {
406 }
407 
433 int
435 {
436  return 1;
437 }
438 
442 bool
444 {
445  return d_is_synthesized;
446 }
447 
453 void
455 {
456  d_is_synthesized = state;
457 }
458 
459 // Return the state of d_is_read (true if the value of the variable has been
460 // read (and is in memory) false otherwise).
461 
470 bool
472 {
473  return d_is_read;
474 }
475 
506 void
508 {
509  // The this comment is/was wrong!
510  // The is_synthesized property was not being used and the more I thought
511  // about how this was coded, the more this code below seemed like a bad idea.
512  // Once the property was set, the read_p property could not be changed.
513  // That seems a little silly. Also, I think I need to use this is_synthesized
514  // property for some of the server function code I'm working on for Raytheon,
515  // and I'd like to be able to control the read_p property! jhrg 3/9/15
516 
517  // What's true: The is_synthesized property is used by
518  // 'projection functions' in the freeform handler. It might be better
519  // to modify the FFtypes to support this behavior, but for now I'm returning
520  // the library to its old behavior. That this change (setting is_read
521  // of the value of is_syn...) broke the FF handler was not detected
522  // because the FF tests were not being run due to an error in the FF
523  // bes-testsuite Makefile.am). jhrg 9/9/15
524 
525 #if 1
526  if (!d_is_synthesized) {
527  d_is_read = state;
528  }
529 #else
530  d_is_read = state;
531 #endif
532 }
533 
544 bool
546 {
547  return d_is_send;
548 }
549 
558 void
560 {
561  DBG2(cerr << "Calling BaseType::set_send_p() for: " << this->name()
562  << endl);
563  d_is_send = state;
564 }
565 
566 
572 AttrTable &
574 {
575  return d_attr;
576 }
577 
580 void
582 {
583  d_attr = at;
584 }
585 
589 D4Attributes *
591 {
592  if (!d_attributes) d_attributes = new D4Attributes();
593  return d_attributes;
594 }
595 
596 void
597 BaseType::set_attributes(D4Attributes *attrs)
598 {
599  d_attributes = new D4Attributes(*attrs);
600 }
601 
602 void
603 BaseType::set_attributes_nocopy(D4Attributes *attrs)
604 {
605  d_attributes = attrs;
606 }
608 
636 
637  DBG(cerr << __func__ << "() - BEGIN name:'" << name() << "'" << endl);
638 
639  AttrTable *at = at_container->get_attr_table(name());
640  DBG(cerr << __func__ << "() - at: "<< (void *) at << endl);
641 
642 
643  if (at) {
644  at->set_is_global_attribute(false);
645  DBG(cerr << __func__ << "() - Processing AttrTable: " << at->get_name() << endl);
646 
647  AttrTable::Attr_iter at_p = at->attr_begin();
648  while (at_p != at->attr_end()) {
649  DBG(cerr << __func__ << "() - Attribute '" << at->get_name(at_p) << "' is type: " << at->get_type(at_p) << endl);
650  if (at->get_attr_type(at_p) == Attr_container){
651  // An attribute container may actually represent a child member variable. When
652  // that's the case we don't want to add the container to the parent type, but
653  // rather let any child of BaseType deal with those containers in the child's
654  // overridden transfer_attributes() method.
655  // We capitalize on the magic of the BaseType API and utilize the var() method
656  // to check for a child variable of the same name and, if one exists, we'll skip
657  // this AttrTable and let a child constructor class like Grid or Constructor
658  // deal with it.
659  BaseType *bt = var(at->get_name(at_p),true);
660  if(bt==0){
661  DBG(cerr << __func__ << "() - Adding container '" << at->get_name(at_p) << endl);
662  get_attr_table().append_container(new AttrTable(*at->get_attr_table(at_p)), at->get_name(at_p));
663  }
664  else {
665  DBG(cerr << __func__ << "() - Found child var: '"<< bt->type_name()<< " " << bt->name() << " (address:" << (void *) bt << ")" << endl);
666  DBG(cerr << __func__ << "() - Skipping container '" << at->get_name(at_p) << endl);
667  }
668  }
669  else {
670  DBG(cerr << __func__ << "() - Adding Attribute '" << at->get_name(at_p) << endl);
671  get_attr_table().append_attr(at->get_name(at_p), at->get_type(at_p), at->get_attr_vector(at_p));
672  }
673  at_p++;
674  }
675  }
676  else {
677  DBG(cerr << __func__ << "() - Unable to locate AttrTable '" << name() << "' SKIPPING" << endl);
678 
679  }
680 }
681 
693 bool
695 {
696  return d_in_selection;
697 }
698 
708 void
710 {
711  d_in_selection = state;
712 }
713 
714 // Protected method.
723 void
725 {
726  if (!dynamic_cast<Constructor *>(parent)
727  && !dynamic_cast<Vector *>(parent)
728  && parent != 0)
729  throw InternalErr("Call to set_parent with incorrect variable type.");
730 
731  d_parent = parent;
732 }
733 
734 // Public method.
735 
741 BaseType *
743 {
744  return d_parent;
745 }
746 
747 // Documented in the header file.
748 BaseType *
749 BaseType::var(const string &/*name*/, bool /*exact_match*/, btp_stack */*s*/)
750 {
751  return static_cast<BaseType *>(0);
752 }
753 
770 BaseType *
771 BaseType::var(const string &, btp_stack &)
772 {
773  return static_cast<BaseType *>(0);
774 }
775 
805 void
807 {
808  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var unimplemented");
809 }
810 
811 void
812 BaseType::add_var_nocopy(BaseType *, Part)
813 {
814  throw InternalErr(__FILE__, __LINE__, "BaseType::add_var_nocopy unimplemented");
815 }
816 
889 bool
891 {
892  if (d_is_read)
893  return true;
894 
895  throw InternalErr("Unimplemented BaseType::read() method called for the variable named: " + name());
896 }
897 
898 void
900 {
901 #if USE_LOCAL_TIMEOUT_SCHEME
902  dds.timeout_on();
903 #endif
904  DBG2(cerr << "BaseType::intern_data: " << name() << endl);
905  if (!read_p())
906  read(); // read() throws Error and InternalErr
907 #if USE_LOCAL_TIMEOUT_SCHEME
908  dds.timeout_off();
909 #endif
910 }
911 
917 void
918 BaseType::intern_data(/*Crc32 &checksum, DMR &, ConstraintEvaluator &*/)
919 {
920  if (!read_p())
921  read(); // read() throws Error and InternalErr
922 #if 0
923  compute_checksum(checksum);
924 #endif
925 }
926 
927 bool
929 {
930  throw InternalErr(__FILE__, __LINE__, "The DAP2 serialize() method has not been implemented for " + type_name());
931 }
932 
933 bool
935 {
936  throw InternalErr(__FILE__, __LINE__, "The DAP2 deserialize() method has not been implemented for " + type_name());
937 }
938 
939 void
940 BaseType::serialize(D4StreamMarshaller &, DMR &, /*ConstraintEvaluator &,*/ bool)
941 {
942  throw InternalErr(__FILE__, __LINE__, "The DAP4 serialize() method has not been implemented for " + type_name());
943 }
944 
945 void
947 {
948  throw InternalErr(__FILE__, __LINE__, "The DAP4 deserialize() method has not been implemented for " + type_name());
949 }
950 
993 void
994 BaseType::print_decl(FILE *out, string space, bool print_semi,
995  bool constraint_info, bool constrained)
996 {
997  ostringstream oss;
998  print_decl(oss, space, print_semi, constraint_info, constrained);
999  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1000 }
1001 
1044 void
1045 BaseType::print_decl(ostream &out, string space, bool print_semi,
1046  bool constraint_info, bool constrained)
1047 {
1048  // if printing the constrained declaration, exit if this variable was not
1049  // selected.
1050  if (constrained && !send_p())
1051  return;
1052 
1053  out << space << type_name() << " " << id2www(name()) ;
1054 
1055  if (constraint_info) {
1056  if (send_p())
1057  out << ": Send True" ;
1058  else
1059  out << ": Send False" ;
1060  }
1061 
1062  if (print_semi)
1063  out << ";\n" ;
1064 }
1065 
1080 void
1081 BaseType::print_val(FILE *out, string space, bool print_decl_p)
1082 {
1083  ostringstream oss;
1084  print_val(oss, space, print_decl_p);
1085  fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
1086 }
1087 
1095 void
1096 BaseType::print_xml(FILE *out, string space, bool constrained)
1097 {
1098  XMLWriter xml(space);
1099  print_xml_writer(xml, constrained);
1100  fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
1101 }
1102 
1110 void
1111 BaseType::print_xml(ostream &out, string space, bool constrained)
1112 {
1113  XMLWriter xml(space);
1114  print_xml_writer(xml, constrained);
1115  out << xml.get_doc();
1116 }
1117 
1124 void
1125 BaseType::print_xml_writer(XMLWriter &xml, bool constrained)
1126 {
1127  if (constrained && !send_p())
1128  return;
1129 
1130  if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
1131  throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
1132 
1133  if (!name().empty())
1134  if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
1135  throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
1136 
1137  if (is_dap4())
1138  attributes()->print_dap4(xml);
1139 
1140  if (!is_dap4() && get_attr_table().get_size() > 0)
1142 
1143  if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1144  throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
1145 }
1146 
1154 void
1155 BaseType::print_dap4(XMLWriter &xml, bool constrained)
1156 {
1157  print_xml_writer(xml, constrained);
1158 }
1159 
1160 // Compares the object's current state with the semantics of a particular
1161 // type. This will typically be defined in ctor classes (which have
1162 // complicated semantics). For BaseType, an object is semantically correct if
1163 // it has both a non-null name and type.
1164 //
1165 // NB: This is not the same as an invariant -- during the parse objects exist
1166 // but have no name. Also, the bool ALL defaults to false for BaseType. It is
1167 // used by children of CtorType.
1168 //
1169 // Returns: true if the object is semantically correct, false otherwise.
1170 
1199 bool
1200 BaseType::check_semantics(string &msg, bool)
1201 {
1202  bool sem = (d_type != dods_null_c && name().length());
1203 
1204  if (!sem)
1205  msg = "Every variable must have both a name and a type\n";
1206 
1207  return sem;
1208 }
1209 
1246 bool
1248 {
1249  // Even though ops is a public method, it can never be called because
1250  // they will never have a BaseType object since this class is abstract,
1251  // however any of the child classes could by mistake call BaseType::ops
1252  // so this is an internal error. Jose Garcia
1253  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1254 }
1255 
1272 bool
1274 {
1275  throw InternalErr(__FILE__, __LINE__, "Unimplemented operator.");
1276 }
1277 
1291 unsigned int
1292 BaseType::width(bool /* constrained */) const
1293 {
1294  throw InternalErr(__FILE__, __LINE__, "not implemented");
1295 #if 0
1296  return width(constrained);
1297 #endif
1298 }
1299 
1300 } // namespace libdap
libdap::ConstraintEvaluator
Evaluate a constraint expression.
Definition: ConstraintEvaluator.h:42
libdap::BaseType::set_attr_table
virtual void set_attr_table(const AttrTable &at)
Definition: BaseType.cc:581
libdap::BaseType::print_xml_writer
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1125
libdap::is_constructor_type
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
libdap::BaseType::is_constructor_type
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:403
libdap::AttrTable::attr_end
virtual Attr_iter attr_end()
Definition: AttrTable.cc:718
libdap::BaseType::ptr_duplicate
virtual BaseType * ptr_duplicate()=0
libdap::BaseType::intern_data
virtual void intern_data()
Read data into this variable.
Definition: BaseType.cc:918
libdap::BaseType::transform_to_dap4
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition: BaseType.cc:215
libdap::UnMarshaller
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:54
libdap::XMLWriter
Definition: XMLWriter.h:39
libdap::BaseType::toString
virtual string toString()
Definition: BaseType.cc:183
libdap::BaseType::name
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:311
libdap::BaseType::m_duplicate
void m_duplicate(const BaseType &bt)
Perform a deep copy.
Definition: BaseType.cc:85
libdap::BaseType::print_decl
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:994
libdap::InternalErr
A class for software fault reporting.
Definition: InternalErr.h:64
libdap::Part
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48
libdap::Marshaller
abstract base class used to marshal/serialize dap data objects
Definition: Marshaller.h:50
libdap::BaseType::serialize
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:928
libdap::BaseType::print_dap4
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: BaseType.cc:1155
libdap::BaseType::set_name
virtual void set_name(const string &n)
Sets the name of the class instance.
Definition: BaseType.cc:335
libdap::AttrTable::get_type
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
Definition: AttrTable.cc:612
libdap::D4Group
Definition: D4Group.h:43
libdap::BaseType::deserialize
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: BaseType.cc:934
libdap::Vector
Holds a one-dimensional collection of DAP2 data types.
Definition: Vector.h:80
libdap::BaseType::attributes
virtual D4Attributes * attributes()
Definition: BaseType.cc:590
libdap::BaseType::BaseType
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition: BaseType.cc:125
libdap::Type
Type
Identifies the data type.
Definition: Type.h:94
libdap::is_simple_type
bool is_simple_type(Type t)
Returns true if the instance is a numeric, string or URL type variable.
Definition: util.cc:775
libdap::BaseType::ops
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
Definition: BaseType.cc:1247
libdap::Constructor::add_var_nocopy
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
Definition: Constructor.cc:432
libdap::D4Attributes::get_AttrTable
AttrTable * get_AttrTable(const std::string name)
copy attributes from DAP4 to DAP2
Definition: D4Attributes.cc:343
libdap
Definition: AlarmHandler.h:35
libdap::is_vector_type
bool is_vector_type(Type t)
Returns true if the instance is a vector (i.e., array) type variable.
Definition: util.cc:817
libdap::DapObj
libdap base object for common functionality of libdap objects
Definition: DapObj.h:55
libdap::D4Attributes::transform_to_dap4
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
Definition: D4Attributes.cc:195
libdap::AttrTable::get_attr_table
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
Definition: AttrTable.cc:606
libdap::BaseType::check_semantics
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
Definition: BaseType.cc:1200
libdap::BaseType::width
virtual unsigned int width(bool constrained=false) const
How many bytes does this use Return the number of bytes of storage this variable uses....
Definition: BaseType.cc:1292
libdap::BaseType::send_p
virtual bool send_p()
Should this variable be sent?
Definition: BaseType.cc:545
libdap::BaseType::is_in_selection
virtual bool is_in_selection()
Is this variable part of the current selection?
Definition: BaseType.cc:694
libdap::AttrTable::print_xml_writer
void print_xml_writer(XMLWriter &xml)
Definition: AttrTable.cc:1424
libdap::BaseType::transform_to_dap2
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
Definition: BaseType.cc:258
libdap::BaseType::get_parent
virtual BaseType * get_parent() const
Definition: BaseType.cc:742
libdap::BaseType::set_parent
virtual void set_parent(BaseType *parent)
Definition: BaseType.cc:724
libdap::BaseType::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BaseType.cc:282
libdap::BaseType::dataset
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition: BaseType.cc:349
libdap::D4StreamUnMarshaller
Read data from the stream made by D4StreamMarshaller.
Definition: D4StreamUnMarshaller.h:65
libdap::BaseType::print_xml
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
Definition: BaseType.cc:1096
libdap::BaseType::set_in_selection
virtual void set_in_selection(bool state)
Definition: BaseType.cc:709
libdap::BaseType::set_synthesized_p
virtual void set_synthesized_p(bool state)
Definition: BaseType.cc:454
libdap::D4type_name
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
libdap::BaseType::read_p
virtual bool read_p()
Has this variable been read?
Definition: BaseType.cc:471
libdap::D2type_name
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::AttrTable::get_attr_vector
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
Definition: AttrTable.cc:652
libdap::AttrTable
Contains the attributes for a dataset.
Definition: AttrTable.h:142
libdap::BaseType::d4_ops
virtual bool d4_ops(BaseType *b, int op)
Evaluator a relop for DAP4.
Definition: BaseType.cc:1273
libdap::BaseType::is_vector_type
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
Definition: BaseType.cc:393
libdap::BaseType::compute_checksum
virtual void compute_checksum(Crc32 &checksum)=0
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
libdap::Constructor
Definition: Constructor.h:43
libdap::BaseType::type
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:356
libdap::BaseType::set_type
virtual void set_type(const Type &t)
Sets the type of the class instance.
Definition: BaseType.cc:363
libdap::D4Attributes::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: D4Attributes.cc:501
libdap::D4Attributes
Definition: D4Attributes.h:94
libdap::www2id
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
libdap::BaseType::transfer_attributes
virtual void transfer_attributes(AttrTable *at)
Definition: BaseType.cc:635
libdap::BaseType::set_read_p
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: BaseType.cc:507
libdap::BaseType::is_simple_type
virtual bool is_simple_type() const
Returns true if the instance is a numeric, string or URL type variable.
Definition: BaseType.cc:384
libdap::BaseType::add_var
virtual void add_var(BaseType *bt, Part part=nil)
Add a variable.
Definition: BaseType.cc:806
libdap::DMR
Definition: DMR.h:55
libdap::AttrTable::attr_begin
virtual Attr_iter attr_begin()
Definition: AttrTable.cc:710
libdap::DDS
Definition: DDS.h:180
libdap::BaseType::synthesized_p
virtual bool synthesized_p()
Definition: BaseType.cc:443
libdap::BaseType::read
virtual bool read()
Read data into a local buffer.
Definition: BaseType.cc:890
libdap::BaseType::FQN
virtual std::string FQN() const
Definition: BaseType.cc:323
libdap::BaseType::var
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:749
libdap::id2www
string id2www(string in, const string &allowable)
Definition: escaping.cc:153
libdap::BaseType::get_attr_table
virtual AttrTable & get_attr_table()
Definition: BaseType.cc:573
libdap::BaseType
The basic data type for the DODS DAP types.
Definition: BaseType.h:117
libdap::AttrTable::append_container
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition: AttrTable.cc:409
libdap::AttrTable::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: AttrTable.cc:1509
libdap::AttrTable::get_name
virtual string get_name() const
Get the name of this attribute table.
Definition: AttrTable.cc:237
libdap::AttrTable::get_attr_type
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
Definition: AttrTable.cc:620
libdap::BaseType::type_name
virtual string type_name() const
Returns the type of the class instance as a string.
Definition: BaseType.cc:370
libdap::BaseType::print_val
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: BaseType.cc:1081
libdap::BaseType::element_count
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: BaseType.cc:434
libdap::AttrTable::append_attr
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
Definition: AttrTable.cc:306
libdap::BaseType::set_send_p
virtual void set_send_p(bool state)
Definition: BaseType.cc:559
libdap::D4StreamMarshaller
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Definition: D4StreamMarshaller.h:71