Subversion Repositories gelsvn

Rev

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

Rev Author Line No. Line
512 s042372 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors (see AUTHORS.txt) and DTU Informatics
4
 *
5
 * Principal authors:
6
 *  Christian Thode Larsen (thode2d@gmail.com)
7
 *  J. Andreas Baerentzen (jab@imm.dtu.dk)
8
 *
9
 * See LICENSE.txt for licensing information
10
 * ----------------------------------------------------------------------- */
511 s042372 11
 
12
#ifndef __HMESH_ITEMID_H__
13
#define __HMESH_ITEMID_H__
14
 
15
namespace HMesh
16
{
515 s042372 17
    template<typename T>
512 s042372 18
    class ItemID
19
    {
20
    public:
515 s042372 21
        ItemID();
511 s042372 22
 
512 s042372 23
        bool operator ==(const ItemID& other) const;
24
        bool operator !=(const ItemID& other) const;
25
        bool operator <(const ItemID& other) const;
511 s042372 26
 
515 s042372 27
    private:
518 s042372 28
        typedef unsigned int IndexType;  
29
        static const IndexType INVALID_INDEX =  0xffffffff;
30
 
515 s042372 31
        ItemID(IndexType index);
511 s042372 32
 
515 s042372 33
        friend class ConnectivityKernel;
34
        template<typename ITEM, typename ITEMID>
35
        friend class AttributeVector;
511 s042372 36
 
512 s042372 37
        IndexType index;
38
    };
511 s042372 39
 
515 s042372 40
    struct VertexTag {};
41
    struct FaceTag {};
42
    struct HalfEdgeTag {};
511 s042372 43
 
515 s042372 44
    typedef ItemID<VertexTag> VertexID;
45
    typedef ItemID<FaceTag> FaceID;
46
    typedef ItemID<HalfEdgeTag> HalfEdgeID;
511 s042372 47
 
515 s042372 48
    static const VertexID InvalidVertexID;
49
    static const FaceID InvalidFaceID;
50
    static const HalfEdgeID InvalidHalfEdgeID;
511 s042372 51
 
515 s042372 52
    template<typename T>
53
    inline ItemID<T>::ItemID() : index(INVALID_INDEX){}
511 s042372 54
 
515 s042372 55
    template<typename T>
56
    inline ItemID<T>::ItemID(IndexType _index) : index(_index){}
57
 
58
    template<typename T>
59
    inline bool ItemID<T>::operator ==(const ItemID& other) const
512 s042372 60
    { return index == other.index; }
511 s042372 61
 
515 s042372 62
    template<typename T>
63
    inline bool ItemID<T>::operator !=(const ItemID& other) const
512 s042372 64
    { return index != other.index; }
511 s042372 65
 
515 s042372 66
    template<typename T>
67
    inline bool ItemID<T>::operator <(const ItemID& other) const
512 s042372 68
    { return index < other.index; }
511 s042372 69
 
70
 
71
}
72
 
73
#endif