Subversion Repositories gelsvn

Rev

Rev 518 | Rev 546 | 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
{
526 jab 17
	template<typename ITEM, typename ITEMID>
18
	class AttributeVector;
19
 
515 s042372 20
    template<typename T>
512 s042372 21
    class ItemID
22
    {
23
    public:
515 s042372 24
        ItemID();
511 s042372 25
 
512 s042372 26
        bool operator ==(const ItemID& other) const;
27
        bool operator !=(const ItemID& other) const;
28
        bool operator <(const ItemID& other) const;
511 s042372 29
 
515 s042372 30
    private:
518 s042372 31
        typedef unsigned int IndexType;  
32
        static const IndexType INVALID_INDEX =  0xffffffff;
33
 
515 s042372 34
        ItemID(IndexType index);
511 s042372 35
 
515 s042372 36
        friend class ConnectivityKernel;
37
        template<typename ITEM, typename ITEMID>
38
        friend class AttributeVector;
511 s042372 39
 
512 s042372 40
        IndexType index;
41
    };
511 s042372 42
 
515 s042372 43
    struct VertexTag {};
44
    struct FaceTag {};
45
    struct HalfEdgeTag {};
511 s042372 46
 
515 s042372 47
    typedef ItemID<VertexTag> VertexID;
48
    typedef ItemID<FaceTag> FaceID;
49
    typedef ItemID<HalfEdgeTag> HalfEdgeID;
511 s042372 50
 
515 s042372 51
    static const VertexID InvalidVertexID;
52
    static const FaceID InvalidFaceID;
53
    static const HalfEdgeID InvalidHalfEdgeID;
511 s042372 54
 
515 s042372 55
    template<typename T>
56
    inline ItemID<T>::ItemID() : index(INVALID_INDEX){}
511 s042372 57
 
515 s042372 58
    template<typename T>
59
    inline ItemID<T>::ItemID(IndexType _index) : index(_index){}
60
 
61
    template<typename T>
62
    inline bool ItemID<T>::operator ==(const ItemID& other) const
512 s042372 63
    { return index == other.index; }
511 s042372 64
 
515 s042372 65
    template<typename T>
66
    inline bool ItemID<T>::operator !=(const ItemID& other) const
512 s042372 67
    { return index != other.index; }
511 s042372 68
 
515 s042372 69
    template<typename T>
70
    inline bool ItemID<T>::operator <(const ItemID& other) const
512 s042372 71
    { return index < other.index; }
511 s042372 72
 
73
 
74
}
75
 
76
#endif