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" 67 #include "DapIndent.h" 69 #undef CLEAR_LOCAL_DATA 76 void Vector::m_duplicate(
const Vector & v)
78 d_length = v.d_length;
94 if (v.d_compound_buf.empty()) {
95 d_compound_buf = v.d_compound_buf;
100 d_compound_buf.resize(d_length);
101 for (
int i = 0; i < d_length; ++i) {
106 d_compound_buf[i] = v.d_compound_buf[i]->ptr_duplicate();
118 d_capacity = v.d_capacity;
132 switch (d_proto->
type()) {
157 case dods_structure_c:
158 case dods_sequence_c:
163 assert(
"Vector::var: Unrecognized type");
184 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: Logic error: _var is null!");
189 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: incorrectly used on Vector whose type was not a cardinal (simple data types).");
195 if (numEltsOfType == 0)
199 unsigned int bytesPerElt = d_proto->
width();
200 unsigned int bytesNeeded = bytesPerElt * numEltsOfType;
201 d_buf =
new char[bytesNeeded];
203 d_capacity = numEltsOfType;
218 template<
class CardType>
222 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with negative numElts!");
225 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with null fromArray!");
229 memcpy(d_buf, fromArray, numElts *
sizeof(CardType));
249 BaseType(n, t, is_dap4), d_length(-1), d_proto(0), d_buf(0), d_compound_buf(0), d_capacity(0)
254 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
278 BaseType(n, d, t, is_dap4), d_length(-1), d_proto(0), d_buf(0), d_compound_buf(0), d_capacity(0)
283 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
292 DBG2(cerr <<
"Entering Vector const ctor for object: " <<
this <<
293 endl); DBG2(cerr <<
"RHS: " << &rhs << endl);
300 DBG2(cerr <<
"Entering ~Vector (" <<
this <<
")" << endl);
308 DBG2(cerr <<
"Exiting ~Vector" << endl);
316 dynamic_cast<BaseType &
> (*this) = 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);
438 if (name ==
"" || d_proto->
name() ==
name) {
472 return d_proto->
var(name, s);
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()) {
982 if (d_proto->
width() == 1)
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)
1187 memcpy(d_buf, val,
width(
true));
1195 d_str.resize(d_length);
1196 d_capacity = d_length;
1197 for (
int i = 0; i < d_length; ++i)
1198 d_str[i] = *(static_cast<string *> (val) + i);
1203 throw InternalErr(__FILE__, __LINE__,
"Vector::val2buf: bad type");
1253 throw InternalErr(__FILE__, __LINE__,
"NULL pointer.");
1255 unsigned int wid =
static_cast<unsigned int> (
width(
true ));
1262 switch (d_proto->
type()) {
1276 case dods_float32_c:
1277 case dods_float64_c:
1279 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when cardinal type data buffer was empty!");
1281 *val =
new char[wid];
1283 memcpy(*val, d_buf, wid);
1289 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when string data buffer was empty!");
1291 *val =
new string[d_length];
1293 for (
int i = 0; i < d_length; ++i)
1294 *(static_cast<string *> (*val) + i) = d_str[i];
1300 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: bad type");
1348 if (i >= static_cast<unsigned int> (d_length))
1349 throw InternalErr(__FILE__, __LINE__,
"Invalid data: index too large.");
1351 throw InternalErr(__FILE__, __LINE__,
"Invalid data: null pointer to BaseType object.");
1352 if (val->
type() != d_proto->
type())
1353 throw InternalErr(__FILE__, __LINE__,
"invalid data: type of incoming object does not match *this* vector type.");
1363 if (i >= d_compound_buf.size()) {
1367 d_compound_buf[i] = val;
1386 for (
unsigned int i = 0; i < d_compound_buf.size(); ++i) {
1387 delete d_compound_buf[i];
1388 d_compound_buf[i] = 0;
1392 d_compound_buf.resize(0);
1423 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Logic error: _var is null!");
1425 switch (d_proto->
type()) {
1439 case dods_float32_c:
1440 case dods_float64_c:
1449 d_str.reserve(numElements);
1450 d_capacity = numElements;
1454 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Arrays not supported!");
1457 case dods_structure_c:
1458 case dods_sequence_c:
1461 d_compound_buf.reserve(numElements);
1462 d_capacity = numElements;
1466 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Unknown type!");
1513 static const string funcName =
"set_value_slice_from_row_major_vector:";
1516 Vector& rowMajorData =
const_cast<Vector&
>(rowMajorDataC);
1518 bool typesMatch = rowMajorData.
var() && d_proto && (rowMajorData.
var()->
type() == d_proto->
type());
1520 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: types do not match so cannot be copied!");
1524 if (!rowMajorData.
read_p()) {
1526 funcName +
"Logic error: the Vector to copy data from has !read_p() and should have been read in!");
1530 if (rowMajorData.
length() < 0) {
1533 +
"Logic error: the Vector to copy data from has length() < 0 and was probably not initialized!");
1541 +
"Logic error: the Vector to copy from has a data capacity less than its length, can't copy!");
1546 if (d_capacity < (startElement + rowMajorData.
length())) {
1548 funcName +
"Logic error: the capacity of this Vector cannot hold all the data in the from Vector!");
1552 switch (d_proto->
type()) {
1566 case dods_float32_c:
1567 case dods_float64_c: {
1569 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: this->_buf was unexpectedly null!");
1571 if (!rowMajorData.d_buf) {
1572 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: rowMajorData._buf was unexpectedly null!");
1575 int varWidth = d_proto->
width();
1576 char* pFromBuf = rowMajorData.d_buf;
1577 int numBytesToCopy = rowMajorData.
width(
true);
1578 char* pIntoBuf = d_buf + (startElement * varWidth);
1579 memcpy(pIntoBuf, pFromBuf, numBytesToCopy);
1586 for (
unsigned int i = 0; i < static_cast<unsigned int>(rowMajorData.
length()); ++i) {
1587 d_str[startElement + i] = rowMajorData.d_str[i];
1593 case dods_structure_c:
1594 case dods_sequence_c:
1598 funcName +
"Unimplemented method for Vectors of type: array, opaque, structure, sequence or grid.");
1601 throw InternalErr(__FILE__, __LINE__, funcName +
": Unknown type!");
1605 return (
unsigned int) rowMajorData.
length();
1616 template <
typename T>
1617 static bool types_match(
Type t, T *cpp_var)
1623 return typeid(cpp_var) ==
typeid(dods_byte*);
1626 return typeid(cpp_var) ==
typeid(dods_int8*);
1628 return typeid(cpp_var) ==
typeid(dods_int16*);
1630 return typeid(cpp_var) ==
typeid(dods_uint16*);
1632 return typeid(cpp_var) ==
typeid(dods_int32*);
1634 return typeid(cpp_var) ==
typeid(dods_uint32*);
1636 return typeid(cpp_var) ==
typeid(dods_int64*);
1638 return typeid(cpp_var) ==
typeid(dods_uint64*);
1640 case dods_float32_c:
1641 return typeid(cpp_var) ==
typeid(dods_float32*);
1642 case dods_float64_c:
1643 return typeid(cpp_var) ==
typeid(dods_float64*);
1651 case dods_structure_c:
1652 case dods_sequence_c:
1662 template <
typename T>
1663 bool Vector::set_value_worker(T *v,
int sz)
1665 if (!v || !types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1672 bool Vector::set_value(dods_byte *val,
int sz)
1674 return set_value_worker(val, sz);
1676 bool Vector::set_value(dods_int8 *val,
int sz)
1678 return set_value_worker(val, sz);
1680 bool Vector::set_value(dods_int16 *val,
int sz)
1682 return set_value_worker(val, sz);
1684 bool Vector::set_value(dods_uint16 *val,
int sz)
1686 return set_value_worker(val, sz);
1688 bool Vector::set_value(dods_int32 *val,
int sz)
1690 return set_value_worker(val, sz);
1692 bool Vector::set_value(dods_uint32 *val,
int sz)
1694 return set_value_worker(val, sz);
1696 bool Vector::set_value(dods_int64 *val,
int sz)
1698 return set_value_worker(val, sz);
1700 bool Vector::set_value(dods_uint64 *val,
int sz)
1702 return set_value_worker(val, sz);
1704 bool Vector::set_value(dods_float32 *val,
int sz)
1706 return set_value_worker(val, sz);
1708 bool Vector::set_value(dods_float64 *val,
int sz)
1710 return set_value_worker(val, sz);
1720 bool Vector::set_value(
string *val,
int sz)
1722 if ((
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) && val) {
1725 for (
int t = 0; t < sz; t++) {
1726 d_str[t] = (*val)[t];
1737 template<
typename T>
1738 bool Vector::set_value_worker(vector<T> &v,
int sz)
1740 return set_value(&v[0], sz);
1743 bool Vector::set_value(vector<dods_byte> &val,
int sz)
1745 return set_value_worker(val, sz);
1747 bool Vector::set_value(vector<dods_int8> &val,
int sz)
1749 return set_value_worker(val, sz);
1751 bool Vector::set_value(vector<dods_int16> &val,
int sz)
1753 return set_value_worker(val, sz);
1755 bool Vector::set_value(vector<dods_uint16> &val,
int sz)
1757 return set_value_worker(val, sz);
1759 bool Vector::set_value(vector<dods_int32> &val,
int sz)
1761 return set_value_worker(val, sz);
1763 bool Vector::set_value(vector<dods_uint32> &val,
int sz)
1765 return set_value_worker(val, sz);
1767 bool Vector::set_value(vector<dods_int64> &val,
int sz)
1769 return set_value_worker(val, sz);
1771 bool Vector::set_value(vector<dods_uint64> &val,
int sz)
1773 return set_value_worker(val, sz);
1775 bool Vector::set_value(vector<dods_float32> &val,
int sz)
1777 return set_value_worker(val, sz);
1779 bool Vector::set_value(vector<dods_float64> &val,
int sz)
1781 return set_value_worker(val, sz);
1786 bool Vector::set_value(vector<string> &val,
int sz)
1788 if (
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) {
1791 for (
int t = 0; t < sz; t++) {
1822 template <
typename T>
1823 void Vector::value_worker(vector<unsigned int> *indices, T *b)
const 1828 for (vector<unsigned int>::iterator i = indices->begin(), e = indices->end(); i != e; ++i) {
1829 unsigned long currentIndex = *i;
1830 if(currentIndex > (
unsigned int)
length()){
1832 s <<
"Vector::value() - Subset index[" << i - subsetIndex->begin() <<
"] = " << currentIndex <<
" references a value that is " <<
1833 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1834 throw Error(s.str());
1836 b[i - indices->begin()] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1839 for (
unsigned long i = 0, e = indices->size(); i < e; ++i) {
1840 unsigned long currentIndex = (*indices)[i];
1841 if (currentIndex > (
unsigned int)
length()) {
1843 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1844 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1845 throw Error(s.str());
1847 b[i] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1850 void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const { value_worker(indices, b); }
1851 void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const { value_worker(indices, b); }
1852 void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const { value_worker(indices, b); }
1853 void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const { value_worker(indices, b); }
1854 void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const { value_worker(indices, b); }
1855 void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const { value_worker(indices, b); }
1856 void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const { value_worker(indices, b); }
1857 void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const { value_worker(indices, b); }
1858 void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const { value_worker(indices, b); }
1859 void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const { value_worker(indices, b); }
1862 template void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const;
1863 template void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const;
1864 template void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const;
1865 template void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const;
1866 template void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const;
1867 template void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const;
1868 template void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const;
1869 template void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const;
1870 template void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const;
1871 template void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const;
1877 unsigned long currentIndex;
1879 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c){
1880 for(
unsigned long i=0; i<subsetIndex->size() ;++i){
1881 currentIndex = (*subsetIndex)[i] ;
1882 if(currentIndex > (
unsigned int)
length()){
1884 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1885 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1886 throw Error(s.str());
1888 b[i] = d_str[currentIndex];
1893 template <
typename T>
1894 void Vector::value_worker(T *v)
const 1898 if (v && types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1899 memcpy(v, d_buf,
length() *
sizeof(T));
1903 void Vector::value(dods_int16 *b)
const { value_worker(b); }
1904 void Vector::value(dods_uint16 *b)
const { value_worker(b); }
1905 void Vector::value(dods_int32 *b)
const { value_worker(b); }
1906 void Vector::value(dods_uint32 *b)
const { value_worker(b); }
1907 void Vector::value(dods_int64 *b)
const { value_worker(b); }
1908 void Vector::value(dods_uint64 *b)
const { value_worker(b); }
1909 void Vector::value(dods_float32 *b)
const { value_worker(b); }
1910 void Vector::value(dods_float64 *b)
const { value_worker(b); }
1929 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c)
1937 void *buffer =
new char[
width(
true)];
1939 memcpy(buffer, d_buf,
width(
true));
1987 if (!v->
name().empty())
1994 DBG(cerr <<
"Vector::add_var: Added variable " << v <<
" (" 2018 if (!v->
name().empty())
2025 DBG(cerr <<
"Vector::add_var_no_copy: Added variable " << v <<
" (" 2045 strm << DapIndent::LMarg <<
"Vector::dump - (" << (
void *)
this <<
")" << endl;
2046 DapIndent::Indent();
2048 strm << DapIndent::LMarg <<
"# elements in vector: " << d_length << endl;
2050 strm << DapIndent::LMarg <<
"base type:" << endl;
2051 DapIndent::Indent();
2052 d_proto->
dump(strm);
2053 DapIndent::UnIndent();
2056 strm << DapIndent::LMarg <<
"base type: not set" << endl;
2058 strm << DapIndent::LMarg <<
"vector contents:" << endl;
2059 DapIndent::Indent();
2060 for (
unsigned i = 0; i < d_compound_buf.size(); ++i) {
2061 if (d_compound_buf[i])
2062 d_compound_buf[i]->dump(strm);
2064 strm << DapIndent::LMarg <<
"vec[" << i <<
"] is null" << endl;
2066 DapIndent::UnIndent();
2067 strm << DapIndent::LMarg <<
"strings:" << endl;
2068 DapIndent::Indent();
2069 for (
unsigned i = 0; i < d_str.size(); i++) {
2070 strm << DapIndent::LMarg << d_str[i] << endl;
2072 DapIndent::UnIndent();
2074 switch (d_proto != 0 ? d_proto->
type() : 0) {
2077 strm << DapIndent::LMarg <<
"_buf: ";
2078 strm.write(d_buf, d_length);
2084 strm << DapIndent::LMarg <<
"_buf: " << (
void *) d_buf << endl;
2089 strm << DapIndent::LMarg <<
"_buf: EMPTY" << endl;
2092 DapIndent::UnIndent();
virtual bool read()
Read data into a local buffer.
virtual bool read_p()
Has this variable been read?
virtual string name() const
Returns the name of the class instance.
abstract base class used to unmarshall/deserialize dap data objects
void set_vec(unsigned int i, BaseType *val)
Sets element i to value val.
virtual void dump(ostream &strm) const
dumps information about this object
Part
Names the parts of multi-section constructor data types.
virtual void set_name(const string &n)
Sets the name of the class instance.
Holds a one-dimensional collection of DAP2 data types.
virtual unsigned int width(bool constrained=false) const
Returns the width of the data, in bytes.
virtual void intern_data()
Read data into this variable.
virtual void clear_local_data()
Read data from the stream made by D4StreamMarshaller.
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 set_read_p(bool state)
Indicates that the data is ready to send.
virtual void add_var(BaseType *v, Part p=nil)
Add the BaseType pointer to this constructor type instance.
virtual int element_count(bool leaves)
Count the members of constructor types.
void m_set_cardinal_values_internal(const CardType *fromArray, int numElts)
virtual unsigned int set_value_slice_from_row_major_vector(const Vector &rowMajorData, unsigned int startElement)
virtual void put_vector_float32(char *val, int64_t num_elem)
Write a fixed size vector.
Type
Identifies the data type.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Serialize a Vector.
virtual void set_parent(BaseType *parent)
top level DAP object to house generic methods
A class for software fault reporting.
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
Receive data from the net.
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 void compute_checksum(Crc32 &checksum)=0
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
Holds a DAP4 enumeration.
virtual int element_count(bool leaves=false)
Count the members of constructor types.
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
virtual void set_send_p(bool state)
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
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.
bool m_is_cardinal_type() const
virtual Type type() const
Returns the type of the class instance.
virtual void reserve_value_capacity()
virtual void set_read_p(bool state)
Sets the value of the read_p property.
Vector(const string &n, BaseType *v, const Type &t, bool is_dap4=false)
The Vector constructor.
virtual unsigned int val2buf(void *val, bool reuse=false)
Reads data into the Vector buffer.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.
void m_delete_cardinal_data_buffer()
void AddData(const uint8_t *pData, const uint32_t length)
virtual unsigned int val2buf(void *val, bool reuse=false)=0
Loads class data.
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
virtual unsigned int get_value_capacity() const
Evaluate a constraint expression.
virtual void set_send_p(bool state)
Indicates that the data is ready to send.
unsigned int m_create_cardinal_data_buffer_for_type(unsigned int numEltsOfType)
virtual void put_vector(char *val, int64_t num_bytes)
Write a fixed size vector.
The basic data type for the DODS DAP types.
abstract base class used to marshal/serialize dap data objects
virtual string type_name() const
Returns the type of the class instance as a string.
virtual void set_name(const std::string &name)
Sets the name of the class instance.
virtual int length() const
virtual unsigned int buf2val(void **val)
Copies data from the Vector buffer.
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 ...
virtual void set_length(int l)
A class for error processing.
virtual void put_vector_float64(char *val, int64_t num_elem)
Write a fixed size vector of float64s.
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 dump(ostream &strm) const
dumps information about this object
virtual string dataset() const
Returns the name of the dataset used to create this instance.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.