Subversion Repositories gelsvn

Rev

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