Constructor.cc
// -*- mode: c++; c-basic-offset:4 -*-
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.
// Copyright (c) 2002,2003 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
// (c) COPYRIGHT URI/MIT 1995-1999
// Please read the full copyright statement in the file COPYRIGHT_URI.
//
// Authors:
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
#include "config.h"
#include <cstdint>
#include <string>
#include <sstream>
#include <algorithm>
#include "crc.h"
#include "Constructor.h"
#include "Grid.h"
#include "DMR.h"
#include "XMLWriter.h"
#include "D4StreamMarshaller.h"
#include "D4StreamUnMarshaller.h"
#include "D4Group.h"
#include "D4Attributes.h"
#include "escaping.h"
#include "util.h"
#include "InternalErr.h"
#include "DapIndent.h"
#include "debug.h"
using namespace std;
namespace libdap {
// Private member functions
void
Constructor::m_duplicate(const Constructor &c)
{
// Clear out any spurious vars in Constructor::d_vars
// Moved from Grid::m_duplicate. jhrg 4/3/13
d_vars.clear(); // [mjohnson 10 Sep 2009]
for (auto var: c.d_vars) {
BaseType *btp = var->ptr_duplicate();
btp->set_parent(this);
d_vars.push_back(btp);
}
}
// Public member functions
// A public method, but just barely...
// TODO Understand what this method does. What is dest? Is it the parent-to-be
// of the variables in this Constructor? jhrg 4/25/22
void
Constructor::transform_to_dap4(D4Group *root, Constructor *dest)
{
for (Constructor::Vars_citer i = var_begin(), e = var_end(); i != e; ++i) {
BaseType *d4_var = dest->var((*i)->name());
// Don't add duplicate variables. We have to make this check
// because some child variables may add arrays
// to the root object. For example, this happens in
// Grid with the Map Arrays - ndp - 05/08/17
if (!d4_var) {
(*i)->transform_to_dap4(root /*group*/, dest /*container*/);
}
}
dest->attributes()->transform_to_dap4(get_attr_table());
dest->set_is_dap4(true);
}
string
Constructor::FQN() const
{
if (get_parent() == 0)
return name();
else if (get_parent()->type() == dods_group_c)
return get_parent()->FQN() + name();
else if (get_parent()->type() == dods_array_c)
return get_parent()->FQN();
else
return get_parent()->FQN() + "." + name();
}
int
Constructor::element_count(bool leaves)
{
if (!leaves)
return d_vars.size();
else {
int i = 0;
for (auto var: d_vars) {
i += var->element_count(leaves);
}
return i;
}
}
void
Constructor::set_send_p(bool state)
{
for (auto var: d_vars) {
var->set_send_p(state);
}
BaseType::set_send_p(state);
}
void
Constructor::set_read_p(bool state)
{
for (auto var: d_vars) {
var->set_read_p(state);
}
BaseType::set_read_p(state);
}
unsigned int
Constructor::width(bool constrained) const
{
unsigned int sz = 0;
for (auto var: d_vars) {
if (constrained) {
if (var->send_p())
sz += var->width(constrained);
}
else {
sz += var->width(constrained);
}
}
return sz;
}
int64_t
Constructor::width_ll(bool constrained) const
{
int64_t sz = 0;
for (auto var: d_vars) {
if (constrained) {
if (var->send_p())
sz += var->width_ll(constrained);
}
else {
sz += var->width_ll(constrained);
}
}
return sz;
}
BaseType *
Constructor::var(const string &name, bool exact_match, btp_stack *s)
{
string n = www2id(name);
if (exact_match)
return m_exact_match(n, s);
else
return m_leaf_match(n, s);
}
BaseType *
Constructor::var(const string &n, btp_stack &s)
{
// This should probably be removed. The BES code should remove web encoding
// with the possible exception of spaces. jhrg 11/25/13
string name = www2id(n);
BaseType *btp = m_exact_match(name, &s);
if (btp)
return btp;
return m_leaf_match(name, &s);
}
// Protected method
BaseType *
Constructor::m_leaf_match(const string &name, btp_stack *s)
{
for (auto var: d_vars) {
if (var->name() == name) {
if (s) {
s->push(static_cast<BaseType *>(this));
}
return var;
}
if (var->is_constructor_type()) {
BaseType *btp = var->var(name, false, s);
if (btp) {
if (s) {
s->push(static_cast<BaseType *>(this));
}
return btp;
}
}
}
return nullptr;
}
// Protected method
BaseType *
Constructor::m_exact_match(const string &name, btp_stack *s)
{
// Look for name at the top level first.
for (auto var: d_vars) {
if (var->name() == name) {
if (s)
s->push(static_cast<BaseType *>(this));
return var;
}
}
// If it was not found using the simple search, look for a dot and
// search the hierarchy.
string::size_type dot_pos = name.find("."); // zero-based index of `.'
if (dot_pos != string::npos) {
string aggregate = name.substr(0, dot_pos);
string field = name.substr(dot_pos + 1);
BaseType *agg_ptr = var(aggregate);
if (agg_ptr) {
if (s)
s->push(static_cast<BaseType *>(this));
return agg_ptr->var(field, true, s); // recurse
}
else
return nullptr; // qualified names must be *fully* qualified
}
return nullptr;
}
Constructor::Vars_iter
Constructor::var_begin()
{
return d_vars.begin();
}
Constructor::Vars_iter
Constructor::var_end()
{
return d_vars.end();
}
Constructor::Vars_riter
Constructor::var_rbegin()
{
return d_vars.rbegin();
}
Constructor::Vars_riter
Constructor::var_rend()
{
return d_vars.rend();
}
Constructor::Vars_iter
Constructor::get_vars_iter(int i)
{
return d_vars.begin() + i;
}
BaseType *
Constructor::get_var_index(int i)
{
return *(d_vars.begin() + i);
}
void Constructor::set_var_index(BaseType *bt,int i) {
if (!bt)
throw InternalErr(__FILE__, __LINE__, "The BaseType parameter cannot be null.");
if (i<0 || i>= (int)(d_vars.size()))
throw InternalErr(__FILE__, __LINE__, "The index must be within the variable vector range..");
bt->set_parent(this);
// Update the is_dap4 property
if (bt->is_dap4())
set_is_dap4(true);
d_vars[i] = bt;
}
void
Constructor::add_var(BaseType *bt, Part)
{
// Jose Garcia
// Passing and invalid pointer to an object is a developer's error.
if (!bt)
throw InternalErr(__FILE__, __LINE__, "The BaseType parameter cannot be null.");
// Jose Garcia
// Now we add a copy of bt so the external user is able to destroy bt as
// he/she wishes. The policy is: "If it is allocated outside, it is
// deallocated outside, if it is allocated inside, it is deallocated
// inside"
add_var_nocopy(bt->ptr_duplicate());
}
void
Constructor::add_var_nocopy(BaseType *bt, Part)
{
if (!bt)
throw InternalErr(__FILE__, __LINE__, "The BaseType parameter cannot be null.");
bt->set_parent(this);
d_vars.push_back(bt);
// Update the is_dap4 property
if (bt->is_dap4())
set_is_dap4(true);
}
void
Constructor::del_var(const string &n)
{
auto to_remove = stable_partition(d_vars.begin(), d_vars.end(),
[n](BaseType* btp){ return btp->name() != n; });
for_each(to_remove, d_vars.end(), [](BaseType* btp){ delete btp; });
d_vars.erase(to_remove, d_vars.end());
}
void
Constructor::del_var(Vars_iter i)
{
delete *i;
d_vars.erase(i);
}
bool Constructor::read()
{
if (!read_p()) {
for (auto var: d_vars) {
if (var->send_p())
var->read();
}
// Set read_p for the Constructor
BaseType::set_read_p(true);
}
return false;
}
void
Constructor::intern_data(ConstraintEvaluator & eval, DDS & dds)
{
if (is_dap4())
throw Error(string("A method usable only with DAP2 variables was called on a DAP4 variable (").append(name()).append(")."), __FILE__, __LINE__);
if (!read_p())
read(); // read() throws Error and InternalErr
for (auto var: d_vars) {
if (var->send_p()) {
var->intern_data(eval, dds);
}
}
}
bool
Constructor::serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval)
{
if (!read_p())
read(); // read() throws Error and InternalErr
if (ce_eval && !eval.eval_selection(dds, dataset()))
return true;
for (auto var: d_vars) {
if (var->send_p()) {
#ifdef CHECKSUMS
XDRStreamMarshaller *sm = dynamic_cast<XDRStreamMarshaller*>(&m);
if (sm && sm->checksums() && var->type() != dods_structure_c && var->type() != dods_grid_c)
sm->reset_checksum();
var->serialize(eval, dds, m, false);
if (sm && sm->checksums() && var->type() != dods_structure_c && var->type() != dods_grid_c)
sm->get_checksum();
#else
// (*i)->serialize(eval, dds, m, false);
// Only Sequence and Vector run the evaluator.
var->serialize(eval, dds, m, true);
#endif
}
}
return true;
}
bool
Constructor::deserialize(UnMarshaller &um, DDS *dds, bool reuse)
{
for (auto var: d_vars) {
var->deserialize(um, dds, reuse);
}
return false;
}
void
Constructor::compute_checksum(Crc32 &)
{
throw InternalErr(__FILE__, __LINE__, "Computing a checksum alone is not supported for Constructor types.");
}
void
Constructor::intern_data()
{
if (!read_p())
read(); // read() throws Error
for (auto var: d_vars) {
if (var->send_p()) {
var->intern_data(/*checksum, dmr, eval*/);
}
}
}
void
Constructor::serialize(D4StreamMarshaller &m, DMR &dmr, bool filter)
{
// Not used for the same reason the equivalent code in D4Group::serialize()
// is not used. Fail for D4Sequence and general issues with memory use.
//
// Revisit this - I had to uncomment this to get the netcdf_handler code
// to work - it relies on having NCStructure::read() called. The D4Sequence
// ::serialize() method calls read_next_instance(). What seems to be happening
// is that this call to read gets the first set of values, but does not store
// them; the call to serialize then runs the D4Sequence::serialize() method that
// _does_ read all the sequence data and then serialize it. However, the first
// sequence instance is missing...
if (!read_p())
read(); // read() throws Error
for (auto var: d_vars) {
if (var->send_p()) {
var->serialize(m, dmr, filter);
}
}
}
void
Constructor::deserialize(D4StreamUnMarshaller &um, DMR &dmr)
{
for (auto var: d_vars) {
var->deserialize(um, dmr);
}
}
void
Constructor::print_decl(FILE *out, string space, bool print_semi, bool constraint_info, bool constrained)
{
ostringstream oss;
print_decl(oss, space, print_semi, constraint_info, constrained);
fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
}
void
Constructor::print_decl(ostream &out, string space, bool print_semi, bool constraint_info, bool constrained)
{
if (constrained && !send_p())
return;
out << space << type_name() << " {\n" ;
for (auto var: d_vars) {
var->print_decl(out, space + " ", true, constraint_info, constrained);
}
out << space << "} " << id2www(name()) ;
if (constraint_info) { // Used by test drivers only.
if (send_p())
out << ": Send True";
else
out << ": Send False";
}
if (print_semi)
out << ";\n" ;
}
void
Constructor::print_val(FILE *out, string space, bool print_decl_p)
{
ostringstream oss;
print_val(oss, space, print_decl_p);
fwrite(oss.str().data(), sizeof(char), oss.str().length(), out);
}
void
Constructor::print_val(ostream &out, string space, bool print_decl_p)
{
if (print_decl_p) {
print_decl(out, space, false);
out << " = " ;
}
out << "{ " ;
for (Vars_citer i = d_vars.begin(), e = d_vars.end(); i != e; i++, (void)(i != e && out << ", ")) {
(*i)->print_val(out, "", false);
}
out << " }" ;
if (print_decl_p)
out << ";\n" ;
}
void
Constructor::print_xml(FILE *out, string space, bool constrained)
{
XMLWriter xml(space);
print_xml_writer(xml, constrained);
fwrite(xml.get_doc(), sizeof(char), xml.get_doc_size(), out);
}
void
Constructor::print_xml(ostream &out, string space, bool constrained)
{
XMLWriter xml(space);
print_xml_writer(xml, constrained);
out << xml.get_doc();
}
void
Constructor::print_xml_writer(XMLWriter &xml, bool constrained)
{
if (constrained && !send_p())
return;
if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
if (!name().empty())
if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
// DAP2 prints attributes first. For some reason we decided that DAP4 should
// print them second. No idea why... jhrg 8/15/14
if (!is_dap4() && get_attr_table().get_size() > 0)
get_attr_table().print_xml_writer(xml);
if (!d_vars.empty())
for_each(d_vars.begin(), d_vars.end(),
[&xml, constrained](BaseType *btp) { btp->print_xml_writer(xml, constrained); });
if (is_dap4())
attributes()->print_dap4(xml);
if (xmlTextWriterEndElement(xml.get_writer()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
}
void
Constructor::print_dap4(XMLWriter &xml, bool constrained)
{
if (constrained && !send_p())
return;
if (xmlTextWriterStartElement(xml.get_writer(), (const xmlChar*)type_name().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write " + type_name() + " element");
if (!name().empty())
if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar*) "name", (const xmlChar*)name().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
if (!d_vars.empty())
for_each(d_vars.begin(), d_vars.end(),
[&xml, constrained](BaseType *btp) { btp->print_dap4(xml, constrained); });
attributes()->print_dap4(xml);
if (xmlTextWriterEndElement(xml.get_writer()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not end " + type_name() + " element");
}
bool
Constructor::check_semantics(string &msg, bool all)
{
if (!BaseType::check_semantics(msg))
return false;
if (!unique_names(d_vars, name(), type_name(), msg))
return false;
if (all) {
for (auto var: d_vars) {
if (!var->check_semantics(msg, true)) {
return false;
}
}
}
return true;
}
bool
Constructor::is_linear()
{
return false;
}
void
Constructor::set_in_selection(bool state)
{
for (auto var: d_vars) {
var->set_in_selection(state);
}
BaseType::set_in_selection(state);
}
void Constructor::transfer_attributes(AttrTable *at_container)
{
AttrTable *at = at_container->get_attr_table(name());
if (at) {
BaseType::transfer_attributes(at_container);
for (auto var: d_vars) {
var->transfer_attributes(at);
}
}
}
AttrTable *
Constructor::make_dropped_vars_attr_table(vector<BaseType *> *dropped_vars)
{
AttrTable *dv_table = nullptr;
if (!dropped_vars->empty()) {
dv_table = new AttrTable;
dv_table->set_name("dap4:dropped_members");
vector<BaseType *>::iterator dvIter = dropped_vars->begin();
vector<BaseType *>::iterator dvEnd = dropped_vars->end();
unsigned int i = 0;
for (; dvIter != dvEnd; dvIter++, i++) {
BaseType *bt = (*dvIter);
AttrTable *bt_attr_table = new AttrTable(bt->get_attr_table());
bt_attr_table->set_name(bt->name());
string type_name = bt->type_name();
if (bt->is_vector_type()) {
Array *array = dynamic_cast <Array *>(bt);
if (array) { // This is always true - only an Array is_vector_type(). jhrg 4/25/22
type_name = array->prototype()->type_name();
Array::Dim_iter d_iter = array->dim_begin();
Array::Dim_iter end = array->dim_end();
for (; d_iter < end; d_iter++) {
ostringstream dim_size;
dim_size << (*d_iter).size;
bt_attr_table->append_attr("array_dimensions", AttrType_to_String(Attr_uint32), dim_size.str());
}
}
}
bt_attr_table->append_attr("dap4:type", "String", type_name);
dv_table->append_container(bt_attr_table, bt_attr_table->get_name());
// Clear entry now that we're done.
(*dvIter) = 0;
}
}
return dv_table;
}
bool Constructor::is_dap4_projected(std::vector<std::string> &inventory)
{
bool has_projected_dap4 = false;
if(send_p()) {
has_projected_dap4 = attributes()->has_dap4_types(FQN(),inventory);
for (const auto var: variables()) {
has_projected_dap4 |= var->is_dap4_projected(inventory);
}
}
return has_projected_dap4;
}
void
Constructor::dump(ostream &strm) const {
strm << DapIndent::LMarg << "Constructor::dump - (" << (void *) this << ")" << endl;
DapIndent::Indent();
BaseType::dump(strm);
strm << DapIndent::LMarg << "vars: " << endl;
DapIndent::Indent();
for (auto var: d_vars) {
var->dump(strm);
}
DapIndent::UnIndent();
DapIndent::UnIndent();
}
} // namespace libdap
Crc32
Definition crc.h:79
libdap::Array
A multidimensional array of identical data types.
Definition Array.h:123
libdap::Array::Dim_iter
std::vector< dimension >::iterator Dim_iter
Definition Array.h:241
libdap::AttrTable
Contains the attributes for a dataset.
Definition AttrTable.h:154
libdap::AttrTable::append_container
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
Definition AttrTable.cc:554
libdap::AttrTable::set_name
virtual void set_name(const string &n)
Set the name of this attribute table.
Definition AttrTable.cc:273
libdap::AttrTable::get_attr_table
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
Definition AttrTable.cc:751
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:335
libdap::AttrTable::get_name
virtual string get_name() const
Get the name of this attribute table.
Definition AttrTable.cc:266
libdap::AttrTable::print_xml_writer
void print_xml_writer(XMLWriter &xml)
Definition AttrTable.cc:1614
libdap::BaseType
The basic data type for the DODS DAP types.
Definition BaseType.h:120
libdap::BaseType::is_dap4_projected
virtual bool is_dap4_projected(std::vector< string > &projected_dap4_inventory)
Definition BaseType.cc:1323
libdap::BaseType::type_name
virtual string type_name() const
Returns the type of the class instance as a string.
Definition BaseType.cc:376
libdap::BaseType::read
virtual bool read()
Read data into a local buffer.
Definition BaseType.cc:905
libdap::BaseType::deserialize
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition BaseType.cc:949
libdap::BaseType::get_attr_table
virtual AttrTable & get_attr_table()
Definition BaseType.cc:579
libdap::BaseType::name
virtual string name() const
Returns the name of the class instance.
Definition BaseType.cc:317
libdap::BaseType::set_in_selection
virtual void set_in_selection(bool state)
Definition BaseType.cc:715
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:1009
libdap::BaseType::get_parent
virtual BaseType * get_parent() const
Definition BaseType.cc:748
libdap::BaseType::read_p
virtual bool read_p()
Has this variable been read?
Definition BaseType.cc:477
libdap::BaseType::width
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:1305
libdap::BaseType::set_read_p
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition BaseType.cc:513
libdap::BaseType::dataset
virtual string dataset() const
Returns the name of the dataset used to create this instance.
Definition BaseType.cc:355
libdap::BaseType::set_parent
virtual void set_parent(BaseType *parent)
Definition BaseType.cc:730
libdap::BaseType::element_count
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition BaseType.cc:440
libdap::BaseType::dump
void dump(ostream &strm) const override
dumps information about this object
Definition BaseType.cc:287
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:399
libdap::BaseType::intern_data
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
Definition BaseType.cc:914
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:409
libdap::BaseType::attributes
virtual D4Attributes * attributes()
Definition BaseType.cc:596
libdap::BaseType::FQN
virtual std::string FQN() const
Definition BaseType.cc:329
libdap::BaseType::send_p
virtual bool send_p()
Should this variable be sent?
Definition BaseType.cc:551
libdap::BaseType::set_send_p
virtual void set_send_p(bool state)
Definition BaseType.cc:565
libdap::BaseType::ptr_duplicate
virtual BaseType * ptr_duplicate()=0
libdap::BaseType::transform_to_dap4
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
Definition BaseType.cc:212
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:943
libdap::BaseType::transfer_attributes
virtual void transfer_attributes(AttrTable *at)
Definition BaseType.cc:641
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:1215
libdap::BaseType::BaseType
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Definition BaseType.cc:126
libdap::BaseType::var
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:764
libdap::BaseType::type
virtual Type type() const
Returns the type of the class instance.
Definition BaseType.cc:362
libdap::ConstraintEvaluator
Evaluate a constraint expression.
Definition ConstraintEvaluator.h:43
libdap::ConstraintEvaluator::eval_selection
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator and is called ...
Definition ConstraintEvaluator.cc:329
libdap::Constructor
Definition Constructor.h:44
libdap::Constructor::element_count
int element_count(bool leaves=false) override
Count the members of constructor types.
Definition Constructor.cc:116
libdap::Constructor::compute_checksum
void compute_checksum(Crc32 &checksum) override
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
Definition Constructor.cc:519
libdap::Constructor::transform_to_dap4
void transform_to_dap4(D4Group *root, Constructor *dest) override
DAP2 to DAP4 transform.
Definition Constructor.cc:85
libdap::Constructor::get_vars_iter
Vars_iter get_vars_iter(int i)
Definition Constructor.cc:329
libdap::Constructor::var
BaseType * var(const string &name, bool exact_match=true, btp_stack *s=nullptr) override
btp_stack no longer needed; use back pointers (BaseType::get_parent())
Definition Constructor.cc:210
libdap::Constructor::set_var_index
void set_var_index(BaseType *bt, int i)
Set the ith element of d_vars to a variable object.
Definition Constructor.cc:352
libdap::Constructor::add_var
void add_var(BaseType *bt, Part part=nil) override
Definition Constructor.cc:375
libdap::Constructor::transfer_attributes
void transfer_attributes(AttrTable *at) override
Definition Constructor.cc:761
libdap::Constructor::print_xml_writer
void print_xml_writer(XMLWriter &xml, bool constrained=false) override
Definition Constructor.cc:660
libdap::Constructor::print_decl
void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false) override
Print an ASCII representation of the variable structure.
Definition Constructor.cc:588
libdap::Constructor::print_xml
void print_xml(ostream &out, string space=" ", bool constrained=false) override
Definition Constructor.cc:652
libdap::Constructor::deserialize
bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false) override
Receive data from the net.
Definition Constructor.cc:509
libdap::Constructor::intern_data
void intern_data() override
Read data into this variable.
Definition Constructor.cc:525
libdap::Constructor::set_read_p
void set_read_p(bool state) override
Set the 'read_p' property for the Constructor and its members.
Definition Constructor.cc:151
libdap::Constructor::print_val
void print_val(FILE *out, string space="", bool print_decl_p=true) override
Prints the value of the variable.
Definition Constructor.cc:611
libdap::Constructor::set_send_p
void set_send_p(bool state) override
Definition Constructor.cc:130
libdap::Constructor::is_dap4_projected
bool is_dap4_projected(std::vector< std::string > &inventory) override
Definition Constructor.cc:823
libdap::Constructor::var_end
Vars_iter var_end()
Definition Constructor.cc:305
libdap::Constructor::read
bool read() override
Read the elements of Constructor marked for transmission.
Definition Constructor.cc:447
libdap::Constructor::set_in_selection
void set_in_selection(bool state) override
Set the in_selection property.
Definition Constructor.cc:752
libdap::Constructor::serialize
bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true) override
Move data to the net, then remove them from the object.
Definition Constructor.cc:478
libdap::Constructor::var_rbegin
Vars_riter var_rbegin()
Definition Constructor.cc:312
libdap::Constructor::add_var_nocopy
void add_var_nocopy(BaseType *bt, Part part=nil) override
Definition Constructor.cc:395
libdap::Constructor::variables
const vector< BaseType * > & variables() const
Definition Constructor.h:115
libdap::Constructor::width
unsigned int width(bool constrained=false) const override
Definition Constructor.cc:169
libdap::Constructor::get_var_index
BaseType * get_var_index(int i)
Definition Constructor.cc:338
libdap::Constructor::check_semantics
bool check_semantics(string &msg, bool all=false) override
Compare an object's current state with the semantics of its type.
Definition Constructor.cc:712
libdap::Constructor::var_begin
Vars_iter var_begin()
Definition Constructor.cc:297
libdap::Constructor::print_dap4
void print_dap4(XMLWriter &xml, bool constrained=false) override
Definition Constructor.cc:689
libdap::Constructor::FQN
std::string FQN() const override
Definition Constructor.cc:103
libdap::Constructor::var_rend
Vars_riter var_rend()
Definition Constructor.cc:320
libdap::Constructor::is_linear
virtual bool is_linear()
Check to see whether this variable can be printed simply.
Definition Constructor.cc:741
libdap::Constructor::del_var
virtual void del_var(const string &name)
Remove an element from a Constructor.
Definition Constructor.cc:416
libdap::Constructor::dump
void dump(ostream &strm) const override
dumps information about this object
Definition Constructor.cc:845
libdap::Constructor::width_ll
int64_t width_ll(bool constrained=false) const override
Get the width of the Constructor's fields.
Definition Constructor.cc:192
libdap::D4Attributes::transform_to_dap4
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
Definition D4Attributes.cc:197
libdap::D4Attributes::has_dap4_types
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
Definition D4Attributes.cc:661
libdap::D4Group
Definition D4Group.h:44
libdap::D4StreamMarshaller
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Definition D4StreamMarshaller.h:71
libdap::D4StreamUnMarshaller
Read data from the stream made by D4StreamMarshaller.
Definition D4StreamUnMarshaller.h:65
libdap::DDS
Definition DDS.h:178
libdap::DMR
Definition DMR.h:58
libdap::Error
A class for error processing.
Definition Error.h:94
libdap::InternalErr
A class for software fault reporting.
Definition InternalErr.h:65
libdap::Marshaller
abstract base class used to marshal/serialize dap data objects
Definition Marshaller.h:50
libdap::UnMarshaller
abstract base class used to unmarshall/deserialize dap data objects
Definition UnMarshaller.h:55
libdap::XDRStreamMarshaller
Marshaller that knows how serialize dap data objects to a C++ iostream using XDR.
Definition XDRStreamMarshaller.h:54
libdap::XMLWriter
Definition XMLWriter.h:39
libdap
top level DAP object to house generic methods
Definition AlarmHandler.h:36
libdap::www2id
string www2id(const string &in, const string &escape, const string &except)
Definition escaping.cc:220
libdap::AttrType_to_String
string AttrType_to_String(const AttrType at)
Definition AttrTable.cc:97
libdap::Part
Part
Names the parts of multi-section constructor data types.
Definition Type.h:48
libdap::id2www
string id2www(string in, const string &allowable)
Definition escaping.cc:153