82 DBG(cerr <<
"Copying structure: " <<
name() << endl);
84 for (
Vars_iter i = cs.d_vars.begin(); i != cs.d_vars.end(); i++) {
85 DBG(cerr <<
"Copying field: " << (*i)->name() << endl);
91 BaseType *btp = (*i)->ptr_duplicate();
92 btp->set_parent(
this);
132 delete btp ; btp = 0;
164 i += (*j)->element_count(leaves);
177 linear = linear && static_cast<Structure*>((*i))->
is_linear();
179 linear = linear && (*i)->is_simple_type();
190 (*i)->set_send_p(state);
200 (*i)->set_read_p(state);
216 (*i)->set_in_selection(state);
228 static_cast<Sequence&>(**i).set_leaf_sequence(++level);
230 static_cast<Structure&>(**i).set_leaf_sequence(level);
245 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
247 if (bt->is_dap4_only_type())
248 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
268 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
270 if (bt->is_dap4_only_type())
271 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
273 bt->set_parent(
this);
285 if ((*i)->name() == n) {
341 sz += (*i)->width(constrained);
344 sz += (*i)->width(constrained);
356 DBG(cerr <<
"Structure::intern_data: " <<
name() << endl);
361 if ((*i)->send_p()) {
362 (*i)->intern_data(eval, dds);
369 Marshaller &m,
bool ce_eval)
377 if (ce_eval && !eval.eval_selection(dds,
dataset()))
384 if ((*i)->send_p()) {
386 XDRStreamMarshaller *sm =
dynamic_cast<XDRStreamMarshaller*
>(&m);
388 sm->reset_checksum();
390 (*i)->serialize(eval, dds, m,
false);
395 (*i)->serialize(eval, dds, m,
false);
407 (*i)->deserialize(um, dds, reuse);
441 Structure::var(
const string &name,
bool exact_match, btp_stack *s)
471 if ((*i)->name() ==
name) {
473 DBG(cerr <<
"Pushing " << this->
name() << endl);
474 s->push(static_cast<BaseType *>(
this));
478 if ((*i)->is_constructor_type()) {
479 BaseType *btp = (*i)->var(name,
false, s);
482 DBG(cerr <<
"Pushing " << this->
name() << endl);
483 s->push(static_cast<BaseType *>(
this));
501 if ((*i)->name() ==
name) {
503 s->push(static_cast<BaseType *>(
this));
511 string::size_type dot_pos = name.find(
".");
512 if (dot_pos != string::npos) {
513 string aggregate = name.substr(0, dot_pos);
514 string field = name.substr(dot_pos + 1);
519 s->push(static_cast<BaseType *>(
this));
521 return agg_ptr->var(field,
true, s);
538 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
551 i++, (void)(i !=
d_vars.end() && out <<
", ")) {
552 (*i)->print_val(out,
"",
false);
577 if (!(*i)->check_semantics(msg,
true)) {
601 << (
void *)
this <<
")" << endl ;
virtual bool read_p()
Has this variable been read?
virtual void set_in_selection(bool state)
Set the in_selection property.
Structure & operator=(const Structure &rhs)
void m_duplicate(const Constructor &s)
virtual BaseType * ptr_duplicate()
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 * > d_vars
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
std::vector< BaseType * >::iterator Vars_iter
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Structure(const string &n)
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
Holds a structure (aggregate) type.
virtual void add_var(BaseType *bt, Part part=nil)
virtual void set_in_selection(bool state)
virtual int element_count(bool leaves=false)
Count the members of constructor types.
virtual void set_parent(BaseType *parent)
virtual void set_leaf_sequence(int level=1)
Traverse Structure, set Sequence leaf nodes.
A class for software fault reporting.
string dataset() const
Returns the name of the dataset used to create this instance.
string type_name() const
Returns the type of the class instance as a string.
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 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.
virtual unsigned int val2buf(void *, bool)
Loads class data.
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 BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
virtual unsigned int width(bool constrained=false)
virtual unsigned int buf2val(void **)
Reads the class data.
static ostream & LMarg(ostream &strm)
The basic data type for the DODS DAP types.
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.
virtual bool is_linear()
Check to see whether this variable can be printed simply.
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)
virtual void del_var(const string &name)
virtual void set_send_p(bool state)
virtual void dump(ostream &strm) const
dumps information about this object
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.