82 Constructor::m_duplicate(s);
86 DBG(cerr <<
"Copying structure: " <<
name() << endl);
88 for (
Vars_iter i = cs.d_vars.begin(); i != cs.d_vars.end(); i++) {
89 DBG(cerr <<
"Copying field: " << (*i)->name() << endl);
95 BaseType *btp = (*i)->ptr_duplicate();
96 btp->set_parent(
this);
125 DBG(cerr <<
"In Structure::copy_ctor for " <<
name() << endl);
143 DBG(cerr << __func__ <<
"() - BEGIN" << endl;);
149 DBG(cerr << __func__ <<
"() - Calling Constructor::transform_to_dap4(" <<
"'" << root->
name()
150 <<
"':" << (
void *)root
153 << dest->
name() <<
"':" << (
void *)dest <<
")" << endl;);
156 DBG(cerr << __func__ <<
"() - Added new Structure '" << dest->name() <<
"' (" << (
void *)dest
157 <<
") to the container '" << container->
name() <<
"'" << endl;);
158 DBG(cerr << __func__ <<
"() - END" << endl;);
168 DBG(cerr <<
" " << __func__ <<
" BEGIN" << endl);
183 vector<BaseType *> dropped_vars;
185 vector<BaseType *> *new_vars = (*i)->transform_to_dap2(&dest->
get_attr_table() );
202 dropped_vars.push_back(*i);
220 vector<BaseType *> *result =
new vector<BaseType *>();
221 result->push_back(dest);
223 DBG(cerr <<
" " << __func__ <<
" END" << endl);
241 linear = linear && (*i)->is_simple_type();
252 (*i)->set_send_p(state);
262 (*i)->set_read_p(state);
278 (*i)->set_in_selection(state);
290 static_cast<Structure &
>(**i).set_leaf_sequence(level);
305 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
307 if (bt->is_dap4_only_type())
308 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
328 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
330 if (bt->is_dap4_only_type())
331 throw InternalErr(__FILE__, __LINE__,
"Attempt to add a DAP4 type to a DAP2 Structure.");
333 bt->set_parent(
this);
345 if ((*i)->name() == n) {
401 sz += (*i)->width(constrained);
404 sz += (*i)->width(constrained);
416 DBG(cerr <<
"Structure::intern_data: " <<
name() << endl);
421 if ((*i)->send_p()) {
422 (*i)->intern_data(eval, dds);
431#if USE_LOCAL_TIMEOUT_SCHEME
438 if (ce_eval && !eval.eval_selection(dds,
dataset()))
441#if USE_LOCAL_TIMEOUT_SCHEME
445 if ((*i)->send_p()) {
447 XDRStreamMarshaller *sm =
dynamic_cast<XDRStreamMarshaller*
>(&m);
449 sm->reset_checksum();
451 (*i)->serialize(eval, dds, m,
false);
456 (*i)->serialize(eval, dds, m,
false);
468 (*i)->deserialize(um, dds, reuse);
532 if ((*i)->name() ==
name) {
534 DBG(cerr <<
"Pushing " << this->
name() << endl);
535 s->push(
static_cast<BaseType *
>(
this));
539 if ((*i)->is_constructor_type()) {
543 DBG(cerr <<
"Pushing " << this->
name() << endl);
544 s->push(
static_cast<BaseType *
>(
this));
562 if ((*i)->name() ==
name) {
564 s->push(
static_cast<BaseType *
>(
this));
572 string::size_type dot_pos =
name.find(
".");
573 if (dot_pos != string::npos) {
574 string aggregate =
name.substr(0, dot_pos);
575 string field =
name.substr(dot_pos + 1);
580 s->push(
static_cast<BaseType *
>(
this));
582 return agg_ptr->var(field,
true, s);
597 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
610 i++, (
void)(i !=
d_vars.end() && out <<
", ")) {
611 (*i)->print_val(out,
"",
false);
636 if (!(*i)->check_semantics(msg,
true)) {
657 strm <<
DapIndent::LMarg <<
"Structure::dump - (" << (
void *)
this <<
")" << endl;
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 string get_name() const
Get the name of this attribute table.
virtual void print(FILE *out, string pad=" ", bool dereference=false)
Prints the attribute table.
virtual unsigned int get_size() const
Get the number of entries in this attribute table.
The basic data type for the DODS DAP types.
void m_duplicate(const BaseType &bt)
Perform a deep copy.
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 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 void set_attr_table(const AttrTable &at)
virtual void set_parent(BaseType *parent)
virtual D4Attributes * attributes()
virtual void add_var_nocopy(BaseType *bt, Part part=nil)
virtual void set_send_p(bool state)
virtual void set_is_dap4(const bool v)
virtual BaseType * ptr_duplicate()=0
virtual unsigned int val2buf(void *val, bool reuse=false)=0
Loads class data.
virtual unsigned int buf2val(void **val)=0
Reads the class data.
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 bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
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 print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Evaluate a constraint expression.
void transform_to_dap4(D4Group *root, Constructor *dest) override
DAP2 to DAP4 transform.
BaseType * var(const string &name, bool exact_match=true, btp_stack *s=nullptr) override
btp_stack no longer needed; use back pointers (BaseType::get_parent())
std::vector< BaseType * >::const_iterator Vars_citer
void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false) override
Print an ASCII representation of the variable structure.
void set_read_p(bool state) override
Set the 'read_p' property for the Constructor and its members.
void print_val(FILE *out, string space="", bool print_decl_p=true) override
Prints the value of the variable.
static AttrTable * make_dropped_vars_attr_table(vector< BaseType * > *dropped_vars)
std::vector< BaseType * >::iterator Vars_iter
std::vector< BaseType * > d_vars
bool read() override
Read the elements of Constructor marked for transmission.
BaseType * m_exact_match(const string &name, btp_stack *s=nullptr)
void add_var_nocopy(BaseType *bt, Part part=nil) override
BaseType * m_leaf_match(const string &name, btp_stack *s=nullptr)
Constructor & operator=(const Constructor &rhs)
Constructor(const string &name, const Type &type, bool is_dap4=false)
virtual void del_var(const string &name)
Remove an element from a Constructor.
void dump(ostream &strm) const override
dumps information about this object
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
static ostream & LMarg(ostream &strm)
A class for software fault reporting.
abstract base class used to marshal/serialize dap data objects
virtual void set_leaf_sequence(int lvl=1)
Mark the Sequence which holds the leaf elements.
Holds a structure (aggregate) type.
Structure(const string &n)
virtual void dump(ostream &strm) const
dumps information about this object
virtual void set_leaf_sequence(int level=1)
Traverse Structure, set Sequence leaf nodes.
virtual vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
virtual bool is_linear()
Check to see whether this variable can be printed simply.
virtual BaseType * ptr_duplicate()
Structure & operator=(const Structure &rhs)
virtual void transform_to_dap4(D4Group *root, Constructor *container)
abstract base class used to unmarshall/deserialize dap data objects
top level DAP object to house generic methods
string www2id(const string &in, const string &escape, const string &except)
Part
Names the parts of multi-section constructor data types.
bool unique_names(vector< BaseType * > l, const string &var_name, const string &type_name, string &msg)