libdap
Updated for version 3.17.0
|
00001 // XDRStreamMarshaller.h 00002 00003 // -*- mode: c++; c-basic-offset:4 -*- 00004 00005 // This file is part of libdap, A C++ implementation of the OPeNDAP Data 00006 // Access Protocol. 00007 00008 // Copyright (c) 2002,2003 OPeNDAP, Inc. 00009 // Author: Patrick West <pwest@ucar.edu> 00010 // 00011 // This library is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU Lesser General Public 00013 // License as published by the Free Software Foundation; either 00014 // version 2.1 of the License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00024 // 00025 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112. 00026 00027 // (c) COPYRIGHT URI/MIT 1994-1999 00028 // Please read the full copyright statement in the file COPYRIGHT_URI. 00029 // 00030 // Authors: 00031 // pwest Patrick West <pwest@ucar.edu> 00032 00033 // Hacked massively to add all kinds of things, including pthred support. 00034 // jhrg 8/21/15 00035 00036 #ifndef I_XDRStreamMarshaller_h 00037 #define I_XDRStreamMarshaller_h 1 00038 00039 #include <iostream> 00040 00041 #include "Marshaller.h" 00042 #include "XDRUtils.h" 00043 00044 00045 namespace libdap { 00046 00047 class BaseType; 00048 class MarshallerThread; 00049 00054 class XDRStreamMarshaller: public Marshaller { 00055 private: 00056 static char * d_buf; 00057 XDR d_sink; 00058 ostream & d_out; 00059 00060 int d_partial_put_byte_count; 00061 00062 MarshallerThread *tm; 00063 00064 XDRStreamMarshaller(); 00065 XDRStreamMarshaller(const XDRStreamMarshaller &m); 00066 XDRStreamMarshaller &operator=(const XDRStreamMarshaller &); 00067 00068 void put_vector(char *val, unsigned int num, int width, Type type); 00069 00070 friend class MarshallerTest; 00071 friend class MarshallerThread; 00072 00073 public: 00074 XDRStreamMarshaller(ostream &out); //, bool checksum = false, bool write_data = true) ; 00075 virtual ~XDRStreamMarshaller(); 00076 00077 virtual void put_byte(dods_byte val); 00078 00079 virtual void put_int16(dods_int16 val); 00080 virtual void put_int32(dods_int32 val); 00081 00082 virtual void put_float32(dods_float32 val); 00083 virtual void put_float64(dods_float64 val); 00084 00085 virtual void put_uint16(dods_uint16 val); 00086 virtual void put_uint32(dods_uint32 val); 00087 00088 virtual void put_str(const string &val); 00089 virtual void put_url(const string &val); 00090 00091 virtual void put_opaque(char *val, unsigned int len); 00092 virtual void put_int(int val); 00093 00094 virtual void put_vector(char *val, int num, Vector &vec); 00095 virtual void put_vector(char *val, int num, int width, Vector &vec); 00096 00097 virtual void put_vector_start(int num); 00098 virtual void put_vector_part(char *val, unsigned int num, int width, Type type); 00099 virtual void put_vector_end(); 00100 00101 virtual void dump(ostream &strm) const; 00102 }; 00103 00104 } // namespace libdap 00105 00106 #endif // I_XDRStreamMarshaller_h 00107