55 DBG(cerr <<
"In D4Group::m_duplicate for " << g.
name() << endl);
70 while (vi !=
d_vars.end()) {
72 static_cast<Array*>(*vi)->update_dimension_pointers(g.d_dims, d_dims);
77 if (g.d_enum_defs) d_enum_defs =
new D4EnumDefs(*g.d_enum_defs);
81 while(i != g.d_groups.end()) {
86 DBG(cerr <<
"Exiting D4Group::m_duplicate" << endl);
113 DBG(cerr <<
"In D4Group::copy_ctor for " << rhs.
name() << endl);
123 while(i != d_groups.end())
162 name_eq(
D4Group *g,
const string name)
164 return g->
name() == name;
171 return (g ==
grp_end()) ? 0: *g;
199 BaseType *btp = (*i)->find_first_var_that_uses_dimension(dim);
220 if ((*i)->send_p() && (*i)->type() ==
dods_enum_c) {
228 BaseType *btp = (*i)->find_first_var_that_uses_enumeration(enum_def);
250 if (lpath[0] ==
'/') {
252 throw InternalErr(__FILE__, __LINE__,
"Lookup of a FQN starting in non-root group.");
254 lpath = lpath.substr(1);
257 string::size_type pos = lpath.find(
'/');
258 if (pos == string::npos) {
264 string grp_name = lpath.substr(0, pos);
265 lpath = lpath.substr(pos + 1);
268 return (grp == 0) ? 0: grp->
find_dim(lpath);
274 BaseType *map_source = m_find_map_source_helper(path);
277 if (map_source && map_source->
type() ==
dods_array_c)
return static_cast<Array*>(map_source);
283 D4Group::m_find_map_source_helper(
const string &path)
288 if (lpath[0] ==
'/') {
290 throw InternalErr(__FILE__, __LINE__,
"Lookup of a FQN starting in non-root group.");
292 lpath = lpath.substr(1);
295 string::size_type pos = lpath.find(
'/');
296 if (pos == string::npos) {
302 string grp_name = lpath.substr(0, pos);
303 lpath = lpath.substr(pos + 1);
306 return (grp == 0) ? 0: grp->var(lpath);
315 if (lpath[0] ==
'/') {
317 throw InternalErr(__FILE__, __LINE__,
"Lookup of a FQN starting in non-root group.");
319 lpath = lpath.substr(1);
322 string::size_type pos = lpath.find(
'/');
323 if (pos == string::npos) {
329 string grp_name = lpath.substr(0, pos);
330 lpath = lpath.substr(pos + 1);
349 if (lpath[0] ==
'/') {
351 throw InternalErr(__FILE__, __LINE__,
"Lookup of a FQN starting in non-root group.");
353 lpath = lpath.substr(1);
356 string::size_type pos = lpath.find(
'/');
357 if (pos == string::npos) {
363 string grp_name = lpath.substr(0, pos);
364 lpath = lpath.substr(pos + 1);
367 return (grp == 0) ? 0 : grp->
find_var(lpath);
385 size += (*v)->width(constrained);
388 size += (*v)->width(constrained);
396 while (g != d_groups.end())
397 size += (*g++)->request_size(constrained);
406 while (g != d_groups.end())
407 (*g++)->set_read_p(state);
416 while (g != d_groups.end())
417 (*g++)->set_send_p(state);
426 while (g != d_groups.end())
427 (*g++)->intern_data(checksum);
438 if ((*i)->send_p()) {
441 (*i)->intern_data(checksum);
445 oss.setf(ios::hex, ios::basefield);
446 oss << setfill(
'0') << setw(8) << checksum.
GetCrc32();
448 (*i)->attributes()->add_attribute_nocopy(a);
449 DBG(cerr <<
"CRC32: " << oss.str() <<
" for " << (*i)->name() << endl);
481 while (g != d_groups.end())
482 (*g++)->serialize(m, dmr, filter);
493 if ((*i)->send_p()) {
496 (*i)->serialize(m, dmr, filter);
498 DBG(cerr <<
"Wrote CRC32: " << m.
get_checksum() <<
" for " << (*i)->name() << endl);
507 while (g != d_groups.end())
508 (*g++)->deserialize(um, dmr);
513 (*i)->deserialize(um, dmr);
518 DBG(cerr <<
"Read CRC32: " << crc <<
" for " << (*i)->name() << endl);
519 (*i)->attributes()->add_attribute_nocopy(a);
526 if (!
name().empty() &&
name() !=
"/") {
530 if (constrained && !
send_p())
536 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)
name().c_str()) < 0)
537 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
541 if (!
dims()->empty())
558 while (g != d_groups.end())
559 (*g++)->print_dap4(xml, constrained);
561 if (!
name().empty() &&
name() !=
"/") {
562 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
virtual bool read_p()
Has this variable been read?
checksum GetCrc32() const
D4Group * find_child_grp(const string &grp_name)
xmlTextWriterPtr get_writer()
void set_parent(D4Group *g)
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())
std::vector< BaseType * > d_vars
D4Dimension * find_dim(const string &path)
Find the dimension using a path. Using the DAP4 name syntax, lookup a dimension. The dimension must b...
void print_dap4(XMLWriter &xml, bool constrained=false) const
void m_duplicate(const D4Group &g)
Read data from the stream made by D4StreamMarshaller.
std::vector< BaseType * >::iterator Vars_iter
D4Group(const string &name)
BaseType * find_first_var_that_uses_enumeration(D4EnumDef *enum_def)
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false)
Serialize a Group.
Array * find_map_source(const string &path)
Type type() const
Returns the type of the class instance.
D4EnumDef * find_enum_def(const string &name)
virtual D4Dimension * dimension_D4dim(Dim_iter i)
A class for software fault reporting.
BaseType * find_first_var_that_uses_dimension(D4Dimension *dim)
string type_name() const
Returns the type of the class instance as a string.
Holds a DAP4 enumeration.
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
long request_size(bool constrained)
vector< D4Group * >::iterator groupsIter
D4EnumDef * find_enum_def(const string &path)
std::vector< dimension >::iterator Dim_iter
virtual BaseType * get_parent() const
virtual bool read()
simple implementation of read that iterates through vars and calls read on them
groupsIter grp_end()
Get an iterator to the end of the values.
virtual D4Attributes * attributes()
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
string name() const
Returns the name of the class instance.
string get_checksum_str()
std::vector< BaseType * >::const_iterator Vars_citer
void add_group_nocopy(D4Group *g)
groupsIter grp_begin()
Get an iterator to the start of the values.
void print_dap4(XMLWriter &xml, bool constrained=false) const
D4Group & operator=(const D4Group &rhs)
virtual void intern_data(Crc32 &checksum)
Read data into this variable.
The basic data type for the DODS DAP types.
void print_dap4(XMLWriter &xml, bool constrained=false)
virtual string get_checksum()
virtual D4EnumDef * enumeration() const
virtual D4Group * ptr_duplicate()
void add_value(const string &value)
virtual void put_checksum()
Write the checksum Write the checksum for the data sent since the last call to reset_checksum() to th...
vector< D4Group * >::const_iterator groupsCIter
virtual std::string FQN() const
D4EnumDefs * enum_defs()
Get the enumerations defined for this Group.
virtual void set_send_p(bool state)
virtual void reset_checksum()
A multidimensional array of identical data types.
virtual bool send_p()
Should this variable be sent?
D4Dimension * find_dim(const string &name)
virtual void set_read_p(bool state)
Sets the value of the read_p property.
virtual void set_send_p(bool state)
void print_dap4(XMLWriter &xml) const
BaseType * find_var(const string &name)
D4Dimensions * dims()
Get the dimensions defined for this Group.
virtual void set_read_p(bool state)
Sets the value of the read_p property.