53#include "Marshaller.h"
54#include "UnMarshaller.h"
56#include "D4StreamMarshaller.h"
57#include "D4StreamUnMarshaller.h"
62#include "dods-datatypes.h"
66#include "InternalErr.h"
69#undef CLEAR_LOCAL_DATA
76void Vector::m_duplicate(
const Vector & v)
78 d_length = v.d_length;
84 if (d_proto)
delete d_proto;
96 if (v.d_compound_buf.empty()) {
97 d_compound_buf = v.d_compound_buf;
102 d_compound_buf.resize(d_length);
103 for (
int i = 0; i < d_length; ++i) {
108 d_compound_buf[i] = v.d_compound_buf[i]->ptr_duplicate();
120 d_capacity = v.d_capacity;
134 switch (d_proto->
type()) {
159 case dods_structure_c:
160 case dods_sequence_c:
165 assert(
"Vector::var: Unrecognized type");
186 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: Logic error: _var is null!");
191 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: incorrectly used on Vector whose type was not a cardinal (simple data types).");
197 if (numEltsOfType == 0)
201 unsigned int bytesPerElt = d_proto->
width();
202 unsigned int bytesNeeded = bytesPerElt * numEltsOfType;
203 d_buf =
new char[bytesNeeded];
205 d_capacity = numEltsOfType;
220template<
class CardType>
224 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with negative numElts!");
227 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with null fromArray!");
232 memcpy(d_buf, fromArray, numElts *
sizeof(CardType));
257 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
286 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
295 DBG2(cerr <<
"Entering Vector const ctor for object: " <<
this <<
296 endl); DBG2(cerr <<
"RHS: " << &rhs << endl);
303 DBG2(cerr <<
"Entering ~Vector (" <<
this <<
")" << endl);
311 DBG2(cerr <<
"Exiting ~Vector" << endl);
314Vector & Vector::operator=(
const Vector & rhs)
318 BaseType::operator=(rhs);
366 switch (d_proto->
type()) {
367 case dods_structure_c:
368 case dods_sequence_c:
370 if (d_compound_buf.size() > 0) {
371 for (
unsigned long long i = 0; i < (unsigned) d_length; ++i) {
372 if (d_compound_buf[i]) d_compound_buf[i]->set_send_p(state);
397 switch (d_proto->
type()) {
398 case dods_structure_c:
399 case dods_sequence_c:
401 if (d_compound_buf.size() > 0) {
402 for (
unsigned long long i = 0; i < (unsigned)d_length; ++i) {
403 if (d_compound_buf[i]) d_compound_buf[i]->set_read_p(state);
436 DBG2(cerr <<
"Vector::var: Looking for " <<
name << endl);
493 switch (d_proto->
type()) {
520 case dods_structure_c:
521 case dods_sequence_c:
523 return d_compound_buf[i];
526 throw Error (
"Vector::var: Unrecognized type");
572 throw InternalErr(__FILE__, __LINE__,
"Vector::vec_resize() is applicable to compound types only");
577 d_compound_buf.resize(l, 0);
578 d_capacity = d_compound_buf.size();
599 DBG(cerr <<
"Vector::intern_data: " <<
name() << endl);
606 switch (d_proto->
type()) {
626 throw InternalErr(__FILE__, __LINE__,
"Array of Array not supported.");
628 case dods_structure_c:
629 case dods_sequence_c:
631 DBG(cerr <<
"Vector::intern_data: found ctor" << endl);
637 if (d_compound_buf.capacity() < (
unsigned)num)
638 throw InternalErr(__FILE__, __LINE__,
"The capacity of this Vector is less than the number of elements.");
640 for (
int i = 0; i < num; ++i)
646 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
681 switch (d_proto->
type()) {
683 m.put_vector(d_buf, num, *
this);
693 m.put_vector(d_buf, num, d_proto->
width(), *
this);
700 if (d_str.capacity() == 0)
701 throw InternalErr(__FILE__, __LINE__,
"The capacity of the string vector is 0");
705 for (
int i = 0; i < num; ++i)
712 case dods_structure_c:
713 case dods_sequence_c:
717 if (d_compound_buf.capacity() == 0)
718 throw InternalErr(__FILE__, __LINE__,
"The capacity of *this* vector is 0.");
722 for (
int i = 0; i < num && status; ++i)
723 status = status && d_compound_buf[i]->
serialize(eval, dds, m,
false);
728 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
731#ifdef CLEAR_LOCAL_DATA
760 switch (d_proto->
type()) {
768 um.get_int((
int &) num);
770 DBG(cerr <<
"Vector::deserialize: num = " << num << endl);
771 DBG(cerr <<
"Vector::deserialize: length = " <<
length() << endl);
776 if (num != (
unsigned int)
length())
777 throw InternalErr(__FILE__, __LINE__,
"The server sent declarations and data with mismatched sizes for the variable '" +
name() +
"'.");
779 if (!d_buf || !reuse) {
783 DBG(cerr <<
"Vector::deserialize: allocating "
784 <<
width() <<
" bytes for an array of "
795 if (d_proto->
type() == dods_byte_c)
796 um.get_vector((
char **) &d_buf, num, *
this);
798 um.get_vector((
char **) &d_buf, num, d_proto->
width(), *
this);
800 DBG(cerr <<
"Vector::deserialize: read " << num <<
" elements\n");
806 um.get_int((
int &) num);
811 if (num != (
unsigned int)
length())
812 throw InternalErr(__FILE__, __LINE__,
"The client sent declarations and data with mismatched sizes.");
814 d_str.resize((num > 0) ? num : 0);
817 for (i = 0; i < num; ++i) {
829 throw InternalErr(__FILE__, __LINE__,
"Array of array!");
831 case dods_structure_c:
832 case dods_sequence_c:
834 um.get_int((
int &) num);
839 if (num != (
unsigned int)
length())
840 throw InternalErr(__FILE__, __LINE__,
"The client sent declarations and data with mismatched sizes.");
844 for (i = 0; i < num; ++i) {
846 d_compound_buf[i]->deserialize(um, dds);
852 throw InternalErr(__FILE__, __LINE__,
"Unknown type!");
860 switch (d_proto->
type()) {
883 for (int64_t i = 0, e =
length(); i < e; ++i)
884 checksum.
AddData(
reinterpret_cast<const uint8_t*
>(d_str[i].data()), d_str[i].length());
888 case dods_structure_c:
889 case dods_sequence_c:
896 throw InternalErr(__FILE__, __LINE__,
"Unknown or unsupported datatype (" + d_proto->
type_name() +
").");
905 switch (d_proto->
type()) {
930 case dods_structure_c:
931 case dods_sequence_c:
934 assert(d_compound_buf.capacity() >= (
unsigned)
length());
936 for (
int i = 0, e =
length(); i < e; ++i)
943 throw InternalErr(__FILE__, __LINE__,
"Unknown or unsupported datatype (" + d_proto->
type_name() +
").");
953 if (filter && !eval.eval_selection(dmr,
dataset()))
958 DBG(cerr << __func__ <<
", num: " << num << endl);
964 switch (d_proto->
type()) {
969 m.put_vector(d_buf, num);
978 m.put_vector(d_buf, num, d_proto->
width());
982 if (d_proto->
width() == 1)
983 m.put_vector(d_buf, num);
985 m.put_vector(d_buf, num, d_proto->
width());
989 m.put_vector_float32(d_buf, num);
993 m.put_vector_float64(d_buf, num);
998 assert((int64_t)d_str.capacity() >= num);
1000 for (int64_t i = 0; i < num; ++i)
1001 m.put_str(d_str[i]);
1006 throw InternalErr(__FILE__, __LINE__,
"Array of Array not allowed.");
1009 case dods_structure_c:
1010 case dods_sequence_c:
1011 assert(d_compound_buf.capacity() >= 0);
1013 for (int64_t i = 0; i < num; ++i) {
1014 DBG(cerr << __func__ <<
"d_compound_buf[" << i <<
"] " << d_compound_buf[i] << endl);
1015 d_compound_buf[i]->serialize(m, dmr, filter);
1021 throw InternalErr(__FILE__, __LINE__,
"Grid is not part of DAP4.");
1024 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
1027#ifdef CLEAR_LOCAL_DATA
1042 DBG(cerr << __FUNCTION__ <<
name() <<
", length(): " <<
length() << endl);
1048 switch (d_proto->
type()) {
1053 um.get_vector((
char *)d_buf,
length());
1062 um.get_vector((
char *)d_buf,
length(), d_proto->
width());
1066 if (d_proto->
width() == 1)
1067 um.get_vector((
char *)d_buf,
length());
1069 um.get_vector((
char *)d_buf,
length(), d_proto->
width());
1072 case dods_float32_c:
1073 um.get_vector_float32((
char *)d_buf,
length());
1076 case dods_float64_c:
1077 um.get_vector_float64((
char *)d_buf,
length());
1083 d_str.resize((len > 0) ? len : 0);
1086 for (int64_t i = 0; i < len; ++i) {
1087 um.get_str(d_str[i]);
1094 throw InternalErr(__FILE__, __LINE__,
"Array of Array not allowed.");
1097 case dods_structure_c:
1098 case dods_sequence_c: {
1101 for (int64_t i = 0, end =
length(); i < end; ++i) {
1103 d_compound_buf[i]->deserialize(um, dmr);
1110 throw InternalErr(__FILE__, __LINE__,
"Grid is not part of DAP4.");
1113 throw InternalErr(__FILE__, __LINE__,
"Unknown type.");
1149 if (!val &&
length() == 0)
1160 throw InternalErr(__FILE__, __LINE__,
"The incoming pointer does not contain any data.");
1162 switch (d_proto->
type()) {
1176 case dods_float32_c:
1177 case dods_float64_c:
1179 if (d_buf && !reuse)
1183 if (!d_buf || !reuse)
1188 memcpy(d_buf, val,
width(
true));
1196 d_str.resize(d_length);
1197 d_capacity = d_length;
1198 for (
int i = 0; i < d_length; ++i)
1199 d_str[i] = *(
static_cast<string *
> (val) + i);
1204 throw InternalErr(__FILE__, __LINE__,
"Vector::val2buf: bad type");
1254 throw InternalErr(__FILE__, __LINE__,
"NULL pointer.");
1256 unsigned int wid =
static_cast<unsigned int> (
width(
true ));
1263 switch (d_proto->
type()) {
1277 case dods_float32_c:
1278 case dods_float64_c:
1280 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when cardinal type data buffer was empty!");
1282 *val =
new char[wid];
1284 memcpy(*val, d_buf, wid);
1290 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when string data buffer was empty!");
1292 *val =
new string[d_length];
1294 for (
int i = 0; i < d_length; ++i)
1295 *(
static_cast<string *
> (*val) + i) = d_str[i];
1301 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: bad type");
1349 if (i >=
static_cast<unsigned int> (d_length))
1350 throw InternalErr(__FILE__, __LINE__,
"Invalid data: index too large.");
1352 throw InternalErr(__FILE__, __LINE__,
"Invalid data: null pointer to BaseType object.");
1353 if (val->type() != d_proto->
type())
1354 throw InternalErr(__FILE__, __LINE__,
"invalid data: type of incoming object does not match *this* vector type.");
1364 if (i >= d_compound_buf.size()) {
1368 d_compound_buf[i] = val;
1387 for (
unsigned int i = 0; i < d_compound_buf.size(); ++i) {
1388 delete d_compound_buf[i];
1389 d_compound_buf[i] = 0;
1393 d_compound_buf.resize(0);
1424 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Logic error: _var is null!");
1426 switch (d_proto->
type()) {
1440 case dods_float32_c:
1441 case dods_float64_c:
1450 d_str.reserve(numElements);
1451 d_capacity = numElements;
1455 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Arrays not supported!");
1458 case dods_structure_c:
1459 case dods_sequence_c:
1462 d_compound_buf.reserve(numElements);
1463 d_capacity = numElements;
1467 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Unknown type!");
1514 static const string funcName =
"set_value_slice_from_row_major_vector:";
1517 Vector& rowMajorData =
const_cast<Vector&
>(rowMajorDataC);
1519 bool typesMatch = rowMajorData.
var() && d_proto && (rowMajorData.var()->type() == d_proto->
type());
1521 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: types do not match so cannot be copied!");
1525 if (!rowMajorData.read_p()) {
1527 funcName +
"Logic error: the Vector to copy data from has !read_p() and should have been read in!");
1531 if (rowMajorData.length() < 0) {
1534 +
"Logic error: the Vector to copy data from has length() < 0 and was probably not initialized!");
1539 if (rowMajorData.get_value_capacity() <
static_cast<unsigned int>(rowMajorData.length())) {
1542 +
"Logic error: the Vector to copy from has a data capacity less than its length, can't copy!");
1547 if (d_capacity < (startElement + rowMajorData.length())) {
1549 funcName +
"Logic error: the capacity of this Vector cannot hold all the data in the from Vector!");
1553 switch (d_proto->
type()) {
1567 case dods_float32_c:
1568 case dods_float64_c: {
1570 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: this->_buf was unexpectedly null!");
1572 if (!rowMajorData.d_buf) {
1573 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: rowMajorData._buf was unexpectedly null!");
1576 int varWidth = d_proto->
width();
1577 char* pFromBuf = rowMajorData.d_buf;
1578 int numBytesToCopy = rowMajorData.width(
true);
1579 char* pIntoBuf = d_buf + (startElement * varWidth);
1580 memcpy(pIntoBuf, pFromBuf, numBytesToCopy);
1587 for (
unsigned int i = 0; i < static_cast<unsigned int>(rowMajorData.length()); ++i) {
1588 d_str[startElement + i] = rowMajorData.d_str[i];
1594 case dods_structure_c:
1595 case dods_sequence_c:
1599 funcName +
"Unimplemented method for Vectors of type: array, opaque, structure, sequence or grid.");
1602 throw InternalErr(__FILE__, __LINE__, funcName +
": Unknown type!");
1606 return (
unsigned int) rowMajorData.length();
1617template <
typename T>
1618static bool types_match(
Type t, T *cpp_var)
1624 return typeid(cpp_var) ==
typeid(dods_byte*);
1627 return typeid(cpp_var) ==
typeid(dods_int8*);
1629 return typeid(cpp_var) ==
typeid(dods_int16*);
1631 return typeid(cpp_var) ==
typeid(dods_uint16*);
1633 return typeid(cpp_var) ==
typeid(dods_int32*);
1635 return typeid(cpp_var) ==
typeid(dods_uint32*);
1637 return typeid(cpp_var) ==
typeid(dods_int64*);
1639 return typeid(cpp_var) ==
typeid(dods_uint64*);
1641 case dods_float32_c:
1642 return typeid(cpp_var) ==
typeid(dods_float32*);
1643 case dods_float64_c:
1644 return typeid(cpp_var) ==
typeid(dods_float64*);
1652 case dods_structure_c:
1653 case dods_sequence_c:
1663template <
typename T>
1664bool Vector::set_value_worker(T *v,
int sz)
1666 if (!v || !types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1673bool Vector::set_value(dods_byte *val,
int sz)
1675 return set_value_worker(val, sz);
1677bool Vector::set_value(dods_int8 *val,
int sz)
1679 return set_value_worker(val, sz);
1681bool Vector::set_value(dods_int16 *val,
int sz)
1683 return set_value_worker(val, sz);
1685bool Vector::set_value(dods_uint16 *val,
int sz)
1687 return set_value_worker(val, sz);
1689bool Vector::set_value(dods_int32 *val,
int sz)
1691 return set_value_worker(val, sz);
1693bool Vector::set_value(dods_uint32 *val,
int sz)
1695 return set_value_worker(val, sz);
1697bool Vector::set_value(dods_int64 *val,
int sz)
1699 return set_value_worker(val, sz);
1701bool Vector::set_value(dods_uint64 *val,
int sz)
1703 return set_value_worker(val, sz);
1705bool Vector::set_value(dods_float32 *val,
int sz)
1707 return set_value_worker(val, sz);
1709bool Vector::set_value(dods_float64 *val,
int sz)
1711 return set_value_worker(val, sz);
1721bool Vector::set_value(
string *val,
int sz)
1723 if ((
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) && val) {
1726 for (
int t = 0; t < sz; t++) {
1739bool Vector::set_value_worker(vector<T> &v,
int sz)
1741 return set_value(v.data(), sz);
1744bool Vector::set_value(vector<dods_byte> &val,
int sz)
1746 return set_value_worker(val, sz);
1748bool Vector::set_value(vector<dods_int8> &val,
int sz)
1750 return set_value_worker(val, sz);
1752bool Vector::set_value(vector<dods_int16> &val,
int sz)
1754 return set_value_worker(val, sz);
1756bool Vector::set_value(vector<dods_uint16> &val,
int sz)
1758 return set_value_worker(val, sz);
1760bool Vector::set_value(vector<dods_int32> &val,
int sz)
1762 return set_value_worker(val, sz);
1764bool Vector::set_value(vector<dods_uint32> &val,
int sz)
1766 return set_value_worker(val, sz);
1768bool Vector::set_value(vector<dods_int64> &val,
int sz)
1770 return set_value_worker(val, sz);
1772bool Vector::set_value(vector<dods_uint64> &val,
int sz)
1774 return set_value_worker(val, sz);
1776bool Vector::set_value(vector<dods_float32> &val,
int sz)
1778 return set_value_worker(val, sz);
1780bool Vector::set_value(vector<dods_float64> &val,
int sz)
1782 return set_value_worker(val, sz);
1787bool Vector::set_value(vector<string> &val,
int sz)
1789 if (
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) {
1792 for (
int t = 0; t < sz; t++) {
1823template <
typename T>
1824void Vector::value_worker(vector<unsigned int> *indices, T *b)
const
1829 for (vector<unsigned int>::iterator i = indices->begin(), e = indices->end(); i != e; ++i) {
1830 unsigned long currentIndex = *i;
1831 if(currentIndex > (
unsigned int)
length()){
1833 s <<
"Vector::value() - Subset index[" << i - subsetIndex->begin() <<
"] = " << currentIndex <<
" references a value that is " <<
1834 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1835 throw Error(s.str());
1837 b[i - indices->begin()] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1840 for (
unsigned long i = 0, e = indices->size(); i < e; ++i) {
1841 unsigned long currentIndex = (*indices)[i];
1842 if (currentIndex > (
unsigned int)
length()) {
1844 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1845 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1846 throw Error(s.str());
1848 b[i] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1851void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const { value_worker(indices, b); }
1852void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const { value_worker(indices, b); }
1853void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const { value_worker(indices, b); }
1854void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const { value_worker(indices, b); }
1855void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const { value_worker(indices, b); }
1856void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const { value_worker(indices, b); }
1857void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const { value_worker(indices, b); }
1858void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const { value_worker(indices, b); }
1859void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const { value_worker(indices, b); }
1860void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const { value_worker(indices, b); }
1863template void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const;
1864template void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const;
1865template void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const;
1866template void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const;
1867template void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const;
1868template void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const;
1869template void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const;
1870template void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const;
1871template void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const;
1872template void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const;
1878 unsigned long currentIndex;
1880 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c){
1881 for(
unsigned long i=0; i<subsetIndex->size() ;++i){
1882 currentIndex = (*subsetIndex)[i] ;
1883 if(currentIndex > (
unsigned int)
length()){
1885 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1886 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1887 throw Error(s.str());
1889 b[i] = d_str[currentIndex];
1894template <
typename T>
1895void Vector::value_worker(T *v)
const
1899 if (v && types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1900 memcpy(v, d_buf,
length() * sizeof(T));
1905void Vector::value(dods_uint16 *b)
const { value_worker(b); }
1907void Vector::value(dods_uint32 *b)
const { value_worker(b); }
1909void Vector::value(dods_uint64 *b)
const { value_worker(b); }
1910void Vector::value(dods_float32 *b)
const { value_worker(b); }
1911void Vector::value(dods_float64 *b)
const { value_worker(b); }
1930 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c)
1938 void *buffer =
new char[
width(
true)];
1940 memcpy(buffer, d_buf,
width(
true));
1965 Vector::add_var_nocopy(v->ptr_duplicate(), p);
1966 add_var_nocopy(v->ptr_duplicate(), p);
1967 add_var_nocopy(v->ptr_duplicate());
1988 if (!v->name().empty())
1995 DBG(cerr <<
"Vector::add_var: Added variable " << v <<
" ("
1996 << v->name() <<
" " << v->type_name() <<
")" << endl);
2019 if (!v->name().empty())
2026 DBG(cerr <<
"Vector::add_var_no_copy: Added variable " << v <<
" ("
2027 << v->name() <<
" " << v->type_name() <<
")" << endl);
2046 strm << DapIndent::LMarg <<
"Vector::dump - (" << (
void *)
this <<
")" << endl;
2047 DapIndent::Indent();
2049 strm << DapIndent::LMarg <<
"# elements in vector: " << d_length << endl;
2051 strm << DapIndent::LMarg <<
"base type:" << endl;
2052 DapIndent::Indent();
2053 d_proto->
dump(strm);
2054 DapIndent::UnIndent();
2057 strm << DapIndent::LMarg <<
"base type: not set" << endl;
2059 strm << DapIndent::LMarg <<
"vector contents:" << endl;
2060 DapIndent::Indent();
2061 for (
unsigned i = 0; i < d_compound_buf.size(); ++i) {
2062 if (d_compound_buf[i])
2063 d_compound_buf[i]->dump(strm);
2065 strm << DapIndent::LMarg <<
"vec[" << i <<
"] is null" << endl;
2067 DapIndent::UnIndent();
2068 strm << DapIndent::LMarg <<
"strings:" << endl;
2069 DapIndent::Indent();
2070 for (
unsigned i = 0; i < d_str.size(); i++) {
2071 strm << DapIndent::LMarg << d_str[i] << endl;
2073 DapIndent::UnIndent();
2075 switch (d_proto != 0 ? d_proto->
type() : 0) {
2078 strm << DapIndent::LMarg <<
"_buf: ";
2079 strm.write(d_buf, d_length);
2085 strm << DapIndent::LMarg <<
"_buf: " << (
void *) d_buf << endl;
2090 strm << DapIndent::LMarg <<
"_buf: EMPTY" << endl;
2093 DapIndent::UnIndent();
void AddData(const uint8_t *pData, const uint32_t length)
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 bool read()
Read data into a local buffer.
virtual string name() const
Returns the name of the class instance.
virtual bool read_p()
Has this variable been read?
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 void set_read_p(bool state)
Sets the value of the read_p property.
virtual string dataset() const
Returns the name of the dataset used to create this instance.
virtual void set_parent(BaseType *parent)
virtual int element_count(bool leaves=false)
Count the members of constructor types.
void dump(ostream &strm) const override
dumps information about this object
virtual void set_name(const string &n)
Sets the name of the class instance.
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable.
virtual void set_send_p(bool state)
virtual BaseType * ptr_duplicate()=0
virtual unsigned int val2buf(void *val, bool reuse=false)=0
Loads class data.
virtual void compute_checksum(Crc32 &checksum)=0
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr)
Returns a pointer to a member of a constructor class.
virtual Type type() const
Returns the type of the class instance.
Evaluate a constraint expression.
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator and is called ...
Holds a DAP4 enumeration.
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Read data from the stream made by D4StreamMarshaller.
A class for error processing.
A class for software fault reporting.
abstract base class used to marshal/serialize dap data objects
abstract base class used to unmarshall/deserialize dap data objects
Holds a one-dimensional collection of DAP2 data types.
virtual void add_var(BaseType *v, Part p=nil)
Add the BaseType pointer to this constructor type instance.
virtual void set_length(int l)
virtual unsigned int get_value_capacity() const
void set_vec_nocopy(unsigned int i, BaseType *val)
Sets element i to value val. Set the ith element to val. Extend the vector if needed.
void m_set_cardinal_values_internal(const CardType *fromArray, int numElts)
virtual int length() const
virtual unsigned int set_value_slice_from_row_major_vector(const Vector &rowMajorData, unsigned int startElement)
virtual void set_read_p(bool state)
Indicates that the data is ready to send.
virtual void set_send_p(bool state)
Indicates that the data is ready to send.
void set_vec(unsigned int i, BaseType *val)
Sets element i to value val.
virtual unsigned int width(bool constrained=false) const
Returns the width of the data, in bytes.
virtual unsigned int val2buf(void *val, bool reuse=false)
Reads data into the Vector buffer.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Serialize a Vector.
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
virtual void dump(ostream &strm) const
dumps information about this object
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
virtual void set_name(const std::string &name)
Sets the name of the class instance.
virtual int element_count(bool leaves)
Count the members of constructor types.
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
virtual void intern_data()
Read data into this variable.
bool m_is_cardinal_type() const
virtual void clear_local_data()
void m_delete_cardinal_data_buffer()
virtual void reserve_value_capacity()
unsigned int m_create_cardinal_data_buffer_for_type(unsigned int numEltsOfType)
virtual unsigned int buf2val(void **val)
Copies data from the Vector buffer.
Vector(const string &n, BaseType *v, const Type &t, bool is_dap4=false)
The Vector constructor.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
top level DAP object to house generic methods
Type
Identifies the data type.
string www2id(const string &in, const string &escape, const string &except)
Part
Names the parts of multi-section constructor data types.