Subversion Repositories gelsvn

Rev

Rev 515 | Rev 526 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/* ----------------------------------------------------------------------- *
 * This file is part of GEL, www.imm.dtu.dk/GEL
 * Copyright (C) the authors (see AUTHORS.txt) and DTU Informatics
 *
 * Principal authors:
 *  Christian Thode Larsen (thode2d@gmail.com)
 *  J. Andreas Baerentzen (jab@imm.dtu.dk)
 *
 * See LICENSE.txt for licensing information
 * ----------------------------------------------------------------------- */

#ifndef __HMESH_ITEMID_H__
#define __HMESH_ITEMID_H__

namespace HMesh
{
    template<typename T>
    class ItemID
    {
    public:
        ItemID();

        bool operator ==(const ItemID& other) const;
        bool operator !=(const ItemID& other) const;
        bool operator <(const ItemID& other) const;

    private:
        typedef unsigned int IndexType;  
        static const IndexType INVALID_INDEX =  0xffffffff;

        ItemID(IndexType index);

        friend class ConnectivityKernel;
        template<typename ITEM, typename ITEMID>
        friend class AttributeVector;

        IndexType index;
    };

    struct VertexTag {};
    struct FaceTag {};
    struct HalfEdgeTag {};

    typedef ItemID<VertexTag> VertexID;
    typedef ItemID<FaceTag> FaceID;
    typedef ItemID<HalfEdgeTag> HalfEdgeID;

    static const VertexID InvalidVertexID;
    static const FaceID InvalidFaceID;
    static const HalfEdgeID InvalidHalfEdgeID;

    template<typename T>
    inline ItemID<T>::ItemID() : index(INVALID_INDEX){}

    template<typename T>
    inline ItemID<T>::ItemID(IndexType _index) : index(_index){}

    template<typename T>
    inline bool ItemID<T>::operator ==(const ItemID& other) const
    { return index == other.index; }

    template<typename T>
    inline bool ItemID<T>::operator !=(const ItemID& other) const
    { return index != other.index; }

    template<typename T>
    inline bool ItemID<T>::operator <(const ItemID& other) const
    { return index < other.index; }


}

#endif

Generated by GNU Enscript 1.6.6.