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" 68 #undef CLEAR_LOCAL_DATA 75 void Vector::m_duplicate(
const Vector & v)
77 d_length = v.d_length;
93 if (v.d_compound_buf.empty()) {
94 d_compound_buf = v.d_compound_buf;
99 d_compound_buf.resize(d_length);
100 for (
int i = 0; i < d_length; ++i) {
105 d_compound_buf[i] = v.d_compound_buf[i]->ptr_duplicate();
117 d_capacity = v.d_capacity;
131 switch (d_proto->
type()) {
157 case dods_structure_c:
158 case dods_sequence_c:
164 assert(
"Vector::var: Unrecognized type");
185 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: Logic error: _var is null!");
190 throw InternalErr(__FILE__, __LINE__,
"create_cardinal_data_buffer_for_type: incorrectly used on Vector whose type was not a cardinal (simple data types).");
196 if (numEltsOfType == 0)
200 unsigned int bytesPerElt = d_proto->
width();
201 unsigned int bytesNeeded = bytesPerElt * numEltsOfType;
202 d_buf =
new char[bytesNeeded];
204 d_capacity = numEltsOfType;
219 template<
class CardType>
223 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with negative numElts!");
226 throw InternalErr(__FILE__, __LINE__,
"Logic error: Vector::set_cardinal_values_internal() called with null fromArray!");
230 memcpy(d_buf, fromArray, numElts *
sizeof(CardType));
250 BaseType(n, t, is_dap4), d_length(-1), d_proto(0), d_buf(0), d_compound_buf(0), d_capacity(0)
255 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
279 BaseType(n, d, t, is_dap4), d_length(-1), d_proto(0), d_buf(0), d_compound_buf(0), d_capacity(0)
284 DBG2(cerr <<
"Entering Vector ctor for object: " <<
this << endl);
293 DBG2(cerr <<
"Entering Vector const ctor for object: " <<
this <<
294 endl); DBG2(cerr <<
"RHS: " << &rhs << endl);
301 DBG2(cerr <<
"Entering ~Vector (" <<
this <<
")" << endl);
309 DBG2(cerr <<
"Exiting ~Vector" << endl);
317 dynamic_cast<BaseType &
> (*this) = rhs;
395 DBG2(cerr <<
"Vector::var: Looking for " << name << endl);
401 if (name ==
"" || d_proto->
name() ==
name) {
433 return d_proto->
var(name, s);
454 switch (d_proto->
type()) {
483 case dods_structure_c:
484 case dods_sequence_c:
486 return d_compound_buf[i];
490 throw Error (
"Vector::var: Unrecognized type");
539 throw InternalErr(__FILE__, __LINE__,
"Vector::vec_resize() is applicable to compound types only");
541 d_compound_buf.resize((l > 0) ? l : 0, 0);
563 DBG(cerr <<
"Vector::intern_data: " <<
name() << endl);
570 switch (d_proto->
type()) {
590 throw InternalErr(__FILE__, __LINE__,
"Array of Array not supported.");
593 case dods_structure_c:
594 case dods_sequence_c:
596 DBG(cerr <<
"Vector::intern_data: found ctor" << endl);
602 if (d_compound_buf.capacity() < (unsigned)num)
603 throw InternalErr(__FILE__, __LINE__,
"The capacity of this Vector is less than the number of elements.");
605 for (
int i = 0; i < num; ++i)
611 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
652 switch (d_proto->
type()) {
654 m.put_vector(d_buf, num, *
this);
664 m.put_vector(d_buf, num, d_proto->
width(), *
this);
671 if (d_str.capacity() == 0)
672 throw InternalErr(__FILE__, __LINE__,
"The capacity of the string vector is 0");
676 for (
int i = 0; i < num; ++i)
683 case dods_structure_c:
684 case dods_sequence_c:
688 if (d_compound_buf.capacity() == 0)
689 throw InternalErr(__FILE__, __LINE__,
"The capacity of *this* vector is 0.");
693 for (
int i = 0; i < num && status; ++i)
694 status = status && d_compound_buf[i]->
serialize(eval, dds, m,
false);
699 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
703 #ifdef CLEAR_LOCAL_DATA 732 switch (d_proto->
type()) {
740 um.get_int((
int &) num);
742 DBG(cerr <<
"Vector::deserialize: num = " << num << endl);
743 DBG(cerr <<
"Vector::deserialize: length = " <<
length() << endl);
748 if (num != (
unsigned int)
length())
749 throw InternalErr(__FILE__, __LINE__,
"The server sent declarations and data with mismatched sizes for the variable '" +
name() +
"'.");
751 if (!d_buf || !reuse) {
755 DBG(cerr <<
"Vector::deserialize: allocating " 756 <<
width() <<
" bytes for an array of " 767 if (d_proto->
type() == dods_byte_c)
768 um.get_vector((
char **) &d_buf, num, *
this);
770 um.get_vector((
char **) &d_buf, num, d_proto->
width(), *
this);
772 DBG(cerr <<
"Vector::deserialize: read " << num <<
" elements\n");
778 um.get_int((
int &) num);
783 if (num != (
unsigned int)
length())
784 throw InternalErr(__FILE__, __LINE__,
"The client sent declarations and data with mismatched sizes.");
786 d_str.resize((num > 0) ? num : 0);
789 for (i = 0; i < num; ++i) {
800 case dods_structure_c:
801 case dods_sequence_c:
803 um.get_int((
int &) num);
808 if (num != (
unsigned int)
length())
809 throw InternalErr(__FILE__, __LINE__,
"The client sent declarations and data with mismatched sizes.");
813 for (i = 0; i < num; ++i) {
815 d_compound_buf[i]->deserialize(um, dds);
821 throw InternalErr(__FILE__, __LINE__,
"Unknown type!");
830 switch (d_proto->
type()) {
853 for (int64_t i = 0, e =
length(); i < e; ++i)
854 checksum.
AddData(reinterpret_cast<const uint8_t*>(d_str[i].data()), d_str[i].
length());
858 case dods_structure_c:
859 case dods_sequence_c:
866 throw InternalErr(__FILE__, __LINE__,
"Unknown or unsupported datatype (" + d_proto->
type_name() +
").");
876 switch (d_proto->
type()) {
901 case dods_structure_c:
902 case dods_sequence_c:
905 assert(d_compound_buf.capacity() >= (unsigned)
length());
907 for (
int i = 0, e =
length(); i < e; ++i)
914 throw InternalErr(__FILE__, __LINE__,
"Unknown or unsupported datatype (" + d_proto->
type_name() +
").");
925 if (filter && !eval.eval_selection(dmr,
dataset()))
930 DBG(cerr << __PRETTY_FUNCTION__ <<
", num: " << num << endl);
936 switch (d_proto->
type()) {
954 if (d_proto->
width() == 1)
970 assert((int64_t)d_str.capacity() >= num);
972 for (int64_t i = 0; i < num; ++i)
978 throw InternalErr(__FILE__, __LINE__,
"Array of Array not allowed.");
981 case dods_structure_c:
982 case dods_sequence_c:
983 assert(d_compound_buf.capacity() >= 0);
985 for (int64_t i = 0; i < num; ++i)
986 d_compound_buf[i]->
serialize(m, dmr, filter);
991 throw InternalErr(__FILE__, __LINE__,
"Grid is not part of DAP4.");
994 throw InternalErr(__FILE__, __LINE__,
"Unknown datatype.");
998 #ifdef CLEAR_LOCAL_DATA 1013 DBG(cerr << __FUNCTION__ <<
name() <<
", length(): " <<
length() << endl);
1019 switch (d_proto->
type()) {
1024 um.get_vector((
char *)d_buf,
length());
1033 um.get_vector((
char *)d_buf,
length(), d_proto->
width());
1037 if (d_proto->
width() == 1)
1038 um.get_vector((
char *)d_buf,
length());
1040 um.get_vector((
char *)d_buf,
length(), d_proto->
width());
1043 case dods_float32_c:
1044 um.get_vector_float32((
char *)d_buf,
length());
1047 case dods_float64_c:
1048 um.get_vector_float64((
char *)d_buf,
length());
1054 d_str.resize((len > 0) ? len : 0);
1057 for (int64_t i = 0; i < len; ++i) {
1058 um.get_str(d_str[i]);
1065 throw InternalErr(__FILE__, __LINE__,
"Array of Array not allowed.");
1068 case dods_structure_c:
1069 case dods_sequence_c: {
1072 for (int64_t i = 0, end =
length(); i < end; ++i) {
1074 d_compound_buf[i]->deserialize(um, dmr);
1081 throw InternalErr(__FILE__, __LINE__,
"Grid is not part of DAP4.");
1084 throw InternalErr(__FILE__, __LINE__,
"Unknown type.");
1121 if (!val &&
length() == 0)
1132 throw InternalErr(__FILE__, __LINE__,
"The incoming pointer does not contain any data.");
1134 switch (d_proto->
type()) {
1148 case dods_float32_c:
1149 case dods_float64_c:
1151 if (d_buf && !reuse)
1155 if (!d_buf || !reuse)
1159 memcpy(d_buf, val,
width(
true));
1167 d_str.resize(d_length);
1168 d_capacity = d_length;
1169 for (
int i = 0; i < d_length; ++i)
1170 d_str[i] = *(static_cast<string *> (val) + i);
1175 throw InternalErr(__FILE__, __LINE__,
"Vector::val2buf: bad type");
1217 throw InternalErr(__FILE__, __LINE__,
"NULL pointer.");
1219 unsigned int wid =
static_cast<unsigned int> (
width(
true ));
1226 switch (d_proto->
type()) {
1240 case dods_float32_c:
1241 case dods_float64_c:
1243 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when cardinal type data buffer was empty!");
1245 *val =
new char[wid];
1247 memcpy(*val, d_buf, wid);
1254 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: Logic error: called when string data buffer was empty!");
1256 *val =
new string[d_length];
1258 for (
int i = 0; i < d_length; ++i)
1259 *(static_cast<string *> (*val) + i) = d_str[i];
1266 throw InternalErr(__FILE__, __LINE__,
"Vector::buf2val: bad type");
1309 if (i >= static_cast<unsigned int> (d_length))
1310 throw InternalErr(__FILE__, __LINE__,
"Invalid data: index too large.");
1312 throw InternalErr(__FILE__, __LINE__,
"Invalid data: null pointer to BaseType object.");
1313 if (val->
type() != d_proto->
type())
1314 throw InternalErr(__FILE__, __LINE__,
"invalid data: type of incoming object does not match *this* vector type.");
1316 if (i >= d_compound_buf.capacity())
1319 d_compound_buf[i] = val;
1338 for (
unsigned int i = 0; i < d_compound_buf.size(); ++i) {
1339 delete d_compound_buf[i];
1340 d_compound_buf[i] = 0;
1344 d_compound_buf.resize(0);
1375 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Logic error: _var is null!");
1377 switch (d_proto->
type()) {
1391 case dods_float32_c:
1392 case dods_float64_c:
1401 d_str.reserve(numElements);
1402 d_capacity = numElements;
1406 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Arrays not supported!");
1410 case dods_structure_c:
1411 case dods_sequence_c:
1414 d_compound_buf.reserve(numElements);
1415 d_capacity = numElements;
1419 throw InternalErr(__FILE__, __LINE__,
"reserve_value_capacity: Unknown type!");
1468 static const string funcName =
"set_value_slice_from_row_major_vector:";
1471 Vector& rowMajorData =
const_cast<Vector&
>(rowMajorDataC);
1473 bool typesMatch = rowMajorData.
var() && d_proto && (rowMajorData.
var()->
type() == d_proto->
type());
1475 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: types do not match so cannot be copied!");
1479 if (!rowMajorData.
read_p()) {
1481 funcName +
"Logic error: the Vector to copy data from has !read_p() and should have been read in!");
1485 if (rowMajorData.
length() < 0) {
1488 +
"Logic error: the Vector to copy data from has length() < 0 and was probably not initialized!");
1496 +
"Logic error: the Vector to copy from has a data capacity less than its length, can't copy!");
1501 if (d_capacity < (startElement + rowMajorData.
length())) {
1503 funcName +
"Logic error: the capacity of this Vector cannot hold all the data in the from Vector!");
1507 switch (d_proto->
type()) {
1521 case dods_float32_c:
1522 case dods_float64_c: {
1524 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: this->_buf was unexpectedly null!");
1526 if (!rowMajorData.d_buf) {
1527 throw InternalErr(__FILE__, __LINE__, funcName +
"Logic error: rowMajorData._buf was unexpectedly null!");
1530 int varWidth = d_proto->
width();
1531 char* pFromBuf = rowMajorData.d_buf;
1532 int numBytesToCopy = rowMajorData.
width(
true);
1533 char* pIntoBuf = d_buf + (startElement * varWidth);
1534 memcpy(pIntoBuf, pFromBuf, numBytesToCopy);
1541 for (
unsigned int i = 0; i < static_cast<unsigned int>(rowMajorData.
length()); ++i) {
1542 d_str[startElement + i] = rowMajorData.d_str[i];
1548 case dods_structure_c:
1549 case dods_sequence_c:
1553 funcName +
"Unimplemented method for Vectors of type: array, opaque, structure, sequence or grid.");
1557 throw InternalErr(__FILE__, __LINE__, funcName +
": Unknown type!");
1563 return (
unsigned int) rowMajorData.
length();
1574 template <
typename T>
1575 static bool types_match(
Type t, T *cpp_var)
1581 return typeid(cpp_var) ==
typeid(dods_byte*);
1584 return typeid(cpp_var) ==
typeid(dods_int8*);
1586 return typeid(cpp_var) ==
typeid(dods_int16*);
1588 return typeid(cpp_var) ==
typeid(dods_uint16*);
1590 return typeid(cpp_var) ==
typeid(dods_int32*);
1592 return typeid(cpp_var) ==
typeid(dods_uint32*);
1594 return typeid(cpp_var) ==
typeid(dods_int64*);
1596 return typeid(cpp_var) ==
typeid(dods_uint64*);
1598 case dods_float32_c:
1599 return typeid(cpp_var) ==
typeid(dods_float32*);
1600 case dods_float64_c:
1601 return typeid(cpp_var) ==
typeid(dods_float64*);
1609 case dods_structure_c:
1610 case dods_sequence_c:
1620 template <
typename T>
1621 bool Vector::set_value_worker(T *v,
int sz)
1623 if (!v || !types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1630 bool Vector::set_value(dods_byte *val,
int sz)
1632 return set_value_worker(val, sz);
1634 bool Vector::set_value(dods_int8 *val,
int sz)
1636 return set_value_worker(val, sz);
1638 bool Vector::set_value(dods_int16 *val,
int sz)
1640 return set_value_worker(val, sz);
1642 bool Vector::set_value(dods_uint16 *val,
int sz)
1644 return set_value_worker(val, sz);
1646 bool Vector::set_value(dods_int32 *val,
int sz)
1648 return set_value_worker(val, sz);
1650 bool Vector::set_value(dods_uint32 *val,
int sz)
1652 return set_value_worker(val, sz);
1654 bool Vector::set_value(dods_int64 *val,
int sz)
1656 return set_value_worker(val, sz);
1658 bool Vector::set_value(dods_uint64 *val,
int sz)
1660 return set_value_worker(val, sz);
1662 bool Vector::set_value(dods_float32 *val,
int sz)
1664 return set_value_worker(val, sz);
1666 bool Vector::set_value(dods_float64 *val,
int sz)
1668 return set_value_worker(val, sz);
1672 bool Vector::set_value(
string *val,
int sz)
1674 if ((
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) && val) {
1677 for (
register int t = 0; t < sz; t++) {
1689 template<
typename T>
1690 bool Vector::set_value_worker(vector<T> &v,
int sz)
1692 return set_value(&v[0], sz);
1695 bool Vector::set_value(vector<dods_byte> &val,
int sz)
1697 return set_value_worker(val, sz);
1699 bool Vector::set_value(vector<dods_int8> &val,
int sz)
1701 return set_value_worker(val, sz);
1703 bool Vector::set_value(vector<dods_int16> &val,
int sz)
1705 return set_value_worker(val, sz);
1707 bool Vector::set_value(vector<dods_uint16> &val,
int sz)
1709 return set_value_worker(val, sz);
1711 bool Vector::set_value(vector<dods_int32> &val,
int sz)
1713 return set_value_worker(val, sz);
1715 bool Vector::set_value(vector<dods_uint32> &val,
int sz)
1717 return set_value_worker(val, sz);
1719 bool Vector::set_value(vector<dods_int64> &val,
int sz)
1721 return set_value_worker(val, sz);
1723 bool Vector::set_value(vector<dods_uint64> &val,
int sz)
1725 return set_value_worker(val, sz);
1727 bool Vector::set_value(vector<dods_float32> &val,
int sz)
1729 return set_value_worker(val, sz);
1731 bool Vector::set_value(vector<dods_float64> &val,
int sz)
1733 return set_value_worker(val, sz);
1738 bool Vector::set_value(vector<string> &val,
int sz)
1740 if (
var()->
type() == dods_str_c ||
var()->
type() == dods_url_c) {
1743 for (
register int t = 0; t < sz; t++) {
1774 template <
typename T>
1775 void Vector::value_worker(vector<unsigned int> *indices, T *b)
const 1780 for (vector<unsigned int>::iterator i = indices->begin(), e = indices->end(); i != e; ++i) {
1781 unsigned long currentIndex = *i;
1782 if(currentIndex > (
unsigned int)
length()){
1784 s <<
"Vector::value() - Subset index[" << i - subsetIndex->begin() <<
"] = " << currentIndex <<
" references a value that is " <<
1785 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1786 throw Error(s.str());
1788 b[i - indices->begin()] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1791 for (
unsigned long i = 0, e = indices->size(); i < e; ++i) {
1792 unsigned long currentIndex = (*indices)[i];
1793 if (currentIndex > (
unsigned int)
length()) {
1795 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1796 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1797 throw Error(s.str());
1799 b[i] =
reinterpret_cast<T*
>(d_buf )[currentIndex];
1802 void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const { value_worker(indices, b); }
1803 void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const { value_worker(indices, b); }
1804 void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const { value_worker(indices, b); }
1805 void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const { value_worker(indices, b); }
1806 void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const { value_worker(indices, b); }
1807 void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const { value_worker(indices, b); }
1808 void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const { value_worker(indices, b); }
1809 void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const { value_worker(indices, b); }
1810 void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const { value_worker(indices, b); }
1811 void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const { value_worker(indices, b); }
1814 template void Vector::value(vector<unsigned int> *indices, dods_byte *b)
const;
1815 template void Vector::value(vector<unsigned int> *indices, dods_int8 *b)
const;
1816 template void Vector::value(vector<unsigned int> *indices, dods_int16 *b)
const;
1817 template void Vector::value(vector<unsigned int> *indices, dods_uint16 *b)
const;
1818 template void Vector::value(vector<unsigned int> *indices, dods_int32 *b)
const;
1819 template void Vector::value(vector<unsigned int> *indices, dods_uint32 *b)
const;
1820 template void Vector::value(vector<unsigned int> *indices, dods_int64 *b)
const;
1821 template void Vector::value(vector<unsigned int> *indices, dods_uint64 *b)
const;
1822 template void Vector::value(vector<unsigned int> *indices, dods_float32 *b)
const;
1823 template void Vector::value(vector<unsigned int> *indices, dods_float64 *b)
const;
1829 unsigned long currentIndex;
1831 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c){
1832 for(
unsigned long i=0; i<subsetIndex->size() ;++i){
1833 currentIndex = (*subsetIndex)[i] ;
1834 if(currentIndex > (
unsigned int)
length()){
1836 s <<
"Vector::value() - Subset index[" << i <<
"] = " << currentIndex <<
" references a value that is " <<
1837 "outside the bounds of the internal storage [ length()= " <<
length() <<
" ] name: '" <<
name() <<
"'. ";
1838 throw Error(s.str());
1840 b[i] = d_str[currentIndex];
1845 template <
typename T>
1846 void Vector::value_worker(T *v)
const 1850 if (v && types_match(d_proto->
type() == dods_enum_c ?
static_cast<D4Enum*
>(d_proto)->element_type() : d_proto->
type(), v))
1851 memcpy(v, d_buf,
length() *
sizeof(T));
1855 void Vector::value(dods_int16 *b)
const { value_worker(b); }
1856 void Vector::value(dods_uint16 *b)
const { value_worker(b); }
1857 void Vector::value(dods_int32 *b)
const { value_worker(b); }
1858 void Vector::value(dods_uint32 *b)
const { value_worker(b); }
1859 void Vector::value(dods_int64 *b)
const { value_worker(b); }
1860 void Vector::value(dods_uint64 *b)
const { value_worker(b); }
1861 void Vector::value(dods_float32 *b)
const { value_worker(b); }
1862 void Vector::value(dods_float64 *b)
const { value_worker(b); }
1881 if (d_proto->
type() == dods_str_c || d_proto->
type() == dods_url_c)
1889 void *buffer =
new char[
width(
true)];
1891 memcpy(buffer, d_buf,
width(
true));
1939 if (!v->
name().empty())
1946 DBG(cerr <<
"Vector::add_var: Added variable " << v <<
" (" 1970 if (!v->
name().empty())
1977 DBG(cerr <<
"Vector::add_var_no_copy: Added variable " << v <<
" (" 1997 strm << DapIndent::LMarg <<
"Vector::dump - (" << (
void *)
this <<
")" << endl;
1998 DapIndent::Indent();
2000 strm << DapIndent::LMarg <<
"# elements in vector: " << d_length << endl;
2002 strm << DapIndent::LMarg <<
"base type:" << endl;
2003 DapIndent::Indent();
2004 d_proto->
dump(strm);
2005 DapIndent::UnIndent();
2008 strm << DapIndent::LMarg <<
"base type: not set" << endl;
2010 strm << DapIndent::LMarg <<
"vector contents:" << endl;
2011 DapIndent::Indent();
2012 for (
unsigned i = 0; i < d_compound_buf.size(); ++i) {
2013 if (d_compound_buf[i])
2014 d_compound_buf[i]->dump(strm);
2016 strm << DapIndent::LMarg <<
"vec[" << i <<
"] is null" << endl;
2018 DapIndent::UnIndent();
2019 strm << DapIndent::LMarg <<
"strings:" << endl;
2020 DapIndent::Indent();
2021 for (
unsigned i = 0; i < d_str.size(); i++) {
2022 strm << DapIndent::LMarg << d_str[i] << endl;
2024 DapIndent::UnIndent();
2026 switch (d_proto != 0 ? d_proto->
type() : 0) {
2029 strm << DapIndent::LMarg <<
"_buf: ";
2030 strm.write(d_buf, d_length);
2036 strm << DapIndent::LMarg <<
"_buf: " << (
void *) d_buf << endl;
2041 strm << DapIndent::LMarg <<
"_buf: EMPTY" << endl;
2044 DapIndent::UnIndent();
virtual bool read()
Read data into a local buffer.
virtual bool read_p()
Has this variable been read?
abstract base class used to unmarshall/deserialize dap data objects
virtual unsigned int width(bool constrained=false) const
How many bytes does this use Return the number of bytes of storage this variable uses. For scalar types, this is pretty simple (an int32 uses 4 bytes, etc.). For arrays and Constructors, it is a bit more complex. Note that a scalar String variable uses sizeof(String*) bytes, not the length of the string. In other words, the value returned is independent of the type. Also note width() of a String array returns the number of elements in the array times sizeof(String*). That is, each different array size is a different data type.
virtual unsigned int get_value_capacity() const
void set_vec(unsigned int i, BaseType *val)
Sets element i to value val.
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 void dump(ostream &strm) const
dumps information about this object
virtual void intern_data()
Read data into this variable.
virtual void clear_local_data()
Read data from the stream made by D4StreamMarshaller.
virtual int length() const
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 Type type() const
Returns the type of the class instance.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
Serialize a Vector.
virtual void set_parent(BaseType *parent)
A class for software fault reporting.
virtual string dataset() const
Returns the name of the dataset used to create this instance.
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...
virtual string type_name() const
Returns the type of the class instance as a string.
Holds a DAP4 enumeration.
virtual bool is_constructor_type() const
Returns true if the instance is a constructor (i.e., Structure, Sequence or Grid) type variable...
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)
void set_vec_nocopy(unsigned int i, BaseType *val)
Sets element i to value val.
virtual void dump(ostream &strm) const
dumps information about this object
bool m_is_cardinal_type() const
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. Thrown if called for Structure, Sequence or Grid.
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 string name() const
Returns the name of the class instance.
virtual BaseType * ptr_duplicate()=0
string www2id(const string &in, const string &escape, const string &except)
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 void set_name(const std::string &name)
Sets the name of the class instance.
virtual unsigned int buf2val(void **val)
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans 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
Returns the width of the data, in bytes.
virtual bool check_semantics(string &msg, bool all=false)
Compare an object's current state with the semantics of its type.