57XDRFileMarshaller::XDRFileMarshaller(FILE *out)
63XDRFileMarshaller::XDRFileMarshaller()
66 throw InternalErr(__FILE__, __LINE__,
"Default constructor not implemented.");
69XDRFileMarshaller::XDRFileMarshaller(
const XDRFileMarshaller &m)
70 : Marshaller(m), _sink(0)
72 throw InternalErr(__FILE__, __LINE__,
"Copy constructor not implemented.");
76 throw InternalErr(__FILE__, __LINE__,
"Copy operator not implemented.");
82 if (!xdr_char(_sink, (
char *)&val))
83 throw Error(
"Network I/O Error. Could not send byte data.\nThis may be due to a bug in DODS, on the server or "
84 "a\nproblem with the network connection.");
89 throw Error(
"Network I/O Error. Could not send int 16 data.\nThis may be due to a bug in libdap, on the server "
90 "or a\nproblem with the network connection.");
95 throw Error(
"Network I/O Error. Could not read int 32 data.\nThis may be due to a bug in libdap, on the server "
96 "or a\nproblem with the network connection.");
100 if (!xdr_float(_sink, &val))
101 throw Error(
"Network I/O Error. Could not send float 32 data.\nThis may be due to a bug in libdap, on the "
102 "server or a\nproblem with the network connection.");
106 if (!xdr_double(_sink, &val))
107 throw Error(
"Network I/O Error. Could not send float 64 data.\nThis may be due to a bug in libdap, on the "
108 "server or a\nproblem with the network connection.");
113 throw Error(
"Network I/O Error. Could not send uint 16 data.");
118 throw Error(
"Network I/O Error. Could not send uint 32 data.");
122 const char *out_tmp = val.c_str();
124 if (!xdr_string(_sink, (
char **)&out_tmp,
max_str_len))
125 throw Error(
"Network I/O Error. Could not send string data.");
131 if (!xdr_opaque(_sink, val, len))
132 throw Error(
"Network I/O Error. Could not send opaque data.");
136 if (!xdr_int(_sink, &val))
137 throw Error(
"Network I/O Error(1).");
142 throw InternalErr(__FILE__, __LINE__,
"Buffer pointer is not set.");
146 if (!xdr_bytes(_sink, (
char **)&val, (
unsigned int *)&num,
DODS_MAX_ARRAY)) {
147 throw Error(
"Network I/O Error(2).");
153 throw InternalErr(__FILE__, __LINE__,
"Buffer pointer is not set.");
158 if (!xdr_array(_sink, (
char **)&val, (
unsigned int *)&num,
DODS_MAX_ARRAY, width,
160 throw Error(
"Network I/O Error(2).");
165 strm <<
DapIndent::LMarg <<
"XDRFileMarshaller::dump - (" << (
void *)
this <<
")" << endl;
XDR * new_xdrstdio(FILE *stream, enum xdr_op xop)
void delete_xdrstdio(XDR *xdr)
The basic data type for the DODS DAP types.
virtual Type type() const
Returns the type of the class instance.
static ostream & LMarg(ostream &strm)
A class for error processing.
A class for software fault reporting.
abstract base class used to marshal/serialize dap data objects
Holds a one-dimensional collection of DAP2 data types.
BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr) override
marshaller that knows how to marshall/serialize dap data objects to a file using XDR
virtual ~XDRFileMarshaller()
virtual void put_float64(dods_float64 val)
virtual void put_int16(dods_int16 val)
virtual void put_opaque(char *val, unsigned int len)
virtual void put_int32(dods_int32 val)
virtual void put_str(const string &val)
virtual void put_url(const string &val)
virtual void put_uint32(dods_uint32 val)
virtual void put_vector(char *val, int num, Vector &vec)
virtual void put_uint16(dods_uint16 val)
virtual void dump(ostream &strm) const
dump the contents of this object to the specified ostream
virtual void put_byte(dods_byte val)
virtual void put_int(int val)
virtual void put_float32(dods_float32 val)
static xdrproc_t xdr_coder(const Type &t)
Returns a function used to encode elements of an array.
top level DAP object to house generic methods
const unsigned int max_str_len