66 d_vars.push_back(btp);
72 Constructor::Constructor(
const string &n,
const Type &t,
bool is_dap4)
86 Constructor::Constructor(
const string &n,
const string &d,
const Type &t,
bool is_dap4)
102 dynamic_cast<BaseType &
>(*this) = rhs;
117 i += (*j)->element_count(leaves);
127 (*i)->set_send_p(state);
137 (*i)->set_read_p(state);
172 sz += (*i)->width(constrained);
175 sz += (*i)->width(constrained);
211 if ((*i)->name() ==
name) {
213 DBG(cerr <<
"Pushing " << this->
name() << endl);
214 s->push(static_cast<BaseType *>(
this));
218 if ((*i)->is_constructor_type()) {
222 DBG(cerr <<
"Pushing " << this->
name() << endl);
223 s->push(static_cast<BaseType *>(
this));
239 if ((*i)->name() ==
name) {
241 s->push(static_cast<BaseType *>(
this));
249 string::size_type dot_pos = name.find(
".");
250 if (dot_pos != string::npos) {
251 string aggregate = name.substr(0, dot_pos);
252 string field = name.substr(dot_pos + 1);
257 s->push(static_cast<BaseType *>(
this));
259 return agg_ptr->
var(field,
true, s);
304 return d_vars.begin() + i;
313 return *(
d_vars.begin() + i);
326 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
328 if (bt->is_dap4_only_type())
329 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
349 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
351 if (bt->is_dap4_only_type())
352 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
365 if ((*i)->name() == n) {
404 DBG(cerr <<
"Structure::intern_data: " <<
name() << endl);
409 if ((*i)->send_p()) {
410 (*i)->intern_data(eval, dds);
431 if ((*i)->send_p()) {
435 sm->reset_checksum();
437 (*i)->serialize(eval, dds, m,
false);
442 (*i)->serialize(eval, dds, m,
false);
454 (*i)->deserialize(um, dds, reuse);
462 bool constraint_info,
bool constrained)
465 print_decl(oss, space, print_semi, constraint_info, constrained);
466 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
471 bool constraint_info,
bool constrained)
473 if (constrained && !
send_p())
478 (*i)->print_decl(out, space +
" ",
true, constraint_info, constrained);
482 if (constraint_info) {
484 out <<
": Send True";
486 out <<
": Send False";
498 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
511 i++, (void)(i !=
d_vars.end() && out <<
", ")) {
512 (*i)->print_val(out,
"",
false);
543 class PrintFieldXMLWriter :
public unary_function<BaseType *, void>
548 PrintFieldXMLWriter(
XMLWriter &x,
bool c)
549 : d_xml(x), d_constrained(c)
552 void operator()(BaseType *btp)
554 btp->print_xml_writer(d_xml, d_constrained);
561 if (constrained && !
send_p())
568 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)
name().c_str()) < 0)
569 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
578 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
593 if (!(*i)->check_semantics(msg,
true)) {
628 (*i)->set_in_selection(state);
646 << (
void *)
this <<
")" << endl ;
653 for (; i != ie; i++) {
virtual bool read_p()
Has this variable been read?
virtual void set_in_selection(bool state)
Set the in_selection property.
abstract base class used to unmarshall/deserialize dap data objects
unsigned int get_doc_size()
void m_duplicate(const Constructor &s)
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())
Part
Names the parts of multi-section constructor data types.
std::vector< BaseType * >::reverse_iterator Vars_riter
std::vector< BaseType * > d_vars
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
std::vector< BaseType * >::iterator Vars_iter
void print_xml_writer(XMLWriter &xml)
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
virtual void add_var(BaseType *bt, Part part=nil)
Type
Identifies the data type.
Constructor & operator=(const Constructor &rhs)
virtual void set_in_selection(bool state)
virtual int element_count(bool leaves=false)
Count the members of constructor types.
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.
bool eval_selection(DDS &dds, const string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called ...
xmlTextWriterPtr get_writer()
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
Returns a pointer to a member of a constructor class.
string type_name() const
Returns the type of the class instance as a string.
virtual bool is_linear()
Check to see whether this variable can be printed simply.
virtual void set_send_p(bool state)
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Move data to the net.
virtual void dump(ostream &strm) const
dumps information about this object
BaseType * get_var_index(int i)
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
virtual void set_read_p(bool state)
Sets the value of the read_p property.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
string name() const
Returns the name of the class instance.
BaseType * m_leaf_match(const string &name, btp_stack *s=0)
std::vector< BaseType * >::const_iterator Vars_citer
virtual void print_xml_writer(XMLWriter &xml, bool constrained=false)
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
virtual unsigned int width(bool constrained=false)
Evaluate a constraint expression.
static ostream & LMarg(ostream &strm)
virtual AttrTable & get_attr_table()
The basic data type for the DODS DAP types.
abstract base class used to marshal/serialize dap data objects
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.
BaseType * m_exact_match(const string &name, btp_stack *s=0)
bool unique_names(vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)
Vars_iter get_vars_iter(int i)
virtual void del_var(const string &name)
virtual void set_send_p(bool state)
marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using XDR ...
virtual bool send_p()
Should this variable be sent?
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
string id2www(string in, const string &allowable)
virtual void set_read_p(bool state)
Sets the value of the read_p property.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.