/*
 * HnPoint.hh
 *
 * DO NOT EDIT THIS FILE!
 *
 * This file is automatically generated by obj2ptr.
 * 2002/09/13 12:44:53
 */

#ifndef _HnPoint_hh
#define _HnPoint_hh

#ifndef _HNSRTIMP
#ifdef _MSC_VER
#define _HNSRTIMP _declspec(dllimport)
#else
#define _HNSRTIMP
#endif
#endif

#include "HnSRTree/HnPointer.hh"

#include "HnSRTree/HnBlockStream.hh"

/*
 * HnPoint
 */

class _HNSRTIMP HnPoint: public HnPointer {
private:
    friend class HnPointObj;
    HnPoint(const HnPointObj *ptr) {
	HnPointer::assign((HnObject *)ptr);
    }
    HnPointObj *getObject(void) const {
	return (HnPointObj *)HnPointer::getObject();
    }
public:
    static const HnPoint null;
    HnPoint(void) {}
public:
    _HNSRTIMP friend HnPoint
    new_HnPoint(int dimension);
    _HNSRTIMP friend HnPoint
    new_HnPoint(int dimension, HnBlockStream &blockStream);
    _HNSRTIMP friend HnPoint
    new_HnPoint(const HnPoint &point);

    /* attributes */
    int getDimension(void) const;
    double &getCoordAt(int index) const;
    void setCoordAt(double coord, int index);
    double *getCoords(void) const;

    /* HnBlockStream */
    void writeTo(HnBlockStream &blockStream) const;
    static int getSizeInBlockStream(int dimension);

    /* utilities */
    HnBool equals(const HnPoint &point) const;
    HnString toString(void) const;

    double getDistance(const HnPoint &point) const;
    double getSquareDistance(const HnPoint &point) const;
    double getUpperBoundDistance(const HnPoint &point) const;
    double getLowerBoundDistance(const HnPoint &point) const;
};

#include "HnSRTree/HnString.hh"

#define HnClass HnPoint
#include "HnSRTree/HnClassArray.hh"

#include "HnSRTree/HnPointObj.hh"

inline int
HnPoint::getDimension(void) const
{
    return getObject()->getDimension();
}

inline double &
HnPoint::getCoordAt(int index) const
{
    return getObject()->getCoordAt(index);
}

inline void
HnPoint::setCoordAt(double coord, int index)
{
    getObject()->setCoordAt(coord, index);
}

inline double *
HnPoint::getCoords(void) const
{
    return getObject()->getCoords();
}

inline void
HnPoint::writeTo(HnBlockStream &blockStream) const
{
    getObject()->writeTo(blockStream);
}

inline int
HnPoint::getSizeInBlockStream(int dimension)
{
    return HnPointObj::getSizeInBlockStream(dimension);
}

inline HnBool
HnPoint::equals(const HnPoint &ptr) const {
    if ( isInvalid() ) {
	if ( ptr.isInvalid() ) {
	    return HnTRUE;
	}
	else {
	    return HnFALSE;
	}
    }
    else {
	if ( ptr.isInvalid() ) {
	    return HnFALSE;
	}
	else {
	    return getObject()->equals(ptr);
	}
    }
}

inline HnString
HnPoint::toString(void) const {
    if ( isInvalid() ) {
	return "HnPoint::null";
    }
    else {
	return getObject()->toString();
    }
}

inline double
HnPoint::getDistance(const HnPoint &point) const
{
    return getObject()->getDistance(point);
}

inline double
HnPoint::getSquareDistance(const HnPoint &point) const
{
    return getObject()->getSquareDistance(point);
}

inline double
HnPoint::getUpperBoundDistance(const HnPoint &point) const
{
    return getObject()->getUpperBoundDistance(point);
}

inline double
HnPoint::getLowerBoundDistance(const HnPoint &point) const
{
    return getObject()->getLowerBoundDistance(point);
}


#endif /* _HnPoint_hh */
