libdap  Updated for version 3.17.0
XDRStreamUnMarshaller.h
00001 // XDRStreamUnMarshaller.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 #ifndef I_XDRStreamUnMarshaller_h
00034 #define I_XDRStreamUnMarshaller_h 1
00035 
00036 #include <iostream>
00037 
00038 using std::istream ;
00039 using std::cin ;
00040 
00041 #include "UnMarshaller.h"
00042 #include "XDRUtils.h"
00043 
00044 namespace libdap
00045 {
00046 
00047 const int XDR_DAP_BUFF_SIZE = 4096; // This will be compared to a signed int
00048 
00052 class XDRStreamUnMarshaller : public UnMarshaller
00053 {
00054 private:
00055     XDR                         d_source ;
00056     istream &           d_in;
00057     static char *       d_buf;
00058 
00059                                 XDRStreamUnMarshaller() ;
00060                                 XDRStreamUnMarshaller( const XDRStreamUnMarshaller &um ) ;
00061     XDRStreamUnMarshaller &     operator=( const XDRStreamUnMarshaller & ) ;
00062 
00063 public:
00064                                 XDRStreamUnMarshaller( istream &in ) ;
00065     virtual                     ~XDRStreamUnMarshaller() ;
00066 
00067     virtual void        get_byte( dods_byte &val ) ;
00068 
00069     virtual void        get_int16( dods_int16 &val ) ;
00070     virtual void        get_int32( dods_int32 &val ) ;
00071 
00072     virtual void        get_float32( dods_float32 &val ) ;
00073     virtual void        get_float64( dods_float64 &val ) ;
00074 
00075     virtual void        get_uint16( dods_uint16 &val ) ;
00076     virtual void        get_uint32( dods_uint32 &val ) ;
00077 
00078     virtual void        get_str( string &val ) ;
00079     virtual void        get_url( string &val ) ;
00080 
00081     virtual void        get_opaque( char *val, unsigned int len ) ;
00082     virtual void        get_int( int &val ) ;
00083 
00084     virtual void        get_vector( char **val, unsigned int &num, Vector &vec ) ;
00085     virtual void        get_vector( char **val, unsigned int &num, int width, Vector &vec ) ;
00086 
00087     virtual void get_vector(char **val, unsigned int &num, int width, Type type);
00088 
00089     virtual void        dump(ostream &strm) const ;
00090 } ;
00091 
00092 } // namespace libdap
00093 
00094 #endif // I_XDRStreamUnMarshaller_h
00095