libdap++
Updated for version 3.14.0
|
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiver-makes-right scheme. This code adds checksums to the stream and uses the xdr library to encode real values if the underlying representation is not IEEE 754. It also supports computing the checksum only. More...
#include <D4StreamMarshaller.h>
Public Member Functions | |
virtual void | checksum_update (const void *data, unsigned long len) |
D4StreamMarshaller (std::ostream &out, bool write_data=true) | |
virtual void | dump (std::ostream &strm) const |
dump the contents of this object to the specified ostream More... | |
virtual string | get_checksum () |
virtual void | put_byte (dods_byte val) |
virtual void | put_checksum () |
Write the checksum Write the checksum for the data sent since the last call to reset_checksum() to the I/O stream associated with this marshaller. Use this to send the checksum, not get_checksum(). More... | |
virtual void | put_count (int64_t count) |
virtual void | put_float32 (dods_float32 val) |
virtual void | put_float64 (dods_float64 val) |
virtual void | put_int (int) |
virtual void | put_int16 (dods_int16 val) |
virtual void | put_int32 (dods_int32 val) |
virtual void | put_int64 (dods_int64 val) |
virtual void | put_int8 (dods_int8 val) |
virtual void | put_opaque (char *, unsigned int) |
virtual void | put_opaque_dap4 (const char *val, int64_t len) |
virtual void | put_str (const string &val) |
virtual void | put_uint16 (dods_uint16 val) |
virtual void | put_uint32 (dods_uint32 val) |
virtual void | put_uint64 (dods_uint64 val) |
virtual void | put_url (const string &val) |
virtual void | put_vector (char *val, int64_t num_bytes) |
Write a fixed size vector. More... | |
virtual void | put_vector (char *val, int64_t num_elem, int elem_size) |
virtual void | put_vector (char *, int, Vector &) |
virtual void | put_vector (char *, int, int, Vector &) |
virtual void | put_vector_float32 (char *val, int64_t num_elem) |
Write a fixed size vector. More... | |
virtual void | put_vector_float64 (char *val, int64_t num_elem) |
Write a fixed size vector of float64s. More... | |
virtual void | reset_checksum () |
virtual | ~D4StreamMarshaller () |
Definition at line 70 of file D4StreamMarshaller.h.
libdap::D4StreamMarshaller::D4StreamMarshaller | ( | std::ostream & | out, |
bool | write_data = true |
||
) |
Build an instance of D4StreamMarshaller. Bind the C++ stream out to this instance. If the write_data parameter is true, write the data in addition to computing and sending the checksum.
out | Write to this stream object. |
write_data | If true, write data values. True by default |
Definition at line 185 of file D4StreamMarshaller.cc.
|
virtual |
Definition at line 202 of file D4StreamMarshaller.cc.
|
virtual |
Definition at line 247 of file D4StreamMarshaller.cc.
References Crc32::AddData().
Referenced by put_byte(), put_float32(), put_float64(), put_int16(), put_int32(), put_int64(), put_int8(), put_opaque_dap4(), put_str(), put_uint16(), put_uint32(), put_uint64(), put_vector(), put_vector_float32(), and put_vector_float64().
|
virtual |
This method is implemented by all derived classes to dump their contents, in other words, any state they might have, private variables, etc...
strm | C++ i/o stream to dump the object to |
Implements libdap::Marshaller.
Definition at line 597 of file D4StreamMarshaller.cc.
References libdap::DapIndent::LMarg().
|
virtual |
Get the current checksum. It is not possible to continue computing the checksum once this has been called.
Definition at line 226 of file D4StreamMarshaller.cc.
References Crc32::GetCrc32().
Referenced by libdap::D4Group::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 252 of file D4StreamMarshaller.cc.
References checksum_update(), and DBG.
Referenced by libdap::Byte::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Definition at line 241 of file D4StreamMarshaller.cc.
References Crc32::GetCrc32().
Referenced by libdap::D4Group::serialize().
|
virtual |
Used only for Sequences, where the count must be added to the stream and then the fields sent using separate calls to methods here. The methods put_opaque_dap4(), ..., that need counts sent as prefixes to their data handle it themselves.
count | How many elements follow. |
Definition at line 411 of file D4StreamMarshaller.cc.
Referenced by libdap::D4Sequence::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 298 of file D4StreamMarshaller.cc.
References checksum_update(), and libdap::is_host_big_endian().
Referenced by libdap::Float32::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 341 of file D4StreamMarshaller.cc.
References checksum_update(), and libdap::is_host_big_endian().
Referenced by libdap::Float64::serialize().
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 129 of file D4StreamMarshaller.h.
|
virtual |
Implements libdap::Marshaller.
Definition at line 274 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Int16::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 282 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Int32::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Definition at line 290 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Int64::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Definition at line 263 of file D4StreamMarshaller.cc.
References checksum_update(), and DBG.
Referenced by libdap::Int8::serialize(), and libdap::D4Enum::serialize().
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 122 of file D4StreamMarshaller.h.
|
virtual |
Definition at line 433 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::D4Opaque::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 416 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by put_url(), libdap::Str::serialize(), and libdap::Vector::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 379 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::UInt16::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 387 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::UInt32::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Definition at line 395 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::UInt64::serialize(), and libdap::D4Enum::serialize().
|
virtual |
Implements libdap::Marshaller.
Definition at line 428 of file D4StreamMarshaller.cc.
References put_str().
|
virtual |
val | Pointer to the data |
num | Number of bytes to write |
Definition at line 448 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Vector::serialize().
|
virtual |
Definition at line 456 of file D4StreamMarshaller.cc.
References checksum_update().
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 138 of file D4StreamMarshaller.h.
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 141 of file D4StreamMarshaller.h.
|
virtual |
val | Pointer to the data |
num | Number of elements |
width | Size of a single element |
type | DAP variable type; used to handle float32 and float64 types correctly |
Definition at line 502 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Vector::serialize().
|
virtual |
val | Pointer to the data |
num | Number of elements |
width | Size of a single element |
type | DAP variable type; used to handle float32 and float64 types correctly |
Definition at line 555 of file D4StreamMarshaller.cc.
References checksum_update().
Referenced by libdap::Vector::serialize().
|
virtual |
Initialize the checksum buffer. This resets the checksum calculation.
Definition at line 211 of file D4StreamMarshaller.cc.
References Crc32::Reset().
Referenced by libdap::D4Group::serialize().