libdap  Updated for version 3.17.0
Int8.h
00001 
00002 // -*- mode: c++; c-basic-offset:4 -*-
00003 
00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00005 // Access Protocol.
00006 
00007 // Copyright (c) 2012 OPeNDAP, Inc.
00008 // Author: James Gallagher <jgallagher@opendap.org>
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 #ifndef _int8_h
00027 #define _int8_h 1
00028 
00029 #ifndef _dods_datatypes_h
00030 #include "dods-datatypes.h"
00031 #endif
00032 
00033 #ifndef _basetype_h
00034 #include "BaseType.h"
00035 #endif
00036 
00037 namespace libdap
00038 {
00039 
00042 class Int8: public BaseType
00043 {
00044         // This is used in BaseType *Vector::var(unsigned int i)
00045         virtual unsigned int val2buf(void *val, bool)  {
00046         set_value(*reinterpret_cast<dods_int8*>(val));
00047         return sizeof(dods_int8);
00048     }
00049     virtual unsigned int buf2val(void **) { throw InternalErr(__FILE__, __LINE__, "buf2val: Not implemented for Int8"); }
00050     virtual void print_val(FILE *, string , bool) { throw InternalErr(__FILE__, __LINE__, "print_val: Not implemented for Int8"); }
00051 
00052 protected:
00053     dods_int8 d_buf;
00054 
00055 public:
00056     Int8(const string &n);
00057     Int8(const string &n, const string &d);
00058     virtual ~Int8()
00059     {}
00060 
00061     Int8(const Int8 &copy_from);
00062 
00063     Int8 &operator=(const Int8 &rhs);
00064 
00065     virtual BaseType *ptr_duplicate();
00066 
00067     virtual unsigned int width(bool constrained = false) const;
00068 
00069     // DAP4
00070     virtual void compute_checksum(Crc32 &checksum);
00071     virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false);
00072     virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr);
00073 
00074     virtual dods_int8 value() const;
00075     virtual bool set_value(dods_int8 val);
00076 
00077     virtual void print_val(ostream &out, string space = "", bool print_decl_p = true);
00078 
00079     virtual bool ops(BaseType *b, int op);
00080 
00081     virtual void dump(ostream &strm) const ;
00082 };
00083 
00084 } // namespace libdap
00085 
00086 #endif // _int16_h
00087