/*
 * HnDataItem.hh
 *
 * DO NOT EDIT THIS FILE!
 *
 * This file is automatically generated by obj2ptr.
 * 2002/09/13 12:41:10
 */

#ifndef _HnDataItem_hh
#define _HnDataItem_hh

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

#include "HnSRTree/HnPointer.hh"

#include "HnSRTree/HnBlockStream.hh"

/*
 * HnDataItem
 */

class _HNSRTIMP HnDataItem: public HnPointer {
private:
    friend class HnDataItemObj;
    HnDataItem(const HnDataItemObj *ptr) {
	HnPointer::assign((HnObject *)ptr);
    }
    HnDataItemObj *getObject(void) const {
	return (HnDataItemObj *)HnPointer::getObject();
    }
public:
    static const HnDataItem null;
    HnDataItem(void) {}
public:
    /* constructor and destructor */
    _HNSRTIMP friend HnDataItem
    new_HnDataItem(void);
    _HNSRTIMP friend HnDataItem
    new_HnDataItem(int n);
    _HNSRTIMP friend HnDataItem
    new_HnDataItem(const void *ptr, int n);
    _HNSRTIMP friend HnDataItem
    new_HnDataItem(const void *ptr1, int n1, const void *ptr2, int n2);
    _HNSRTIMP friend HnDataItem
    new_HnDataItem(int n, HnBlockStream &blockStream);

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

    /* attributes */
    char *toCharArray(void) const;
    char &charAt(int i) const;
    int length(void) const;

    /* utilities */
    HnBool equals(const HnDataItem &dataItem) const;
};

#include "HnSRTree/HnString.hh"

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

#include "HnSRTree/HnDataItemObj.hh"

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

inline int
HnDataItem::getSizeInBlockStream(int n)
{
    return HnDataItemObj::getSizeInBlockStream(n);
}

inline char *
HnDataItem::toCharArray(void) const
{
    return getObject()->toCharArray();
}

inline char &
HnDataItem::charAt(int i) const
{
    return getObject()->charAt(i);
}

inline int
HnDataItem::length(void) const
{
    return getObject()->length();
}

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


#endif /* _HnDataItem_hh */
