libdap++
Updated for version 3.12.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 <DAP4StreamMarshaller.h>
Public Member Functions | |
virtual void | checksum_update (const void *data, unsigned long len) |
virtual bool | checksums () const |
DAP4StreamMarshaller (ostream &out, bool write_data=true) | |
virtual void | dump (ostream &strm) const |
dump the contents of this object to the specified ostream More... | |
virtual string | get_checksum () |
virtual string | get_endian () const |
virtual void | put_byte (dods_byte val) |
void | put_checksum () |
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_length_prefix (dods_uint64 val) |
virtual void | put_opaque (char *val, unsigned int 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_varying_vector (char *val, unsigned int num) |
virtual void | put_varying_vector (char *val, unsigned int num, int width, Type type) |
virtual void | put_vector (char *val, unsigned int num) |
virtual void | put_vector (char *val, unsigned int num, int width, Type type) |
virtual void | put_vector (char *, int, Vector &) |
virtual void | put_vector (char *, int, int, Vector &) |
virtual void | reset_checksum () |
virtual | ~DAP4StreamMarshaller () |
Static Public Attributes | |
static const unsigned int | c_md5_length = 16 |
Definition at line 59 of file DAP4StreamMarshaller.h.
libdap::DAP4StreamMarshaller::DAP4StreamMarshaller | ( | ostream & | out, |
bool | write_data = true |
||
) |
Build an instance of DAP4StreamMarshaller. Bind the C++ stream out to this instance. If the checksum parameter is true, initialize a checksum buffer and enable the use of the reset_checksum() and get_checksum() methods.
out | Write to this stream object. |
write_data | If true, write data values. True by default |
Definition at line 153 of file DAP4StreamMarshaller.cc.
|
virtual |
Definition at line 172 of file DAP4StreamMarshaller.cc.
|
virtual |
Definition at line 256 of file DAP4StreamMarshaller.cc.
Referenced by put_byte(), put_float32(), put_float64(), put_int16(), put_int32(), put_int64(), put_int8(), put_opaque(), put_str(), put_uint16(), put_uint32(), put_uint64(), and put_vector().
|
inlinevirtual |
Definition at line 94 of file DAP4StreamMarshaller.h.
|
virtual |
This method is implemented by all derived classes to dump their contents, in other words, any state they might have, private variables, etc...
The inline function below can be used to dump the contents of an OPeNDAOObj object. For example, the object Animal is derived from DapObj. A user could do the following:
Animal *a = new dog( "Sparky" ) ; cout << a << endl ;
And the dump method for dog could display the name passed into the constructor, the (this) pointer of the object, etc...
strm | C++ i/o stream to dump the object to |
Implements libdap::Marshaller.
Definition at line 541 of file DAP4StreamMarshaller.cc.
References libdap::DapIndent::LMarg().
|
virtual |
Get the current checksum. It is not possible to continue computing the checksum once this has been called.
InternalErr | if called when the object was created without checksum support or if called when the checksum has already been returned. |
Definition at line 232 of file DAP4StreamMarshaller.cc.
References c_md5_length.
|
virtual |
Return the is the host big- or little-endian?
Definition at line 189 of file DAP4StreamMarshaller.cc.
|
virtual |
Implements libdap::Marshaller.
Definition at line 267 of file DAP4StreamMarshaller.cc.
References checksum_update(), and DBG.
void libdap::DAP4StreamMarshaller::put_checksum | ( | ) |
Definition at line 247 of file DAP4StreamMarshaller.cc.
References c_md5_length.
|
virtual |
Implements libdap::Marshaller.
Definition at line 313 of file DAP4StreamMarshaller.cc.
References checksum_update(), and DBG2.
|
virtual |
Implements libdap::Marshaller.
Definition at line 344 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 126 of file DAP4StreamMarshaller.h.
|
virtual |
Implements libdap::Marshaller.
Definition at line 289 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Implements libdap::Marshaller.
Definition at line 297 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Definition at line 305 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Definition at line 278 of file DAP4StreamMarshaller.cc.
References checksum_update(), and DBG.
|
virtual |
Definition at line 423 of file DAP4StreamMarshaller.cc.
References DBG2, and libdap::WriteVarint64ToArrayInline().
Referenced by put_opaque(), put_str(), and put_varying_vector().
|
virtual |
Implements libdap::Marshaller.
Definition at line 413 of file DAP4StreamMarshaller.cc.
References checksum_update(), and put_length_prefix().
Referenced by put_varying_vector().
|
virtual |
Implements libdap::Marshaller.
Definition at line 398 of file DAP4StreamMarshaller.cc.
References checksum_update(), and put_length_prefix().
Referenced by put_url().
|
virtual |
Implements libdap::Marshaller.
Definition at line 373 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Implements libdap::Marshaller.
Definition at line 381 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Definition at line 389 of file DAP4StreamMarshaller.cc.
References checksum_update().
|
virtual |
Implements libdap::Marshaller.
Definition at line 408 of file DAP4StreamMarshaller.cc.
References put_str().
|
virtual |
Write a vector of values prefixed by the number of elements. This is a special version for vectors of bytes and it calls put_opaque()
val | Pointer to the data to write |
num | The number of elements to write |
Definition at line 453 of file DAP4StreamMarshaller.cc.
References put_opaque().
|
virtual |
Write a vector of values prefixed by the number of elements.
val | Pointer to the data to write |
num | The number of elements to write |
width | The number of bytes in each element |
type | The DAP type code (used only for float32 and float64 values). |
Definition at line 535 of file DAP4StreamMarshaller.cc.
References put_length_prefix(), and put_vector().
|
virtual |
Definition at line 436 of file DAP4StreamMarshaller.cc.
References checksum_update().
Referenced by put_varying_vector().
|
virtual |
Definition at line 506 of file DAP4StreamMarshaller.cc.
References checksum_update(), libdap::dods_float32_c, and libdap::dods_float64_c.
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 141 of file DAP4StreamMarshaller.h.
|
inlinevirtual |
Implements libdap::Marshaller.
Definition at line 144 of file DAP4StreamMarshaller.h.
|
virtual |
Initialize the checksum buffer. This resets the checksum calculation.
InternalErr | if called when the object was created without checksum support. |
Definition at line 198 of file DAP4StreamMarshaller.cc.
|
static |
Definition at line 61 of file DAP4StreamMarshaller.h.
Referenced by get_checksum(), and put_checksum().