62 Constructor::Constructor(
const string &n,
const Type &t)
76 Constructor::Constructor(
const string &n,
const string &d,
const Type &t)
92 dynamic_cast<BaseType &
>(*this) = rhs;
103 return _vars.begin() ;
125 string::size_type i = source->
name.find(
"_dim_");
126 if (i != string::npos && (btp =
var(source->
name.substr(0, i)))) {
133 int n = atoi(source->
name.substr(i + 5).c_str());
134 DBG(cerr <<
"Found a Grid (" << btp->
name() <<
") and " 135 << source->
name.substr(i) <<
", extracted n: " << n << endl);
152 throw InternalErr(__FILE__, __LINE__,
"Constructor::find_matching_container");
157 if ((btp =
var(source->
name))) {
159 *dest_variable = btp;
164 else if ((btp = find_hdf4_dimension_attribute_home(source))) {
168 DBG(cerr <<
"Found a Grid" << endl);
169 *dest_variable = btp;
173 string::size_type i = source->
name.find(
"_dim_");
174 string ext = source->
name.substr(i + 1);
175 *dest_variable = btp;
213 DBG(cerr <<
"Constructor::transfer_attributes, variable: " <<
name() <<
215 DBG(cerr <<
"Working on the '" << entry->
216 name <<
"' container." << endl);
219 "Constructor::transfer_attributes");
223 AttrTable *dest = find_matching_container(entry, &dest_variable);
227 while (source_p != source->
attr_end()) {
228 DBG(cerr <<
"Working on the '" << (*source_p)->
229 name <<
"' attribute" << endl);
269 (*var)->transfer_attributes(at);
304 return _vars.rbegin();
321 return _vars.begin() + i;
330 return *(
_vars.begin() + i);
336 bool constraint_info,
bool constrained)
338 if (constrained && !
send_p())
341 fprintf(out,
"%s%s {\n", space.c_str(),
type_name().c_str()) ;
343 (*i)->print_decl(out, space +
" ",
true,
344 constraint_info, constrained);
346 fprintf(out,
"%s} %s", space.c_str(),
id2www(
name()).c_str()) ;
348 if (constraint_info) {
350 cout <<
": Send True";
352 cout <<
": Send False";
356 fprintf(out,
";\n") ;
362 bool constraint_info,
bool constrained)
364 if (constrained && !
send_p())
369 (*i)->print_decl(out, space +
" ",
true,
370 constraint_info, constrained);
374 if (constraint_info) {
376 out <<
": Send True";
378 out <<
": Send False";
386 class PrintField :
public unary_function<BaseType *, void>
392 PrintField(FILE *o,
string s,
bool c)
393 : d_out(o), d_space(s), d_constrained(c)
398 btp->
print_xml(d_out, d_space, d_constrained);
405 if (constrained && !
send_p())
408 bool has_attributes =
false;
411 fprintf(out,
"%s<%s", space.c_str(),
type_name().c_str());
413 fprintf(out,
" name=\"%s\"",
id2xml(
name()).c_str());
415 if (has_attributes || has_variables) {
421 PrintField(out, space +
" ", constrained));
423 fprintf(out,
"%s</%s>\n", space.c_str(),
type_name().c_str());
426 fprintf(out,
"/>\n");
431 class PrintFieldStrm :
public unary_function<BaseType *, void>
437 PrintFieldStrm(ostream &o,
string s,
bool c)
438 : d_out(o), d_space(s), d_constrained(c)
443 btp->
print_xml(d_out, d_space, d_constrained);
450 if (constrained && !
send_p())
453 bool has_attributes =
false;
460 if (has_attributes || has_variables) {
466 PrintFieldStrm(out, space +
" ", constrained));
468 out << space <<
"</" <<
type_name() <<
">\n" ;
505 << (
void *)
this <<
")" << endl ;
512 for (; i != ie; i++) {
std::vector< entry * >::iterator Attr_iter
string name() const
Returns the name of the class instance.
virtual bool is_global_attribute() const
virtual void dump(ostream &strm) const
dumps information about this object
virtual Attr_iter attr_end()
virtual void print_xml(FILE *out, string space=" ", bool constrained=false)
std::vector< BaseType * >::reverse_iterator Vars_riter
Contains the attributes for a dataset.
virtual string get_type(const string &name)
Get the type name of an attribute within this attribute table.
virtual string get_name() const
Get the name of this attribute table.
std::vector< BaseType * > _vars
std::vector< BaseType * >::iterator Vars_iter
virtual void print_xml(FILE *out, string pad=" ", bool constrained=false)
string id2xml(string in, const string ¬_allowed)
virtual BaseType * get_parent()
virtual void set_is_global_attribute(bool ga)
virtual AttrTable * find_container(const string &target)
Find an attribute with a given name.
Type
Identifies the data type.
Constructor & operator=(const Constructor &rhs)
A class for software fault reporting.
virtual bool is_vector_type()
Returns true if the instance is a vector (i.e., array) type variable.
virtual bool is_constructor_type()
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
Map_iter map_begin()
Returns an iterator referencing the first Map vector.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
Returns a pointer to a member of a constructor class.
virtual bool is_linear()
Check to see whether this variable can be printed simply.
virtual void transfer_attributes(AttrTable *at_container)
virtual AttrTable * append_container(const string &name)
Add a container to the attribute table.
virtual AttrTable * get_attr_table(const string &name)
Get an attribute container.
Type type() const
Returns the type of the class instance.
BaseType * get_var_index(int i)
Holds the Grid data type.
virtual void dump(ostream &strm) const
dumps information about this object
std::vector< BaseType * >::const_iterator Vars_citer
virtual Attr_iter attr_begin()
static ostream & LMarg(ostream &strm)
virtual AttrTable & get_attr_table()
virtual unsigned int append_attr(const string &name, const string &type, const string &value)
Add an attribute to the table.
The basic data type for the DODS DAP types.
virtual AttrType get_attr_type(const string &name)
Get the type of an attribute.
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.
string type_name() const
Returns the type of the class instance as a string.
virtual vector< string > * get_attr_vector(const string &name)
Get a vector-valued attribute.
Vars_iter get_vars_iter(int i)
virtual bool send_p()
Should this variable be sent?
string id2www(string in, const string &allowable)
void _duplicate(const Constructor &s)