libdap  Updated for version 3.17.0
UInt64.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 _uint64_h
00027 #define _uint64_h 1
00028 
00029 
00030 #ifndef _dods_datatypes_h
00031 #include "dods-datatypes.h"
00032 #endif
00033 
00034 #ifndef _basetype_h
00035 #include "BaseType.h"
00036 #endif
00037 
00038 #ifndef constraint_evaluator_h
00039 #include "ConstraintEvaluator.h"
00040 #endif
00041 
00042 namespace libdap
00043 {
00044 
00049 class UInt64: public BaseType
00050 {
00051         virtual unsigned int val2buf(void *val, bool)  {
00052         set_value(*reinterpret_cast<dods_uint64*>(val));
00053         return sizeof(dods_uint64);
00054     }
00055     virtual unsigned int buf2val(void **)  { throw InternalErr(__FILE__, __LINE__, "Not implemented for UInt64"); }
00056     virtual void print_val(FILE *, string, bool) { throw InternalErr(__FILE__, __LINE__, "Not implemented for UInt64"); }
00057 
00058 protected:
00059     dods_uint64 d_buf;
00060 
00061 public:
00062     UInt64(const string &n);
00063     UInt64(const string &n, const string &d);
00064     virtual ~UInt64()
00065     {}
00066 
00067     UInt64(const UInt64 &copy_from);
00068 
00069     UInt64 &operator=(const UInt64 &rhs);
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 dods_uint64 value() const;
00081     virtual bool set_value(dods_uint64 val);
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 // _uint64_h
00093