87 DBG(cerr <<
"In BaseType::m_duplicate for " << bt.
name() << endl);
91 d_dataset = bt.d_dataset;
92 d_is_read = bt.d_is_read;
93 d_is_send = bt.d_is_send;
97 d_parent = bt.d_parent;
106 d_is_dap4 = bt.d_is_dap4;
108 DBG(cerr <<
"Exiting BaseType::m_duplicate for " << bt.
name() << endl);
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)
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)
152 DBG(cerr <<
"In BaseTpe::copy_ctor for " << copy_from.
name() << endl);
158 DBG2(cerr <<
"Entering ~BaseType (" <<
this <<
")" << endl);
163 DBG2(cerr <<
"Exiting ~BaseType" << endl);
169 DBG(cerr <<
"Entering BaseType::operator=" << endl);
175 DBG(cerr <<
"Exiting BaseType::operator=" << endl);
187 oss <<
"BaseType (" <<
this <<
"):" << endl
188 <<
" _name: " << d_name << endl
190 <<
" _dataset: " << d_dataset << endl
191 <<
" _read_p: " << d_is_read << endl
192 <<
" _send_p: " << d_is_send << endl
194 <<
" d_parent: " << d_parent << endl
195 <<
" d_attr: " << hex << &d_attr << dec << endl;
240 << (
void *)
this <<
")" << endl ;
466 DBG2(cerr <<
"Changing read_p state of " <<
name() <<
" to "
500 DBG2(cerr <<
"Calling BaseType::set_send_p() for: " << this->
name()
544 d_attributes = attrs;
577 DBG(cerr <<
"In BaseType::transfer_attributes; processing " <<
name() << endl);
581 DBG(cerr <<
"Processing AttrTable: " << at->
get_name() << endl);
585 DBG(cerr <<
"About to append " <<
"attr name, type:" << at->
get_name(at_p) <<
", " << at->
get_type(at_p) << endl);
641 if (!dynamic_cast<Constructor *>(parent)
642 && !dynamic_cast<Vector *>(parent)
644 throw InternalErr(
"Call to set_parent with incorrect variable type.");
723 throw InternalErr(__FILE__, __LINE__,
"BaseType::add_var unimplemented");
729 throw InternalErr(__FILE__, __LINE__,
"BaseType::add_var_nocopy unimplemented");
810 throw InternalErr(
"Unimplemented BaseType::read() method called for the variable named: " +
name());
817 DBG2(cerr <<
"BaseType::intern_data: " <<
name() << endl);
841 throw InternalErr(__FILE__, __LINE__,
"The DAP2 serialize() method has not been implemented for " +
type_name());
847 throw InternalErr(__FILE__, __LINE__,
"The DAP2 deserialize() method has not been implemented for " +
type_name());
853 throw InternalErr(__FILE__, __LINE__,
"The DAP4 serialize() method has not been implemented for " +
type_name());
859 throw InternalErr(__FILE__, __LINE__,
"The DAP4 deserialize() method has not been implemented for " +
type_name());
906 bool constraint_info,
bool constrained)
909 print_decl(oss, space, print_semi, constraint_info, constrained);
910 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
957 bool constraint_info,
bool constrained)
961 if (constrained && !
send_p())
966 if (constraint_info) {
968 out <<
": Send True" ;
970 out <<
": Send False" ;
996 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
1038 if (constrained && !
send_p())
1044 if (!d_name.empty())
1045 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)d_name.c_str()) < 0)
1046 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1054 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
1113 bool sem = (d_type !=
dods_null_c && d_name.length());
1116 msg =
"Every variable must have both a name and a type\n";
1162 throw InternalErr(__FILE__, __LINE__,
"Unimplemented operator.");
1181 throw InternalErr(__FILE__, __LINE__,
"not implemented");
1183 return width(constrained);
std::vector< entry * >::iterator Attr_iter
void set_is_dap4(const bool v)
virtual bool read()
Read data into a local buffer.
virtual bool read_p()
Has this variable been read?
abstract base class used to unmarshall/deserialize dap data objects
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.
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 void set_attributes_nocopy(D4Attributes *)
xmlTextWriterPtr get_writer()
virtual void print_dap4(XMLWriter &xml, bool constrained=false)
virtual Attr_iter attr_end()
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
Part
Names the parts of multi-section constructor data types.
BaseType & operator=(const BaseType &rhs)
bool is_constructor_type(Type t)
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
Contains the attributes for a dataset.
virtual void set_name(const string &n)
Sets the name of the class instance.
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
Read data from the stream made by D4StreamMarshaller.
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
bool is_vector_type(Type t)
Returns true if the instance is a vector (i.e., array) type variable.
virtual void set_is_global_attribute(bool ga)
void print_xml_writer(XMLWriter &xml)
virtual void add_var(BaseType *bt, Part part=nil)
Add a variable.
Type
Identifies the data type.
Type type() const
Returns the type of the class instance.
virtual string get_name() const
Get the name of this attribute table.
virtual string toString()
virtual void set_in_selection(bool state)
virtual bool is_in_selection()
Is this variable part of the current selection?
stack< BaseType * > btp_stack
virtual void set_parent(BaseType *parent)
A class for software fault reporting.
string dataset() const
Returns the name of the dataset used to create this instance.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
Returns a pointer to a member of a constructor class.
virtual void compute_checksum(Crc32 &checksum)=0
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
string type_name() const
Returns the type of the class instance as a string.
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net.
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
virtual void set_send_p(bool state)
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
virtual BaseType * get_parent() const
virtual void dump(ostream &strm) const
dumps information about this object
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...
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
void set_type(const Type &t)
Sets the type of the class instance.
virtual void set_read_p(bool state)
Sets the value of the read_p property.
bool is_simple_type(Type t)
Returns true if the instance is a numeric, string or URL type variable.
virtual D4Attributes * attributes()
virtual std::string FQN() const
virtual bool synthesized_p()
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
string name() const
Returns the name of the class instance.
virtual Attr_iter attr_begin()
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
void m_duplicate(const BaseType &bt)
Perform a deep copy.
Evaluate a constraint expression.
static ostream & LMarg(ostream &strm)
virtual bool is_simple_type() const
Returns true if the instance is a numeric, string or URL type variable.
virtual AttrTable & get_attr_table()
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
The basic data type for the DODS DAP types.
virtual void set_attributes(D4Attributes *)
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...
libdap base object for common functionality of libdap objects
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
abstract base class used to marshal/serialize dap data objects
virtual void set_attr_table(const AttrTable &at)
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
virtual void transfer_attributes(AttrTable *at)
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
virtual bool send_p()
Should this variable be sent?
string id2www(string in, const string &allowable)
void print_dap4(XMLWriter &xml) const
unsigned int get_doc_size()
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
virtual BaseType * transform_to_dap4(D4Group *root, Constructor *container)
DAP2 to DAP4 transform.
virtual void set_synthesized_p(bool state)