65void Constructor::m_duplicate(
const Constructor &c) {
70 for (
auto var : c.d_vars) {
72 btp->set_parent(
this);
91 (*i)->transform_to_dap4(root , dest );
115 i +=
var->element_count(leaves);
123 var->set_send_p(state);
142 var->set_read_p(state);
162 sz +=
var->width(constrained);
164 sz +=
var->width(constrained);
182 sz +=
var->width_ll(constrained);
184 sz +=
var->width_ll(constrained);
218 s->push(
static_cast<BaseType *
>(
this));
222 if (
var->is_constructor_type()) {
226 s->push(
static_cast<BaseType *
>(
this));
242 s->push(
static_cast<BaseType *
>(
this));
250 string::size_type dot_pos =
name.find(
".");
251 if (dot_pos != string::npos) {
252 string aggregate =
name.substr(0, dot_pos);
253 string field =
name.substr(dot_pos + 1);
258 s->push(
static_cast<BaseType *
>(
this));
260 return agg_ptr->
var(field,
true, s);
304 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
306 if (i < 0 || i >= (
int)(
d_vars.size()))
307 throw InternalErr(__FILE__, __LINE__,
"The index must be within the variable vector range..");
326 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
342 throw InternalErr(__FILE__, __LINE__,
"The BaseType parameter cannot be null.");
360 auto to_remove = stable_partition(
d_vars.begin(),
d_vars.end(), [n](
BaseType *btp) { return btp->name() != n; });
361 for_each(to_remove,
d_vars.end(), [](
BaseType *btp) { delete btp; });
401 throw Error(
string(
"A method usable only with DAP2 variables was called on a DAP4 variable (")
411 var->intern_data(eval, dds);
428 sm->reset_checksum();
430 var->serialize(eval, dds, m,
false);
437 var->serialize(eval, dds, m,
true);
447 var->deserialize(um, dds, reuse);
454 throw InternalErr(__FILE__, __LINE__,
"Computing a checksum alone is not supported for Constructor types.");
495 var->serialize(m, dmr, filter);
502 var->deserialize(um, dmr);
508 print_decl(oss, space, print_semi, constraint_info, constrained);
509 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
513 if (constrained && !
send_p())
518 var->print_decl(out, space +
" ",
true, constraint_info, constrained);
522 if (constraint_info) {
524 out <<
": Send True";
526 out <<
": Send False";
536 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
547 (*i)->print_val(out,
"",
false);
575 if (constrained && !
send_p())
582 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)
name().c_str()) < 0)
583 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
592 [&xml, constrained](
BaseType *btp) { btp->print_xml_writer(xml, constrained); });
597 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
602 if (constrained && !
send_p())
609 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)
name().c_str()) < 0)
610 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
614 [&xml, constrained](
BaseType *btp) { btp->print_dap4(xml, constrained); });
618 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
631 if (!
var->check_semantics(msg,
true)) {
658 var->set_in_selection(state);
670 var->transfer_attributes(at);
677 if (!dropped_vars->empty()) {
679 dv_table->
set_name(
"dap4:dropped_members");
684 for (; dvIter != dvEnd; dvIter++, i++) {
697 for (; d_iter < end; d_iter++) {
699 ostringstream dim_size;
700 dim_size << (*d_iter).size;
723 bool has_projected_dap4 =
false;
727 has_projected_dap4 |=
var->is_dap4_projected(inventory);
730 return has_projected_dap4;
742 strm <<
DapIndent::LMarg <<
"Constructor::dump - (" << (
void *)
this <<
")" << endl;
A multidimensional array of identical data types.
std::vector< dimension >::iterator Dim_iter
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 AttrTable * get_attr_table(const string &name)
Get an attribute container.
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
virtual string get_name() const
Get the name of this attribute table.
void print_xml_writer(XMLWriter &xml)
virtual string type_name() const
Returns the type of the class instance as a string.
virtual AttrTable & get_attr_table()
virtual string name() const
Returns the name of the class instance.
virtual void set_in_selection(bool state)
virtual BaseType * get_parent() const
virtual bool read_p()
Has this variable been read?
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_parent(BaseType *parent)
void dump(ostream &strm) const override
dumps information about this object
virtual bool is_vector_type() const
Returns true if the instance is a vector (i.e., array) type variable.
virtual bool is_dap4() const
virtual D4Attributes * attributes()
virtual std::string FQN() const
virtual bool send_p()
Should this variable be sent?
virtual void set_send_p(bool state)
virtual void set_is_dap4(const bool v)
virtual BaseType * ptr_duplicate()=0
virtual void transfer_attributes(AttrTable *at)
stack< BaseType * > btp_stack
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 Type type() const
Returns the type of the class instance.
Evaluate a constraint expression.
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator and is called ...
std::vector< BaseType * >::reverse_iterator Vars_riter
int element_count(bool leaves=false) override
Count the members of constructor types.
void compute_checksum(Crc32 &checksum) override
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
void transform_to_dap4(D4Group *root, Constructor *dest) override
DAP2 to DAP4 transform.
Vars_iter get_vars_iter(int i)
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())
void set_var_index(BaseType *bt, int i)
Set the ith element of d_vars to a variable object.
void add_var(BaseType *bt, Part part=nil) override
void transfer_attributes(AttrTable *at) override
void print_xml_writer(XMLWriter &xml, bool constrained=false) override
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 print_xml(ostream &out, string space=" ", bool constrained=false) override
bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false) override
Receive data from the net.
void intern_data() override
Read data into this variable.
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
void set_send_p(bool state) override
bool is_dap4_projected(std::vector< std::string > &inventory) override
bool read() override
Read the elements of Constructor marked for transmission.
void set_in_selection(bool state) override
Set the in_selection property.
bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true) override
Move data to the net, then remove them from the object.
BaseType * m_exact_match(const string &name, btp_stack *s=nullptr)
void add_var_nocopy(BaseType *bt, Part part=nil) override
const vector< BaseType * > & variables() const
unsigned int width(bool constrained=false) const override
BaseType * get_var_index(int i)
BaseType * m_leaf_match(const string &name, btp_stack *s=nullptr)
bool check_semantics(string &msg, bool all=false) override
Compare an object's current state with the semantics of its type.
void print_dap4(XMLWriter &xml, bool constrained=false) override
std::string FQN() const override
virtual bool is_linear()
Check to see whether this variable can be printed simply.
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
int64_t width_ll(bool constrained=false) const override
Get the width of the Constructor's fields.
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
void print_dap4(XMLWriter &xml) const
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Read data from the stream made by D4StreamMarshaller.
static ostream & LMarg(ostream &strm)
A class for error processing.
A class for software fault reporting.
abstract base class used to marshal/serialize dap data objects
abstract base class used to unmarshall/deserialize dap data objects
Marshaller that knows how serialize dap data objects to a C++ iostream using XDR.
unsigned int get_doc_size()
xmlTextWriterPtr get_writer() const
unsigned long long get_size(D4Group *grp, bool constrained=false)
top level DAP object to house generic methods
string www2id(const string &in, const string &escape, const string &except)
string AttrType_to_String(const AttrType at)
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)
string id2www(string in, const string &allowable)