86 DBG(cerr <<
"In BaseType::m_duplicate for " << bt.
name() << endl);
90 d_dataset = bt.d_dataset;
91 d_is_read = bt.d_is_read;
92 d_is_send = bt.d_is_send;
93 d_in_selection = bt.d_in_selection;
94 d_is_synthesized = bt.d_is_synthesized;
96 d_parent = bt.d_parent;
105 d_is_dap4 = bt.d_is_dap4;
107 DBG(cerr <<
"Exiting BaseType::m_duplicate for " << bt.
name() << endl);
125 : d_name(n), d_type(t), d_dataset(
""), d_is_read(false), d_is_send(false), d_parent(0), d_attributes(0),
126 d_is_dap4(
is_dap4), d_in_selection(false), d_is_synthesized(false) {}
141 : d_name(n), d_type(t), d_dataset(d), d_is_read(false), d_is_send(false), d_parent(0), d_attributes(0),
142 d_is_dap4(
is_dap4), d_in_selection(false), d_is_synthesized(false) {}
146 DBG(cerr <<
"In BaseTpe::copy_ctor for " << copy_from.
name() << endl);
151 DBG2(cerr <<
"Entering ~BaseType (" <<
this <<
")" << endl);
156 DBG2(cerr <<
"Exiting ~BaseType" << endl);
172 oss <<
"BaseType (" <<
this <<
"):" << endl
173 <<
" _name: " <<
name() << endl
175 <<
" _dataset: " << d_dataset << endl
176 <<
" _read_p: " << d_is_read << endl
177 <<
" _send_p: " << d_is_send << endl
178 <<
" _synthesized_p: " << d_is_synthesized << endl
179 <<
" d_parent: " << d_parent << endl
180 <<
" d_attr: " << hex << &d_attr << dec << endl;
256 vector<BaseType *> *result =
new vector<BaseType *>();
257 result->push_back(dest);
270 strm <<
DapIndent::LMarg <<
"BaseType::dump - (" << (
void *)
this <<
")" << endl;
285 d_attributes->dump(strm);
460 if (!d_is_synthesized) {
489 DBG2(cerr <<
"Calling BaseType::set_send_p() for: " << this->
name() << endl);
546 DBG(cerr << __func__ <<
"() - BEGIN name:'" <<
name() <<
"'" << endl);
549 DBG(cerr << __func__ <<
"() - at: " << (
void *)at << endl);
553 DBG(cerr << __func__ <<
"() - Processing AttrTable: " << at->
get_name() << endl);
557 DBG(cerr << __func__ <<
"() - Attribute '" << at->
get_name(at_p) <<
"' is type: " << at->
get_type(at_p)
570 DBG(cerr << __func__ <<
"() - Adding container '" << at->
get_name(at_p) << endl);
573 DBG(cerr << __func__ <<
"() - Found child var: '" << bt->
type_name() <<
" " << bt->
name()
574 <<
" (address:" << (
void *)bt <<
")" << endl);
575 DBG(cerr << __func__ <<
"() - Skipping container '" << at->
get_name(at_p) << endl);
578 DBG(cerr << __func__ <<
"() - Adding Attribute '" << at->
get_name(at_p) << endl);
580 (*at_p)->is_utf8_str);
585 DBG(cerr << __func__ <<
"() - Unable to locate AttrTable '" <<
name() <<
"' SKIPPING" << endl);
623 if (!
dynamic_cast<Constructor *
>(parent) && !
dynamic_cast<Vector *
>(parent) && parent != 0)
624 throw InternalErr(
"Call to set_parent with incorrect variable type.");
700 throw InternalErr(__FILE__, __LINE__,
"BaseType::add_var_nocopy unimplemented");
779 throw InternalErr(
"Unimplemented BaseType::read() method called for the variable named: " +
name());
783#if USE_LOCAL_TIMEOUT_SCHEME
787 throw Error(
string(
"A method usable only with DAP2 variables was called on a DAP4 variable (")
792 DBG2(cerr <<
"BaseType::intern_data: " <<
name() << endl);
795#if USE_LOCAL_TIMEOUT_SCHEME
811 throw InternalErr(__FILE__, __LINE__,
"The DAP2 serialize() method has not been implemented for " +
type_name());
815 throw InternalErr(__FILE__, __LINE__,
"The DAP2 deserialize() method has not been implemented for " +
type_name());
819 throw InternalErr(__FILE__, __LINE__,
"The DAP4 serialize() method has not been implemented for " +
type_name());
823 throw InternalErr(__FILE__, __LINE__,
"The DAP4 deserialize() method has not been implemented for " +
type_name());
870 print_decl(oss, space, print_semi, constraint_info, constrained);
871 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
916void BaseType::print_decl(ostream &out,
string space,
bool print_semi,
bool constraint_info,
bool constrained) {
919 if (constrained && !
send_p())
924 if (constraint_info) {
926 out <<
": Send True";
928 out <<
": Send False";
952 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
988 if (constrained && !
send_p())
995 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)
name().c_str()) < 0)
996 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1004 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
1060 msg =
"Every variable must have both a name and a type\n";
1106 throw InternalErr(__FILE__, __LINE__,
"Unimplemented operator.");
1149 bool has_projected_dap4 =
false;
1153 return has_projected_dap4;
Contains the attributes for a dataset.
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
virtual void set_name(const string &n)
Set the name of this attribute table.
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
virtual Attr_iter attr_end()
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
virtual Attr_iter attr_begin()
virtual string get_name() const
Get the name of this attribute table.
virtual void set_is_global_attribute(bool ga)
void print_xml_writer(XMLWriter &xml)
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
std::vector< entry * >::iterator Attr_iter
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
BaseType & operator=(const BaseType &rhs)
void m_duplicate(const BaseType &bt)
Perform a deep copy.
virtual bool is_dap4_projected(std::vector< string > &projected_dap4_inventory)
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
virtual string type_name() const
Returns the type of the class instance as a string.
virtual void intern_data()
Read data into this variable.
virtual bool read()
Read data into a local buffer.
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
virtual AttrTable & get_attr_table()
virtual string name() const
Returns the name of the class instance.
virtual void set_in_selection(bool state)
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.
virtual BaseType * get_parent() const
virtual bool read_p()
Has this variable been read?
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....
virtual void set_read_p(bool state)
Sets the value of the read_p property.
virtual string dataset() const
Returns the name of the dataset used to create this instance.
virtual bool d4_ops(BaseType *b, int op)
Evaluator a relop for DAP4.
virtual void set_attr_table(const AttrTable &at)
virtual void set_synthesized_p(bool state)
virtual void set_parent(BaseType *parent)
virtual int element_count(bool leaves=false)
Count the members of constructor types.
void dump(ostream &strm) const override
dumps information about this object
virtual string toString()
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
virtual bool is_dap4() const
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
virtual void set_name(const string &n)
Sets the name of the class instance.
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
virtual D4Attributes * attributes()
virtual std::string FQN() const
virtual bool send_p()
Should this variable be sent?
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
virtual bool is_simple_type() const
Returns true if the instance is a numeric, string or URL type variable.
virtual void set_send_p(bool state)
virtual void set_is_dap4(const bool v)
virtual BaseType * ptr_duplicate()=0
virtual void set_attributes(D4Attributes *)
virtual void transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net, then remove them from the object.
virtual void add_var(BaseType *bt, Part part=nil)
Add a variable.
virtual void transfer_attributes(AttrTable *at)
virtual bool is_in_selection()
Is this variable part of the current selection?
virtual bool synthesized_p()
stack< BaseType * > btp_stack
virtual BaseType * get_ancestor()
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
virtual int64_t width_ll(bool constrained=false) const
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr)
Returns a pointer to a member of a constructor class.
virtual void set_type(const Type &t)
Sets the type of the class instance.
virtual Type type() const
Returns the type of the class instance.
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
virtual void set_attributes_nocopy(D4Attributes *)
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
Evaluate a constraint expression.
void add_var_nocopy(BaseType *bt, Part part=nil) override
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
void print_dap4(XMLWriter &xml) const
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Read data from the stream made by D4StreamMarshaller.
static ostream & LMarg(ostream &strm)
libdap base object for common functionality of libdap objects
A class for error processing.
A class for software fault reporting.
abstract base class used to marshal/serialize dap data objects
abstract base class used to unmarshall/deserialize dap data objects
Holds a one-dimensional collection of DAP2 data types.
unsigned int get_doc_size()
xmlTextWriterPtr get_writer() const
unsigned long long get_size(D4Group *grp, bool constrained=false)
top level DAP object to house generic methods
Type
Identifies the data type.
string www2id(const string &in, const string &escape, const string &except)
bool is_simple_type(Type t)
Returns true if the instance is a numeric, string or URL type variable.
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...
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...
bool is_constructor_type(Type t)
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
bool is_vector_type(Type t)
Returns true if the instance is a vector (i.e., array) type variable.
Part
Names the parts of multi-section constructor data types.
string id2www(string in, const string &allowable)