Constructor.h
// -*- 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.
#ifndef _constructor_h
#define _constructor_h 1
#include <vector>
#include "BaseType.h"
class Crc32;
namespace libdap
{
class DMR;
class XMLWriter;
class D4StreamUnMarshaller;
class Constructor: public BaseType
{
private:
Constructor(); // No default ctor.
protected:
std::vector<BaseType *> d_vars;
void m_duplicate(const Constructor &s);
BaseType *m_leaf_match(const string &name, btp_stack *s = 0);
BaseType *m_exact_match(const string &name, btp_stack *s = 0);
Constructor(const string &name, const Type &type, bool is_dap4 = false);
Constructor(const string &name, const string &d, const Type &type, bool is_dap4 = false);
Constructor(const Constructor &copy_from);
public:
typedef std::vector<BaseType *>::const_iterator Vars_citer ;
typedef std::vector<BaseType *>::iterator Vars_iter ;
typedef std::vector<BaseType *>::reverse_iterator Vars_riter ;
virtual ~Constructor();
Constructor &operator=(const Constructor &rhs);
virtual void transform_to_dap4(D4Group *root, Constructor *dest);
virtual std::string FQN() const;
virtual int element_count(bool leaves = false);
virtual void set_send_p(bool state);
virtual void set_read_p(bool state);
virtual unsigned int width(bool constrained = false) const;
#if 0
virtual unsigned int width(bool constrained);
#endif
// TODO Rewrite these methods to use the back pointers and keep this
// for older code.
virtual BaseType *var(const string &name, bool exact_match = true, btp_stack *s = 0);
virtual BaseType *var(const string &n, btp_stack &s);
Vars_iter var_begin();
Vars_iter var_end();
Vars_riter var_rbegin();
Vars_riter var_rend();
Vars_iter get_vars_iter(int i);
BaseType *get_var_index(int i);
virtual void add_var(BaseType *bt, Part part = nil);
virtual void add_var_nocopy(BaseType *bt, Part part = nil);
virtual void del_var(const string &name);
virtual void del_var(Vars_iter i);
virtual bool read();
// DAP2
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds);
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval = true);
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse = false);
// DAP4
virtual void compute_checksum(Crc32 &checksum);
virtual void intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/);
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false);
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr);
// Do not store values in memory as for C; users work with the C++ objects
virtual unsigned int val2buf(void *, bool) {
throw InternalErr(__FILE__, __LINE__, "Never use this method; see the programmer's guide documentation.");
}
virtual unsigned int buf2val(void **) {
throw InternalErr(__FILE__, __LINE__, "Never use this method; see the programmer's guide documentation.");
}
virtual bool is_linear();
virtual void set_in_selection(bool state);
virtual void print_decl(ostream &out, string space = " ",
bool print_semi = true,
bool constraint_info = false,
bool constrained = false);
virtual void print_xml(ostream &out, string space = " ",
bool constrained = false);
void print_dap4(XMLWriter &xml, bool constrained = false);
virtual void print_xml_writer(XMLWriter &xml, bool constrained = false);
virtual void print_decl(FILE *out, string space = " ",
bool print_semi = true,
bool constraint_info = false,
bool constrained = false);
virtual void print_xml(FILE *out, string space = " ",
bool constrained = false);
virtual void print_val(FILE *out, string space = "",
bool print_decl_p = true);
virtual void print_val(ostream &out, string space = "",
bool print_decl_p = true);
virtual bool check_semantics(string &msg, bool all = false);
virtual void transfer_attributes(AttrTable *at);
static AttrTable *make_dropped_vars_attr_table(vector<BaseType *> *dropped_vars);
virtual void dump(ostream &strm) const ;
};
} // namespace libdap
#endif // _constructor_h
libdap::Constructor::width
virtual unsigned int width(bool constrained=false) const
Definition: Constructor.cc:249
libdap::BaseType::name
virtual string name() const
Returns the name of the class instance.
Definition: BaseType.cc:311
libdap::Constructor::set_in_selection
virtual void set_in_selection(bool state)
Set the in_selection property.
Definition: Constructor.cc:834
libdap::UnMarshaller
abstract base class used to unmarshall/deserialize dap data objects
Definition: UnMarshaller.h:54
libdap::Constructor::FQN
virtual std::string FQN() const
Definition: Constructor.cc:181
libdap::Constructor::var
virtual BaseType * var(const string &name, bool exact_match=true, btp_stack *s=0)
btp_stack no longer needed; use back pointers (BaseType::get_parent())
Definition: Constructor.cc:267
libdap::Part
Part
Names the parts of multi-section constructor data types.
Definition: Type.h:48
libdap::AttrTable
Contains the attributes for a dataset.
Definition: AttrTable.h:142
libdap::D4StreamUnMarshaller
Read data from the stream made by D4StreamMarshaller.
Definition: D4StreamUnMarshaller.h:65
libdap::Constructor::var_rend
Vars_riter var_rend()
Definition: Constructor.cc:379
Crc32
Definition: crc.h:76
libdap::Constructor::compute_checksum
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
Definition: Constructor.cc:550
libdap::Constructor::add_var_nocopy
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
Definition: Constructor.cc:432
libdap::Constructor::add_var
virtual void add_var(BaseType *bt, Part part=nil)
Definition: Constructor.cc:407
libdap::Type
Type
Identifies the data type.
Definition: Type.h:94
libdap::Constructor::element_count
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Definition: Constructor.cc:194
libdap
Definition: AlarmHandler.h:35
libdap::InternalErr
A class for software fault reporting.
Definition: InternalErr.h:64
libdap::Constructor::print_xml
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
Definition: Constructor.cc:695
libdap::Constructor::transform_to_dap4
virtual void transform_to_dap4(D4Group *root, Constructor *dest)
DAP2 to DAP4 transform.
Definition: Constructor.cc:141
libdap::Constructor::is_linear
virtual bool is_linear()
Check to see whether this variable can be printed simply.
Definition: Constructor.cc:823
libdap::DMR
Definition: DMR.h:55
libdap::D4StreamMarshaller
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4&#39;s receiv...
Definition: D4StreamMarshaller.h:71
libdap::Constructor::var_rbegin
Vars_riter var_rbegin()
Definition: Constructor.cc:371
libdap::DDS
Definition: DDS.h:180
libdap::Constructor::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: Constructor.cc:504
libdap::BaseType::type
virtual Type type() const
Returns the type of the class instance.
Definition: BaseType.cc:356
libdap::Constructor::get_var_index
BaseType * get_var_index(int i)
Definition: Constructor.cc:397
libdap::Constructor::read
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
Definition: Constructor.cc:476
libdap::Constructor::check_semantics
virtual bool check_semantics(string &msg, bool all=false)
Compare an object&#39;s current state with the semantics of its type.
Definition: Constructor.cc:792
libdap::Constructor::deserialize
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
Definition: Constructor.cc:540
libdap::Constructor::print_val
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Definition: Constructor.cc:650
libdap::Constructor::val2buf
virtual unsigned int val2buf(void *, bool)
Loads class data.
Definition: Constructor.h:115
libdap::Constructor::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: Constructor.cc:913
libdap::Constructor::print_xml_writer
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:718
libdap::Constructor
Definition: Constructor.h:43
libdap::ConstraintEvaluator
Evaluate a constraint expression.
Definition: ConstraintEvaluator.h:42
libdap::Constructor::buf2val
virtual unsigned int buf2val(void **)
Reads the class data.
Definition: Constructor.h:118
libdap::BaseType
The basic data type for the DODS DAP types.
Definition: BaseType.h:117
libdap::Marshaller
abstract base class used to marshal/serialize dap data objects
Definition: Marshaller.h:50
libdap::Constructor::print_decl
virtual void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
Definition: Constructor.cc:626
libdap::Constructor::var_begin
Vars_iter var_begin()
Definition: Constructor.cc:356
libdap::Constructor::var_end
Vars_iter var_end()
Definition: Constructor.cc:364
libdap::D4Group
Definition: D4Group.h:43
libdap::Constructor::get_vars_iter
Vars_iter get_vars_iter(int i)
Definition: Constructor.cc:388
libdap::Constructor::transfer_attributes
virtual void transfer_attributes(AttrTable *at)
Definition: Constructor.cc:844
libdap::XMLWriter
Definition: XMLWriter.h:39
libdap::Constructor::intern_data
virtual void intern_data()
Read data into this variable.
Definition: Constructor.cc:556
libdap::Constructor::print_dap4
void print_dap4(XMLWriter &xml, bool constrained=false)
Definition: Constructor.cc:768
libdap::Constructor::del_var
virtual void del_var(const string &name)
Definition: Constructor.cc:448
libdap::Constructor::set_send_p
virtual void set_send_p(bool state)
Definition: Constructor.cc:208
libdap::Constructor::set_read_p
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Definition: Constructor.cc:218