46#include "D4Attributes.h"
48#include "D4Dimensions.h"
51#include "D4EnumDefs.h"
57#include "InternalErr.h"
65Array::dimension::dimension(D4Dimension *d) :
66 dim(d), use_sdim_for_slice(true)
77void Array::_duplicate(
const Array &a)
83 d_maps =
new D4Maps(*a.d_maps,
this);
102void Array::update_length(
int)
105 for (
Dim_citer i = _shape.begin(); i != _shape.end(); i++) {
106 length *= (*i).c_size;
109 set_length_ll(length);
113void Array::update_length_ll(
unsigned long long)
115 unsigned long long length = 1;
116 for (
const auto &i:_shape) {
120 set_length_ll(length);
139Array::Array(
const string &n,
BaseType *v,
bool is_dap4 ) :
140 Vector(n, nullptr, dods_array_c, is_dap4)
144 BaseType::set_is_dap4(v->is_dap4());
160 Vector(n, d, nullptr, dods_array_c, is_dap4)
164 BaseType::set_is_dap4(v->is_dap4());
183 return new Array(*
this);
187Array::operator=(
const Array &rhs)
189 if (
this == &rhs)
return *
this;
190 Vector::operator=(rhs);
211 if (!(*dap2_dim).name.empty()) {
214 D4Dimension *d4_dim = root_dims->find_dim((*dap2_dim).name);
216 d4_dim =
new D4Dimension((*dap2_dim).name, (*dap2_dim).size);
220 DBG(cerr << __func__ <<
"() -" <<
221 " Using Existing D4Dimension '"<< d4_dim->name() <<
"' (" <<
222 (
void *)d4_dim <<
")"<< endl);;
224 if (d4_dim->size() != (
unsigned long) (*dap2_dim).size) {
236 d4_dim =
new D4Dimension((*dap2_dim).name +
"_" +
name(), (*dap2_dim).size);
237 DBG(cerr << __func__ <<
"() -" <<
238 " Utilizing Name/Size Conflict Naming Artifice. name'"<< d4_dim->name() <<
"' (" <<
239 (
void *)d4_dim <<
")"<< endl);;
245 (*dap2_dim).dim = d4_dim;
252 dest->set_is_dap4(
true);
254 DBG(cerr << __func__ <<
"() - END (array:" <<
name() <<
")" << endl);;
257bool Array::is_dap2_grid()
259 bool is_grid =
false;
260 if (this->is_dap4()) {
261 DBG( cerr << __func__ <<
"() - Array '"<<
name() <<
"' is DAP4 object!" << endl);
262 auto root =
dynamic_cast<D4Group*
>(this->get_ancestor());
264 throw InternalErr(__FILE__, __LINE__,
string(
"Could not get the root group for ").append(this->
name()));
265 D4Maps *d4_maps = this->maps();
266 is_grid = d4_maps->size();
268 DBG( cerr << __func__ <<
"() - Array '"<<
name() <<
"' has D4Maps." << endl);
270 D4Maps::D4MapsIter i = d4_maps->map_begin();
271 D4Maps::D4MapsIter e = d4_maps->map_end();
273 DBG( cerr << __func__ <<
"() - Map '"<< (*i)->array()->name() <<
" has " << (*i)->array()->_shape.size() <<
" dimension(s)." << endl);
274 if ((*i)->array(root)->_shape.size() > 1) {
284 DBG( cerr << __func__ <<
"() - Array '"<<
name() <<
"' has no D4Maps." << endl);
288 DBG( cerr << __func__ <<
"() - is_grid: "<< (is_grid?
"true":
"false") << endl);
307std::vector<BaseType *> *
310 DBG(cerr << __func__ <<
"() - BEGIN Array '"<<
name() <<
"'" << endl);;
320 if (is_dap2_grid()) {
322 DBG(cerr << __func__ <<
"() - Array '"<<
name() <<
"' is dap2 Grid!" << endl);;
326 grid_array->set_is_dap4(
false);
333 auto root =
dynamic_cast<D4Group*
>(this->get_ancestor());
335 throw InternalErr(__FILE__, __LINE__,
string(
"Could not get the root group for ").append(this->
name()));
336 D4Maps *d4_maps = this->maps();
337 vector<BaseType *> dropped_maps;
338 D4Maps::D4MapsIter miter = d4_maps->map_begin();
339 D4Maps::D4MapsIter end = d4_maps->map_end();
340 for (; miter != end; miter++) {
341 D4Map *d4_map = (*miter);
345 if (d2_result->size() > 1)
346 throw Error(internal_error,
"D4Map Array conversion resulted in multiple DAP2 objects.");
349 Array *d2_map_array =
dynamic_cast<Array *
>((*d2_result)[0]);
352 throw Error(internal_error,
"DAP2 array from D4Map Array conversion has more than 1 dimension.");
354 d2_map_array->set_is_dap4(
false);
355 g->
add_map(d2_map_array,
false);
357 DBG( cerr << __func__ <<
"() - " <<
358 "DAS For Grid Map '" << d2_map_array->
name() <<
"':" << endl;
362 throw Error(internal_error,
"Unable to interpret returned DAP2 content.");
367 dropped_maps.push_back(d4_map_array);
372 if (!dropped_maps.empty()) {
374 AttrTable *dv_table = Constructor::make_dropped_vars_attr_table(&dropped_maps);
379 DBG( cerr << __func__ <<
"() - Array '"<<
name() <<
"' is not a Grid!" << endl);
382 switch (proto->
type()) {
411 dest->set_is_dap4(
false);
417 vector<BaseType *> *result;
419 result =
new vector<BaseType *>();
420 result->push_back(dest);
426 DBG( cerr << __func__ <<
"() - END Array '"<<
name() <<
"'" << endl);;
443 std::vector<dimension>::iterator i = _shape.begin(), e = _shape.end();
446 while (old_i != old_e) {
447 if ((*i).dim == *old_i) {
448 (*i).dim = new_dims->find_dim((*old_i)->name());
486 if (v && v->
type() == dods_array_c) {
507 if (v && v->
type() == dods_array_c) {
509 Vector::add_var_nocopy(a.
var());
518 Vector::add_var_nocopy(v);
541void Array::append_dim_ll(int64_t size,
const string &name)
570 _shape.insert(_shape.begin(), d);
579 _shape.insert(_shape.begin(), d);
599 std::vector<dimension>::iterator i = _shape.begin(), e = _shape.end();
602 if (d.
name == oldName) {
603 DBG(cerr <<
"Old name = " << d.
name <<
" newName = " << newName << endl);
620 for (
Dim_iter i = _shape.begin(); i != _shape.end(); i++) {
622 (*i).stop = (*i).size - 1;
624 (*i).c_size = (*i).size;
646static const char *array_sss =
647 "Invalid constraint parameters: At least one of the start, stride or stop \n\
648specified do not match the array variable.";
674 DBG(cerr <<
"add_constraint: d_size = " << d.
size << endl);
675 DBG(cerr <<
"add_constraint: start = " << start << endl);
676 DBG(cerr <<
"add_constraint: stop = " << stop << endl);
677 DBG(cerr <<
"add_constraint: stride = " << stride << endl);
683 if (d.
size >DODS_INT_MAX) {
685 throw Error(malformed_expr,
686 "The dimension size is too large. use add_constraint_ll()");
696 if (start >= d.
size || stop >= d.
size || stride > d.
size || stride <= 0)
throw Error(malformed_expr, array_sss);
698 if (((stop - start) / stride + 1) > d.
size)
throw Error(malformed_expr, array_sss);
704 d.
c_size = (stop - start) / stride + 1;
706 DBG(cerr <<
"add_constraint: c_size = " << d.
c_size << endl);
713void Array::add_constraint_ll(Dim_iter i, int64_t start, int64_t stride, int64_t stop)
716 DBG(cerr <<
"add_constraint_ll: d_size = " << d.size << endl);
717 DBG(cerr <<
"add_constraint_ll: start = " << start << endl);
718 DBG(cerr <<
"add_constraint_ll: stop = " << stop << endl);
719 DBG(cerr <<
"add_constraint_ll: stride = " << stride << endl);
725 if (stop == -1) stop = d.size - 1;
731 if (start >= d.size || stop >= d.size || stride > d.size || stride <= 0)
throw Error(malformed_expr, array_sss);
733 if (((stop - start) / stride + 1) > d.size)
throw Error(malformed_expr, array_sss);
739 d.c_size = (stop - start) / stride + 1;
741 DBG(cerr <<
"add_constraint: c_size = " << d.c_size << endl);
745 d.use_sdim_for_slice =
false;
750 DBG(cerr <<
"add_constraint d4dimension: stride = " << dim->c_stride() << endl);
752 if (dim->constrained()) add_constraint_ll(i, dim->c_start(), dim->c_stride(), dim->c_stop());
754 dim->set_used_by_projected_var(
true);
758 d.use_sdim_for_slice =
true;
764 return _shape.begin();
785 return _shape.size();
809 if (!_shape.empty()) {
811 if ((*i).c_size >DODS_INT_MAX) {
812 throw Error(malformed_expr,
813 "The dimension size is too large. Use dimension_size_ll()");
819 if ((*i).size >DODS_INT_MAX) {
820 throw Error(malformed_expr,
821 "The dimension size is too large. Use dimension_size_ll()");
851 if ((*i).start > DODS_INT_MAX) {
852 throw Error(malformed_expr,
853 "The dimension start value is too large. Use dimension_start_ll()");
855 return (!_shape.empty()) ? (*i).start : 0;
878 if ((*i).stop > DODS_INT_MAX) {
879 throw Error(malformed_expr,
880 "The dimension stop value is too large. Use dimension_stop_ll()");
882 return (!_shape.empty()) ? (*i).stop : 0;
906 if ((*i).stride > DODS_INT_MAX) {
907 throw Error(malformed_expr,
908 "The dimension stride value is too large. Use dimension_stride_ll()");
910 return (!_shape.empty()) ? (*i).stride : 0;
913int64_t Array::dimension_size_ll(Dim_iter i,
bool constrained)
917 if (!_shape.empty()) {
926int64_t Array::dimension_start_ll(Dim_iter i,
bool )
928 return (!_shape.empty()) ? (*i).start : 0;
931int64_t Array::dimension_stop_ll(Dim_iter i,
bool )
933 return (!_shape.empty()) ? (*i).stop : 0;
936int64_t Array::dimension_stride_ll(Dim_iter i,
bool )
938 return (!_shape.empty()) ? (*i).stride : 0;
958 if (_shape.empty())
throw InternalErr(__FILE__, __LINE__,
"*This* array has no dimensions.");
963Array::dimension_D4dim(Dim_iter i)
965 return (!_shape.empty()) ? (*i).dim : 0;
971 if (!d_maps) d_maps =
new D4Maps(
this);
993 for (
Dim_iter i = _shape.begin(); i != _shape.end(); i++) {
1001class PrintD4ArrayDimXMLWriter:
public unary_function<Array::dimension&, void> {
1008 PrintD4ArrayDimXMLWriter(XMLWriter &xml,
bool c) :
1009 xml(xml), d_constrained(c)
1013 void operator()(Array::dimension &d)
1019 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"Dim") < 0)
1020 throw InternalErr(__FILE__, __LINE__,
"Could not write Dim element");
1022 string name = (d.dim) ? d.dim->fully_qualified_name() : d.name;
1025 if (!d_constrained && !name.empty()) {
1026 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*) name.c_str())
1027 < 0)
throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1029 else if (d.use_sdim_for_slice) {
1030 assert(!name.empty());
1031 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*) name.c_str())
1032 < 0)
throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1036 size << (d_constrained ? d.c_size : d.size);
1037 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"size",
1038 (
const xmlChar*) size.str().c_str()) < 0)
1039 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1042 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1043 throw InternalErr(__FILE__, __LINE__,
"Could not end Dim element");
1047class PrintD4ConstructorVarXMLWriter:
public unary_function<BaseType*, void> {
1051 PrintD4ConstructorVarXMLWriter(XMLWriter &xml,
bool c) :
1052 xml(xml), d_constrained(c)
1056 void operator()(BaseType *btp)
1058 btp->print_dap4(xml, d_constrained);
1062class PrintD4MapXMLWriter:
public unary_function<D4Map*, void> {
1066 PrintD4MapXMLWriter(XMLWriter &xml) :
1071 void operator()(D4Map *m)
1084 if (constrained && !
send_p())
return;
1086 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
var()->
type_name().c_str()) < 0)
1089 if (!
name().empty())
1090 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)
name().c_str()) < 0)
1091 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1094 if (
var()->
type() == dods_enum_c) {
1096 string path = e->enumeration()->name();
1097 if (e->enumeration()->parent()) {
1099 path =
static_cast<D4Group*
>(e->enumeration()->parent()->parent())->
FQN() + path;
1101 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"enum", (
const xmlChar*) path.c_str()) < 0)
1102 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for enum");
1107 for_each(c.
var_begin(), c.
var_end(), PrintD4ConstructorVarXMLWriter(xml, constrained));
1112 for_each(
dim_begin(),
dim_end(), PrintD4ArrayDimXMLWriter(xml, constrained));
1116 for_each(maps()->map_begin(), maps()->map_end(), PrintD4MapXMLWriter(xml));
1118 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1139void Array::print_decl(FILE *out,
string space,
bool print_semi,
bool constraint_info,
bool constrained)
1142 print_decl(oss, space, print_semi, constraint_info, constrained);
1143 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1163void Array::print_decl(ostream &out,
string space,
bool print_semi,
bool constraint_info,
bool constrained)
1165 if (constrained && !
send_p())
return;
1168 var()->
print_decl(out, space,
false, constraint_info, constrained);
1170 for (
Dim_citer i = _shape.begin(); i != _shape.end(); i++) {
1172 if ((*i).name !=
"") {
1173 out <<
id2www((*i).name) <<
" = ";
1176 out << (*i).c_size <<
"]";
1179 out << (*i).size <<
"]";
1194 print_xml_writer_core(xml, constrained,
"Array");
1195 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1204 print_xml_writer_core(xml, constrained,
"Array");
1205 out << xml.get_doc();
1214 print_xml_writer_core(xml, constrained,
"Map");
1215 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1224 print_xml_writer_core(xml, constrained,
"Map");
1225 out << xml.get_doc();
1234 print_xml_writer_core(xml, constrained, tag);
1235 fwrite(xml.get_doc(),
sizeof(
char), xml.get_doc_size(), out);
1244 print_xml_writer_core(xml, constrained, tag);
1245 out << xml.get_doc();
1250 print_xml_writer_core(xml, constrained,
"Array");
1253void Array::print_as_map_xml_writer(
XMLWriter &xml,
bool constrained)
1255 print_xml_writer_core(xml, constrained,
"Map");
1258class PrintArrayDimXMLWriter:
public unary_function<Array::dimension&, void> {
1262 PrintArrayDimXMLWriter(XMLWriter &xml,
bool c) :
1263 xml(xml), d_constrained(c)
1267 void operator()(Array::dimension &d)
1269 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*)
"dimension") < 0)
1270 throw InternalErr(__FILE__, __LINE__,
"Could not write dimension element");
1272 if (!d.name.empty())
1273 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*) d.name.c_str())
1274 < 0)
throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1277 size << (d_constrained ? d.c_size : d.size);
1278 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"size", (
const xmlChar*) size.str().c_str())
1279 < 0)
throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1281 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1282 throw InternalErr(__FILE__, __LINE__,
"Could not end dimension element");
1286void Array::print_xml_writer_core(XMLWriter &xml,
bool constrained,
string tag)
1288 if (constrained && !
send_p())
return;
1290 if (xmlTextWriterStartElement(xml.get_writer(), (
const xmlChar*) tag.c_str()) < 0)
1291 throw InternalErr(__FILE__, __LINE__,
"Could not write " + tag +
" element");
1293 if (!
name().empty())
1294 if (xmlTextWriterWriteAttribute(xml.get_writer(), (
const xmlChar*)
"name", (
const xmlChar*)
name().c_str()) < 0)
1295 throw InternalErr(__FILE__, __LINE__,
"Could not write attribute for name");
1300 string tmp_name = btp->name();
1302 btp->print_xml_writer(xml, constrained);
1303 btp->set_name(tmp_name);
1305 for_each(
dim_begin(),
dim_end(), PrintArrayDimXMLWriter(xml, constrained));
1307 if (xmlTextWriterEndElement(xml.get_writer()) < 0)
1308 throw InternalErr(__FILE__, __LINE__,
"Could not end " + tag +
" element");
1325 uint64_t i =
print_array(oss, index, dims, shape);
1326 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1348 if (shape[0] >= 1) {
1349 for (uint64_t i = 0; i < shape[0] - 1; ++i) {
1350 var_ll(index++)->
print_val(out,
"",
false);
1353 var_ll(index++)->
print_val(out,
"",
false);
1374 for (uint64_t i = 0; i < shape[0] - 1; ++i) {
1375 index =
print_array(out, index, dims - 1, shape + 1);
1379 index =
print_array(out, index, dims - 1, shape + 1);
1392 fwrite(oss.str().data(),
sizeof(
char), oss.str().length(), out);
1409 unsigned int index = 0;
1410 for (
Dim_iter i = _shape.begin(); i != _shape.end() && index <
dimensions(
true); ++i)
1411 shape[index++] = dimension_size_ll(i,
true);
1436 if (!sem) msg =
"An array variable must have dimensions";
1449 stringstream sqr_brkty_stuff;
1451 sqr_brkty_stuff <<
"[";
1453 if(!dim_name.empty()){
1454 sqr_brkty_stuff << dim_name <<
"=";
1456 sqr_brkty_stuff << a.dimension_size_ll(itr,
true) <<
"]";
1458 return sqr_brkty_stuff.str();
1469 bool has_projected_dap4 =
false;
1476 has_projected_dap4 = (
type == libdap::dods_int8_c ) || (
type == dods_uint64_c) || (
type == dods_int64_c);
1477 if(has_projected_dap4) {
1483 return has_projected_dap4;
1497 strm << DapIndent::LMarg <<
"Array::dump - (" << (
void *)
this <<
")" << endl;
1498 DapIndent::Indent();
1500 strm << DapIndent::LMarg <<
"shape:" << endl;
1501 DapIndent::Indent();
1504 unsigned int dim_num = 0;
1505 for (; i != ie; i++) {
1506 strm << DapIndent::LMarg <<
"dimension " << dim_num++ <<
":" << endl;
1507 DapIndent::Indent();
1508 strm << DapIndent::LMarg <<
"name: " << (*i).name << endl;
1509 strm << DapIndent::LMarg <<
"size: " << (*i).size << endl;
1510 strm << DapIndent::LMarg <<
"start: " << (*i).start << endl;
1511 strm << DapIndent::LMarg <<
"stop: " << (*i).stop << endl;
1512 strm << DapIndent::LMarg <<
"stride: " << (*i).stride << endl;
1513 strm << DapIndent::LMarg <<
"constrained size: " << (*i).c_size << endl;
1514 DapIndent::UnIndent();
1516 DapIndent::UnIndent();
1517 DapIndent::UnIndent();
1528 vs_info.filter = my_vs_info.filter;
1530 for (
const auto &def_lev:my_vs_info.deflate_levels)
1531 vs_info.deflate_levels.push_back(def_lev);
1533 for (
const auto &chunk_dim:my_vs_info.chunk_dims)
1534 vs_info.chunk_dims.push_back(chunk_dim);
1536 for (
const auto &vci:my_vs_info.var_chunk_info) {
1538 vci_t.filter_mask = vci.filter_mask;
1539 vci_t.chunk_direct_io_offset = vci.chunk_direct_io_offset;
1540 vci_t.chunk_buffer_size = vci.chunk_buffer_size;
1541 for (
const auto &chunk_coord:vci.chunk_coords)
1542 vci_t.chunk_coords.push_back(chunk_coord);
1543 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 bool is_dap4_projected(std::vector< string > &projected_dap4_inventory)
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 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.
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
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.
Holds a one-dimensional collection of DAP2 data types.
unsigned int width(bool constrained=false) const override
Returns the width of the data, in bytes.
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...
BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr) override
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.