Blame UInt64.h

Packit a4aae4
Packit a4aae4
// -*- mode: c++; c-basic-offset:4 -*-
Packit a4aae4
Packit a4aae4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
Packit a4aae4
// Access Protocol.
Packit a4aae4
Packit a4aae4
// Copyright (c) 2012 OPeNDAP, Inc.
Packit a4aae4
// Author: James Gallagher <jgallagher@opendap.org>
Packit a4aae4
//
Packit a4aae4
// This library is free software; you can redistribute it and/or
Packit a4aae4
// modify it under the terms of the GNU Lesser General Public
Packit a4aae4
// License as published by the Free Software Foundation; either
Packit a4aae4
// version 2.1 of the License, or (at your option) any later version.
Packit a4aae4
//
Packit a4aae4
// This library is distributed in the hope that it will be useful,
Packit a4aae4
// but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4aae4
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4aae4
// Lesser General Public License for more details.
Packit a4aae4
//
Packit a4aae4
// You should have received a copy of the GNU Lesser General Public
Packit a4aae4
// License along with this library; if not, write to the Free Software
Packit a4aae4
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit a4aae4
//
Packit a4aae4
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
Packit a4aae4
Packit a4aae4
#ifndef _uint64_h
Packit a4aae4
#define _uint64_h 1
Packit a4aae4
Packit a4aae4
Packit a4aae4
#ifndef _dods_datatypes_h
Packit a4aae4
#include "dods-datatypes.h"
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
#ifndef _basetype_h
Packit a4aae4
#include "BaseType.h"
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
#ifndef constraint_evaluator_h
Packit a4aae4
#include "ConstraintEvaluator.h"
Packit a4aae4
#endif
Packit a4aae4
Packit a4aae4
namespace libdap
Packit a4aae4
{
Packit a4aae4
Packit a4aae4
/** @brief Holds a 64-bit unsigned integer.
Packit a4aae4
Packit a4aae4
    @see BaseType */
Packit a4aae4
Packit a4aae4
class UInt64: public BaseType
Packit a4aae4
{
Packit a4aae4
	virtual unsigned int val2buf(void *val, bool)  {
Packit a4aae4
    	set_value(*reinterpret_cast<dods_uint64*>(val));
Packit a4aae4
    	return sizeof(dods_uint64);
Packit a4aae4
    }
Packit a4aae4
    virtual unsigned int buf2val(void **)  { throw InternalErr(__FILE__, __LINE__, "Not implemented for UInt64"); }
Packit a4aae4
    virtual void print_val(FILE *, string, bool) { throw InternalErr(__FILE__, __LINE__, "Not implemented for UInt64"); }
Packit a4aae4
Packit a4aae4
protected:
Packit a4aae4
    dods_uint64 d_buf;
Packit a4aae4
Packit a4aae4
public:
Packit a4aae4
    UInt64(const string &n);
Packit a4aae4
    UInt64(const string &n, const string &d);
Packit a4aae4
    virtual ~UInt64()
Packit a4aae4
    {}
Packit a4aae4
Packit a4aae4
    UInt64(const UInt64 &copy_from);
Packit a4aae4
Packit a4aae4
    UInt64 &operator=(const UInt64 &rhs;;
Packit a4aae4
Packit a4aae4
    virtual BaseType *ptr_duplicate() ;
Packit a4aae4
Packit a4aae4
    virtual unsigned int width(bool constrained = false) const;
Packit a4aae4
Packit a4aae4
    // DAP4
Packit a4aae4
    virtual void compute_checksum(Crc32 &checksum);
Packit a4aae4
    virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false);
Packit a4aae4
    virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr);
Packit a4aae4
Packit a4aae4
    virtual dods_uint64 value() const;
Packit a4aae4
    virtual bool set_value(dods_uint64 val);
Packit a4aae4
Packit a4aae4
    virtual void print_val(ostream &out, string space = "",  bool print_decl_p = true);
Packit a4aae4
Packit a4aae4
    virtual bool ops(BaseType *b, int op);
Packit a4aae4
    virtual bool d4_ops(BaseType *b, int op);
Packit a4aae4
    virtual std::vector<BaseType *> *transform_to_dap2(AttrTable *parent_attr_table);
Packit a4aae4
Packit a4aae4
    virtual void dump(ostream &strm) const ;
Packit a4aae4
};
Packit a4aae4
Packit a4aae4
} // namespace libdap
Packit a4aae4
Packit a4aae4
#endif // _uint64_h
Packit a4aae4