85 DBG(cerr <<
"Copying structure: " <<
name() << endl);
87 for (
Vars_iter i = cs.d_vars.begin(); i != cs.d_vars.end(); i++) {
88 DBG(cerr <<
"Copying field: " << (*i)->name() << endl);
94 BaseType *btp = (*i)->ptr_duplicate();
95 btp->set_parent(
this);
128 DBG(cerr <<
"In Structure::copy_ctor for " <<
name() << endl);
171 DBG(cerr <<
"Entering Structure::operator=" << endl);
179 DBG(cerr <<
"Exiting Structure::operator=" << endl);
192 i += (*j)->element_count(leaves);
205 linear = linear && static_cast<Structure*>((*i))->
is_linear();
207 linear = linear && (*i)->is_simple_type();
218 (*i)->set_send_p(state);
228 (*i)->set_read_p(state);
244 (*i)->set_in_selection(state);
256 static_cast<Sequence&>(**i).set_leaf_sequence(++level);
258 static_cast<Structure&>(**i).set_leaf_sequence(level);
273 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
275 if (bt->is_dap4_only_type())
276 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
296 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
298 if (bt->is_dap4_only_type())
299 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
301 bt->set_parent(
this);
313 if ((*i)->name() == n) {
369 sz += (*i)->width(constrained);
372 sz += (*i)->width(constrained);
384 DBG(cerr <<
"Structure::intern_data: " <<
name() << endl);
389 if ((*i)->send_p()) {
390 (*i)->intern_data(eval, dds);
397 Marshaller &m,
bool ce_eval)
405 if (ce_eval && !eval.eval_selection(dds,
dataset()))
412 if ((*i)->send_p()) {
414 XDRStreamMarshaller *sm =
dynamic_cast<XDRStreamMarshaller*
>(&m);
416 sm->reset_checksum();
418 (*i)->serialize(eval, dds, m,
false);
423 (*i)->serialize(eval, dds, m,
false);
435 (*i)->deserialize(um, dds, reuse);
469 Structure::var(
const string &name,
bool exact_match, btp_stack *s)
499 if ((*i)->name() ==
name) {
501 DBG(cerr <<
"Pushing " << this->
name() << endl);
502 s->push(static_cast<BaseType *>(
this));
506 if ((*i)->is_constructor_type()) {
507 BaseType *btp = (*i)->var(name,
false, s);
510 DBG(cerr <<
"Pushing " << this->
name() << endl);
511 s->push(static_cast<BaseType *>(
this));
529 if ((*i)->name() ==
name) {
531 s->push(static_cast<BaseType *>(
this));
539 string::size_type dot_pos = name.find(
".");
540 if (dot_pos != string::npos) {
541 string aggregate = name.substr(0, dot_pos);
542 string field = name.substr(dot_pos + 1);
547 s->push(static_cast<BaseType *>(
this));
549 return agg_ptr->var(field,
true, s);
564 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
577 i++, (void)(i !=
d_vars.end() && out <<
", ")) {
578 (*i)->print_val(out,
"",
false);
603 if (!(*i)->check_semantics(msg,
true)) {
627 << (
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 unsigned int width(bool constrained=false) const
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 BaseType * transform_to_dap4(D4Group *root, Constructor *container)
BaseType * transform_to_dap4(D4Group *root, Constructor *dest)
DAP2 to DAP4 transform.
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 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.