libdap  Updated for version 3.17.0
Int64.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 _int64_h
00027 #define _int64_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 
00040 class ConstraintEvaluator;
00041 class Marshaller;
00042 class UnMarshaller;
00043 
00049 class Int64: public BaseType
00050 {
00051         virtual unsigned int val2buf(void *val, bool)  {
00052         set_value(*reinterpret_cast<dods_int64*>(val));
00053         return sizeof(dods_int64);
00054     }
00055     virtual unsigned int buf2val(void **) { throw InternalErr(__FILE__, __LINE__, "Not implemented for Int64"); }
00056     virtual void print_val(FILE *, string, bool) { throw InternalErr(__FILE__, __LINE__, "Not implemented for Int64"); }
00057 
00058 protected:
00059     dods_int64 d_buf;
00060 
00061 public:
00062     Int64(const string &n);
00063     Int64(const string &n, const string &d);
00064 
00065     Int64(const Int64 &copy_from);
00066 
00067     Int64 &operator=(const Int64 &rhs);
00068 
00069     virtual ~Int64();
00070 
00071     virtual BaseType *ptr_duplicate();
00072 
00073     virtual unsigned int width(bool constrained = false) const;
00074 
00075     // DAP4
00076     virtual void compute_checksum(Crc32 &checksum);
00077     virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false);
00078     virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr);
00079 
00080     virtual bool set_value(dods_int64 i);
00081     virtual dods_int64 value() const;
00082 
00083     virtual void print_val(ostream &out, string space = "", bool print_decl_p = true);
00084 
00085     virtual bool ops(BaseType *b, int op);
00086 
00087     virtual void dump(ostream &strm) const ;
00088 };
00089 
00090 } // namespace libdap
00091 
00092 #endif // _int64_h
00093