41 unsigned long value = 0;
42 istringstream iss(size);
47 if (!iss || !iss.eof())
throw Error(
"Invalid value '" + size +
"' passed to D4Dimension::set_size.");
65 name = (grp->
name() ==
"/") ?
"/" + name : grp->
name() +
"/" +
name;
68 grp = static_cast<D4Group*>(grp->
get_parent());
85 if (xmlTextWriterStartElement(xml.
get_writer(), (
const xmlChar*)
"Dimension") < 0)
86 throw InternalErr(__FILE__, __LINE__,
"Could not write Dimension element");
88 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)d_name.c_str()) < 0)
89 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
93 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
97 oss << (d_c_stop - d_c_start) / d_c_stride + 1;
100 if (xmlTextWriterWriteAttribute(xml.
get_writer(), (
const xmlChar*)
"size", (
const xmlChar*) oss.str().c_str()) < 0)
101 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for size");
103 if (xmlTextWriterEndElement(xml.
get_writer()) < 0)
104 throw InternalErr(__FILE__, __LINE__,
"Could not end Dimension element");
112 return d->
name() == name;
118 D4DimensionsIter d = find_if(d_dims.begin(), d_dims.end(), bind2nd(ptr_fun(dim_name_eq), name));
119 return (d != d_dims.end()) ? *d: 0;
126 while (i != d_dims.end()) {
129 (*i)->print_dap4(xml);
132 if ((*i)->used_by_projected_var())
133 (*i)->print_dap4(xml);
136 (*i)->print_dap4(xml);
vector< D4Dimension * >::iterator D4DimensionsIter
Iterator used for D4Dimensions.
xmlTextWriterPtr get_writer()
void print_dap4(XMLWriter &xml, bool constrained=false) const
void set_size(unsigned long size)
A class for software fault reporting.
BaseType * find_first_var_that_uses_dimension(D4Dimension *dim)
virtual BaseType * get_parent() const
void print_dap4(XMLWriter &xml) const
Print the Dimension declaration. Print the Dimension in a form suitable for use in a Group definition...
string name() const
Returns the name of the class instance.
vector< D4Dimension * >::const_iterator D4DimensionsCIter
A class for error processing.
string fully_qualified_name() const
Get the FQN for the dimension.
D4Dimension * find_dim(const string &name)