46#include "D4Attributes.h"
47#include "D4Dimensions.h"
49#include "D4EnumDefs.h"
56#include "InternalErr.h"
65Array::dimension::dimension(
D4Dimension *d) : dim(d), use_sdim_for_slice(true) {
75void Array::_duplicate(
const Array &a) {
80 d_maps =
new D4Maps(*a.d_maps,
this);
100 for (
Dim_citer i = _shape.begin(); i != _shape.end(); i++) {
107void Array::update_length_ll(
unsigned long long) {
108 unsigned long long length = 1;
109 for (
const auto &i : _shape) {
113 set_length_ll(length);
134 :
Vector(n, nullptr, dods_array_c, is_dap4) {
137 BaseType::set_is_dap4(v->is_dap4());
153 :
Vector(n, d, nullptr, dods_array_c, is_dap4) {
156 BaseType::set_is_dap4(v->is_dap4());
170 Vector::operator=(rhs);
190 if (!(*dap2_dim).name.empty()) {
193 D4Dimension *d4_dim = root_dims->find_dim((*dap2_dim).name);
195 d4_dim =
new D4Dimension((*dap2_dim).name, (*dap2_dim).size);
198 DBG(cerr << __func__ <<
"() -" <<
" Using Existing D4Dimension '" << d4_dim->name() <<
"' ("
199 << (
void *)d4_dim <<
")" << endl);
202 if (d4_dim->size() != (
unsigned long)(*dap2_dim).size) {
214 d4_dim =
new D4Dimension((*dap2_dim).name +
"_" +
name(), (*dap2_dim).size);
215 DBG(cerr << __func__ <<
"() -" <<
" Utilizing Name/Size Conflict Naming Artifice. name'"
216 << d4_dim->name() <<
"' (" << (
void *)d4_dim <<
")" << endl);
223 (*dap2_dim).dim = d4_dim;
229 dest->set_is_dap4(
true);
233bool Array::is_dap2_grid() {
234 bool is_grid =
false;
235 if (this->is_dap4()) {
236 DBG(cerr << __func__ <<
"() - Array '" <<
name() <<
"' is DAP4 object!" << endl);
237 auto root =
dynamic_cast<D4Group *
>(this->get_ancestor());
239 throw InternalErr(__FILE__, __LINE__,
string(
"Could not get the root group for ").append(this->
name()));
240 D4Maps *d4_maps = this->maps();
241 is_grid = d4_maps->size();
248 DBG(cerr << __func__ <<
"() - Array '" <<
name() <<
"' has D4Maps." << endl);
250 D4Maps::D4MapsIter i = d4_maps->map_begin();
251 D4Maps::D4MapsIter e = d4_maps->map_end();
254 DBG(cerr << __func__ <<
"() - Map '" << (*i)->array()->name() <<
" has " << (*i)->array()->_shape.size()
255 <<
" dimension(s)." << endl);
256 if ((*i)->array(root)->_shape.size() > 1) {
264 DBG(cerr << __func__ <<
"() - Array '" <<
name() <<
"' has no D4Maps." << endl);
268 DBG(cerr << __func__ <<
"() - is_grid: " << (is_grid ?
"true" :
"false") << endl);
288 DBG(cerr << __func__ <<
"() - BEGIN Array '" <<
name() <<
"'" << endl);
298 if (is_dap2_grid()) {
300 DBG(cerr << __func__ <<
"() - Array '" <<
name() <<
"' is dap2 Grid!" << endl);
305 grid_array->set_is_dap4(
false);
312 auto root =
dynamic_cast<D4Group *
>(this->get_ancestor());
314 throw InternalErr(__FILE__, __LINE__,
string(
"Could not get the root group for ").append(this->
name()));
315 D4Maps *d4_maps = this->maps();
316 vector<BaseType *> dropped_maps;
317 D4Maps::D4MapsIter miter = d4_maps->map_begin();
318 D4Maps::D4MapsIter end = d4_maps->map_end();
319 for (; miter != end; miter++) {
320 D4Map *d4_map = (*miter);
324 if (d2_result->size() > 1)
325 throw Error(internal_error,
"D4Map Array conversion resulted in multiple DAP2 objects.");
328 Array *d2_map_array =
dynamic_cast<Array *
>((*d2_result)[0]);
331 throw Error(internal_error,
332 "DAP2 array from D4Map Array conversion has more than 1 dimension.");
334 d2_map_array->set_is_dap4(
false);
335 g->
add_map(d2_map_array,
false);
337 DBG(cerr << __func__ <<
"() - " <<
"DAS For Grid Map '" << d2_map_array->
name() <<
"':" << endl;
340 throw Error(internal_error,
"Unable to interpret returned DAP2 content.");
344 dropped_maps.push_back(d4_map_array);
349 if (!dropped_maps.empty()) {
351 AttrTable *dv_table = Constructor::make_dropped_vars_attr_table(&dropped_maps);
355 DBG(cerr << __func__ <<
"() - Array '" <<
name() <<
"' is not a Grid!" << endl);
358 switch (proto->
type()) {
387 dest->set_is_dap4(
false);
393 vector<BaseType *> *result;
395 result =
new vector<BaseType *>();
396 result->push_back(dest);
401 DBG(cerr << __func__ <<
"() - END Array '" <<
name() <<
"'" << endl);
418 std::vector<dimension>::iterator i = _shape.begin(), e = _shape.end();
421 while (old_i != old_e) {
422 if ((*i).dim == *old_i) {
423 (*i).dim = new_dims->find_dim((*old_i)->name());
460 if (v && v->
type() == dods_array_c) {
479 if (v && v->
type() == dods_array_c) {
481 Vector::add_var_nocopy(a.
var());
489 Vector::add_var_nocopy(v);
511void Array::append_dim_ll(int64_t size,
const string &name) {
537 _shape.insert(_shape.begin(), d);
545 _shape.insert(_shape.begin(), d);
561 std::vector<dimension>::iterator i = _shape.begin(), e = _shape.end();
564 if (d.
name == oldName) {
565 DBG(cerr <<
"Old name = " << d.
name <<
" newName = " << newName << endl);
581 for (
Dim_iter i = _shape.begin(); i != _shape.end(); i++) {
583 (*i).stop = (*i).size - 1;
585 (*i).c_size = (*i).size;
604static const char *array_sss =
"Invalid constraint parameters: At least one of the start, stride or stop \n\
605specified do not match the array variable.";
630 DBG(cerr <<
"add_constraint: d_size = " << d.
size << endl);
631 DBG(cerr <<
"add_constraint: start = " << start << endl);
632 DBG(cerr <<
"add_constraint: stop = " << stop << endl);
633 DBG(cerr <<
"add_constraint: stride = " << stride << endl);
639 if (d.
size > DODS_INT_MAX) {
641 throw Error(malformed_expr,
"The dimension size is too large. use add_constraint_ll()");
650 if (start >= d.
size || stop >= d.
size || stride > d.
size || stride <= 0)
651 throw Error(malformed_expr, array_sss);
653 if (((stop - start) / stride + 1) > d.
size)
654 throw Error(malformed_expr, array_sss);
660 d.
c_size = (stop - start) / stride + 1;
662 DBG(cerr <<
"add_constraint: c_size = " << d.
c_size << endl);
669void Array::add_constraint_ll(Dim_iter i, int64_t start, int64_t stride, int64_t stop) {
671 DBG(cerr <<
"add_constraint_ll: d_size = " << d.size << endl);
672 DBG(cerr <<
"add_constraint_ll: start = " << start << endl);
673 DBG(cerr <<
"add_constraint_ll: stop = " << stop << endl);
674 DBG(cerr <<
"add_constraint_ll: stride = " << stride << endl);
685 if (start >= d.size || stop >= d.size || stride > d.size || stride <= 0)
686 throw Error(malformed_expr, array_sss);
688 if (((stop - start) / stride + 1) > d.size)
689 throw Error(malformed_expr, array_sss);
695 d.c_size = (stop - start) / stride + 1;
697 DBG(cerr <<
"add_constraint: c_size = " << d.c_size << endl);
701 d.use_sdim_for_slice =
false;
705 DBG(cerr <<
"add_constraint d4dimension: stride = " << dim->c_stride() << endl);
707 if (dim->constrained())
708 add_constraint_ll(i, dim->c_start(), dim->c_stride(), dim->c_stop());
710 dim->set_used_by_projected_var(
true);
714 d.use_sdim_for_slice =
true;
755 if (!_shape.empty()) {
757 if ((*i).c_size > DODS_INT_MAX) {
758 throw Error(malformed_expr,
"The dimension size is too large. Use dimension_size_ll()");
762 if ((*i).size > DODS_INT_MAX) {
763 throw Error(malformed_expr,
"The dimension size is too large. Use dimension_size_ll()");
791 if ((*i).start > DODS_INT_MAX) {
792 throw Error(malformed_expr,
"The dimension start value is too large. Use dimension_start_ll()");
794 return (!_shape.empty()) ? (*i).start : 0;
816 if ((*i).stop > DODS_INT_MAX) {
817 throw Error(malformed_expr,
"The dimension stop value is too large. Use dimension_stop_ll()");
819 return (!_shape.empty()) ? (*i).stop : 0;
842 if ((*i).stride > DODS_INT_MAX) {
843 throw Error(malformed_expr,
"The dimension stride value is too large. Use dimension_stride_ll()");
845 return (!_shape.empty()) ? (*i).stride : 0;
848int64_t Array::dimension_size_ll(Dim_iter i,
bool constrained) {
851 if (!_shape.empty()) {
860int64_t Array::dimension_start_ll(Dim_iter i,
bool ) {
return (!_shape.empty()) ? (*i).start : 0; }
862int64_t Array::dimension_stop_ll(Dim_iter i,
bool ) {
return (!_shape.empty()) ? (*i).stop : 0; }
864int64_t Array::dimension_stride_ll(Dim_iter i,
bool ) {
return (!_shape.empty()) ? (*i).stride : 0; }
883 throw InternalErr(__FILE__, __LINE__,
"*This* array has no dimensions.");
887D4Dimension *Array::dimension_D4dim(Dim_iter i) {
return (!_shape.empty()) ? (*i).dim : 0; }
889D4Maps *Array::maps() {
891 d_maps =
new D4Maps(
this);
913 for (
Dim_iter i = _shape.begin(); i != _shape.end(); i++) {
921class PrintD4ArrayDimXMLWriter :
public unary_function<Array::dimension &, void> {
928 PrintD4ArrayDimXMLWriter(XMLWriter &xml,
bool c) : xml(xml), d_constrained(c) {}
930 void operator()(Array::dimension &d) {
935 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
"Dim") < 0)
936 throw InternalErr(__FILE__, __LINE__,
"Could not write Dim element");
938 string name = (d.dim) ? d.dim->fully_qualified_name() : d.name;
941 if (!d_constrained && !name.empty()) {
942 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)name.c_str()) <
944 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
945 }
else if (d.use_sdim_for_slice) {
946 assert(!name.empty());
947 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)name.c_str()) <
949 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
952 size << (d_constrained ? d.c_size : d.size);
953 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"size",
954 (
const xmlChar *)size.str().c_str()) < 0)
955 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
958 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
959 throw InternalErr(__FILE__, __LINE__,
"Could not end Dim element");
963class PrintD4ConstructorVarXMLWriter :
public unary_function<BaseType *, void> {
968 PrintD4ConstructorVarXMLWriter(XMLWriter &xml,
bool c) : xml(xml), d_constrained(c) {}
970 void operator()(BaseType *btp) { btp->print_dap4(xml, d_constrained); }
973class PrintD4MapXMLWriter :
public unary_function<D4Map *, void> {
977 PrintD4MapXMLWriter(XMLWriter &xml) : xml(xml) {}
979 void operator()(D4Map *m) { m->print_dap4(xml); }
988 if (constrained && !
send_p())
991 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
var()->
type_name().c_str()) < 0)
995 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)
name().c_str()) < 0)
996 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
999 if (
var()->
type() == dods_enum_c) {
1001 string path = e->enumeration()->name();
1002 if (e->enumeration()->parent()) {
1004 path =
static_cast<D4Group *
>(e->enumeration()->parent()->parent())->FQN() + path;
1006 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"enum", (
const xmlChar *)path.c_str()) < 0)
1007 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for enum");
1012 for_each(c.
var_begin(), c.
var_end(), PrintD4ConstructorVarXMLWriter(xml, constrained));
1017 for_each(
dim_begin(),
dim_end(), PrintD4ArrayDimXMLWriter(xml, constrained));
1021 for_each(maps()->map_begin(), maps()->map_end(), PrintD4MapXMLWriter(xml));
1023 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1044void Array::print_decl(FILE *out,
string space,
bool print_semi,
bool constraint_info,
bool constrained) {
1046 print_decl(oss, space, print_semi, constraint_info, constrained);
1047 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1067void Array::print_decl(ostream &out,
string space,
bool print_semi,
bool constraint_info,
bool constrained) {
1068 if (constrained && !
send_p())
1072 var()->
print_decl(out, space,
false, constraint_info, constrained);
1074 for (
Dim_citer i = _shape.begin(); i != _shape.end(); i++) {
1076 if ((*i).name !=
"") {
1077 out <<
id2www((*i).name) <<
" = ";
1080 out << (*i).c_size <<
"]";
1082 out << (*i).size <<
"]";
1096 print_xml_writer_core(xml, constrained,
"Array");
1097 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1105 print_xml_writer_core(xml, constrained,
"Array");
1106 out << xml.get_doc();
1114 print_xml_writer_core(xml, constrained,
"Map");
1115 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1123 print_xml_writer_core(xml, constrained,
"Map");
1124 out << xml.get_doc();
1132 print_xml_writer_core(xml, constrained, tag);
1133 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1141 print_xml_writer_core(xml, constrained, tag);
1142 out << xml.get_doc();
1147void Array::print_as_map_xml_writer(
XMLWriter &xml,
bool constrained) {
1148 print_xml_writer_core(xml, constrained,
"Map");
1151class PrintArrayDimXMLWriter :
public unary_function<Array::dimension &, void> {
1156 PrintArrayDimXMLWriter(XMLWriter &xml,
bool c) : xml(xml), d_constrained(c) {}
1158 void operator()(Array::dimension &d) {
1159 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)
"dimension") < 0)
1160 throw InternalErr(__FILE__, __LINE__,
"Could not write dimension element");
1162 if (!d.name.empty())
1163 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name",
1164 (
const xmlChar *)d.name.c_str()) < 0)
1165 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1168 size << (d_constrained ? d.c_size : d.size);
1169 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"size",
1170 (
const xmlChar *)size.str().c_str()) < 0)
1171 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1173 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1174 throw InternalErr(__FILE__, __LINE__,
"Could not end dimension element");
1178void Array::print_xml_writer_core(
XMLWriter &xml,
bool constrained,
string tag) {
1179 if (constrained && !
send_p())
1182 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar *)tag.c_str()) < 0)
1183 throw InternalErr(__FILE__, __LINE__,
"Could not write " + tag +
" element");
1185 if (!
name().empty())
1186 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar *)
"name", (
const xmlChar *)
name().c_str()) < 0)
1187 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1192 string tmp_name = btp->name();
1194 btp->print_xml_writer(xml, constrained);
1195 btp->set_name(tmp_name);
1197 for_each(
dim_begin(),
dim_end(), PrintArrayDimXMLWriter(xml, constrained));
1199 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1200 throw InternalErr(__FILE__, __LINE__,
"Could not end " + tag +
" element");
1216 uint64_t i =
print_array(oss, index, dims, shape);
1217 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1238 if (shape[0] >= 1) {
1239 for (uint64_t i = 0; i < shape[0] - 1; ++i) {
1240 var_ll(index++)->print_val(out,
"",
false);
1243 var_ll(index++)->print_val(out,
"",
false);
1263 for (uint64_t i = 0; i < shape[0] - 1; ++i) {
1264 index =
print_array(out, index, dims - 1, shape + 1);
1268 index =
print_array(out, index, dims - 1, shape + 1);
1280 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1296 unsigned int index = 0;
1297 for (
Dim_iter i = _shape.begin(); i != _shape.end() && index <
dimensions(
true); ++i)
1298 shape[index++] = dimension_size_ll(i,
true);
1323 msg =
"An array variable must have dimensions";
1335 stringstream sqr_brkty_stuff;
1337 sqr_brkty_stuff <<
"[";
1339 if (!dim_name.empty()) {
1340 sqr_brkty_stuff << dim_name <<
"=";
1342 sqr_brkty_stuff << a.dimension_size_ll(itr,
true) <<
"]";
1344 return sqr_brkty_stuff.str();
1354 bool has_projected_dap4 =
false;
1357 has_projected_dap4 =
1361 has_projected_dap4 = (
type == libdap::dods_int8_c) || (
type == dods_uint64_c) || (
type == dods_int64_c);
1362 if (has_projected_dap4) {
1368 return has_projected_dap4;
1380 strm << DapIndent::LMarg <<
"Array::dump - (" << (
void *)
this <<
")" << endl;
1381 DapIndent::Indent();
1383 strm << DapIndent::LMarg <<
"shape:" << endl;
1384 DapIndent::Indent();
1387 unsigned int dim_num = 0;
1388 for (; i != ie; i++) {
1389 strm << DapIndent::LMarg <<
"dimension " << dim_num++ <<
":" << endl;
1390 DapIndent::Indent();
1391 strm << DapIndent::LMarg <<
"name: " << (*i).name << endl;
1392 strm << DapIndent::LMarg <<
"size: " << (*i).size << endl;
1393 strm << DapIndent::LMarg <<
"start: " << (*i).start << endl;
1394 strm << DapIndent::LMarg <<
"stop: " << (*i).stop << endl;
1395 strm << DapIndent::LMarg <<
"stride: " << (*i).stride << endl;
1396 strm << DapIndent::LMarg <<
"constrained size: " << (*i).c_size << endl;
1397 DapIndent::UnIndent();
1399 DapIndent::UnIndent();
1400 DapIndent::UnIndent();
1411 vs_info.filter = my_vs_info.filter;
1413 for (
const auto &def_lev : my_vs_info.deflate_levels)
1414 vs_info.deflate_levels.push_back(def_lev);
1416 for (
const auto &chunk_dim : my_vs_info.chunk_dims)
1417 vs_info.chunk_dims.push_back(chunk_dim);
1419 for (
const auto &vci : my_vs_info.var_chunk_info) {
1421 vci_t.filter_mask = vci.filter_mask;
1422 vci_t.chunk_direct_io_offset = vci.chunk_direct_io_offset;
1423 vci_t.chunk_buffer_size = vci.chunk_buffer_size;
1424 for (
const auto &chunk_coord : vci.chunk_coords)
1425 vci_t.chunk_coords.push_back(chunk_coord);
1426 vs_info.var_chunk_info.push_back(vci_t);
A multidimensional array of identical data types.
void print_dap4(XMLWriter &xml, bool constrained=false) override
Print the DAP4 representation of an array.
virtual int dimension_start(Dim_iter i, bool constrained=false)
Return the start index of a dimension.
virtual void clear_constraint()
Clears the projection; add each projected dimension explicitly using add_constraint.
virtual int dimension_stop(Dim_iter i, bool constrained=false)
Return the stop index of the constraint.
void dump(ostream &strm) const override
dumps information about this object
virtual void update_length(int size=0)
bool is_dap4_projected(std::vector< std::string > &projected_dap4_inventory) override
virtual void add_constraint(Dim_iter i, int start, int stride, int stop)
Adds a constraint to an Array dimension.
virtual string dimension_name(Dim_iter i)
Returns the name of the specified dimension.
void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false) override
Prints a DDS entry for the Array.
void print_xml(ostream &out, string space=" ", bool constrained=false) override
void print_val(ostream &out, string space="", bool print_decl_p=true) override
Prints the value of the variable.
BaseType * ptr_duplicate() override
void append_dim(int size, const string &name="")
Add a dimension of a given size.
std::vector< dimension >::iterator Dim_iter
void rename_dim(const string &oldName="", const string &newName="")
Renames dimension.
std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table) override
Transforms this instance of a D4Array into the corresponding DAP2 object.
virtual int dimension_size(Dim_iter i, bool constrained=false)
Returns the size of the dimension.
std::vector< dimension >::const_iterator Dim_citer
void add_var(BaseType *v, Part p=nil) override
Add the BaseType pointer to this constructor type instance.
uint64_t print_array(FILE *out, uint64_t index, unsigned int dims, uint64_t shape[])
Print the value given the current constraint.
virtual void print_as_map_xml(ostream &out, string space=" ", bool constrained=false)
void print_xml_writer(XMLWriter &xml, bool constrained=false) override
virtual void reset_constraint()
Reset constraint to select entire array.
void set_var_storage_info(const var_storage_info &my_vs_info)
Set the variable storage information for direct IO optimization.
virtual ~Array()
The Array destructor.
virtual void print_xml_core(FILE *out, string space, bool constrained, string tag)
void prepend_dim(int size, const string &name="")
void transform_to_dap4(D4Group *root, Constructor *container) override
DAP2 to DAP4 transform.
Array(const string &n, BaseType *v, bool is_dap4=false)
Array constructor.
bool check_semantics(string &msg, bool all=false) override
Check semantic features of the Array.
virtual unsigned int dimensions(bool constrained=false)
Return the total number of dimensions in the array.
virtual int dimension_stride(Dim_iter i, bool constrained=false)
Returns the stride value of the constraint.
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.
void print_xml_writer(XMLWriter &xml)
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.
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 print_decl(FILE *out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
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 bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
virtual D4Attributes * attributes()
virtual std::string FQN() const
virtual bool send_p()
Should this variable be sent?
virtual int length() const
How many elements are in this variable? Uses -1 in places.
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 Type type() const
Returns the type of the class instance.
void add_var_nocopy(BaseType *bt, Part part=nil) override
void transform_to_dap4(AttrTable &at)
copy attributes from DAP2 to DAP4
void transform_attrs_to_dap2(AttrTable *d2_attr_table)
Copy the attributes from this D4Attributes object to a DAP2 AttrTable.
bool has_dap4_types(const std::string &path, std::vector< std::string > &inventory) const
vector< D4Dimension * >::iterator D4DimensionsIter
Iterator used for D4Dimensions.
void add_dim_nocopy(D4Dimension *dim)
D4DimensionsIter dim_end()
Get an iterator to the end of the dimensions.
D4DimensionsIter dim_begin()
Get an iterator to the start of the dimensions.
Holds a DAP4 enumeration.
D4Dimensions * dims()
Get the dimensions defined for this Group.
Array * array(D4Group *root)
This will always return the correct pointer for a valid data set.
A class for error processing.
Holds the Grid data type.
virtual void set_array(Array *p_new_arr)
virtual Array * add_map(Array *p_new_map, bool add_copy)
A class for software fault reporting.
void dump(ostream &strm) const override
dumps information about this object
void add_var(BaseType *v, Part p=nil) override
Add the BaseType pointer to this constructor type instance.
int length() const override
Returns the number of elements in the vector. Note that some child classes of Vector use the length o...
void set_length_ll(int64_t l) override
Set the number of elements in this Vector/Array This version of the function deprecates set_length() ...
BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr) override
Vector(const string &n, BaseType *v, const Type &t, bool is_dap4=false)
The Vector constructor.
void set_length(int64_t l) override
Sets the length of the vector. This function does not allocate any new space.
top level DAP object to house generic methods
Type
Identifies the data type.
string get_dims_decl(Array &a)
string www2id(const string &in, const string &escape, const string &except)
Part
Names the parts of multi-section constructor data types.
string id2www(string in, const string &allowable)
int64_t start
The constraint start index.
int64_t stride
The constraint stride.
string name
The name of this dimension.
int64_t size
The unconstrained dimension size.
int64_t stop
The constraint end index.
bool use_sdim_for_slice
Used to control printing the DMR in data responses.
int64_t c_size
Size of dimension once constrained.