Subversion Repositories gelsvn

Rev

Rev 585 | Rev 587 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 585 Rev 586
Line 18... Line 18...
18
namespace HMesh
18
namespace HMesh
19
{
19
{
20
	template<typename ITEM, typename ITEMID>
20
	template<typename ITEM, typename ITEMID>
21
	class AttributeVector;
21
	class AttributeVector;
22
	
22
	
23
	struct VertexTag {};
-
 
24
    struct FaceTag {};
23
    /** The ItemID class is simply a wrapper around an index. This class associates a type
25
    struct HalfEdgeTag {};
24
     with the index. */
26
	
-
 
27
    template<typename T>
25
    template<typename T>
28
    class ItemID
26
    class ItemID
29
    {
27
    {
30
    public:
28
    public:
31
        ItemID();
29
        ItemID(): index(INVALID_INDEX){}
32
 
30
 
33
        bool operator ==(const ItemID& other) const;
31
        bool operator ==(const ItemID& other) const { return index == other.index; }
34
        bool operator !=(const ItemID& other) const;
32
        bool operator !=(const ItemID& other) const { return index != other.index; }
35
        bool operator <(const ItemID& other) const;
33
        bool operator <(const ItemID& other) const { return index < other.index; }
36
 
34
 
37
		template<typename X>
35
		template<typename X>
38
		friend std::ostream& operator<<(std::ostream& os, const ItemID<X>&);
36
		friend std::ostream& operator<<(std::ostream& os, const ItemID<X>&);
39
		
37
		
40
    private:
38
    private:
41
        typedef size_t IndexType;
39
        typedef size_t IndexType;
42
        static const IndexType INVALID_INDEX =  -1;
40
        static const IndexType INVALID_INDEX =  -1;
43
 
41
 
44
        ItemID(IndexType index);
42
        explicit ItemID(IndexType _index): index(_index){}
45
 
43
 
46
        friend class ConnectivityKernel;
44
        friend class ConnectivityKernel;
-
 
45
            
47
        template<typename ITEM, typename ITEMID>
46
        template<typename ITEM> friend class ItemVector;
48
        friend class AttributeVector;
47
        template<typename ITEM, typename ITEMID> friend class AttributeVector;
49
 
48
 
50
        IndexType index;
49
        IndexType index;
51
    };
50
    };
52
 
51
 
53
 
-
 
54
    typedef ItemID<VertexTag> VertexID;
-
 
55
    typedef ItemID<FaceTag> FaceID;
-
 
56
    typedef ItemID<HalfEdgeTag> HalfEdgeID;
-
 
57
 
-
 
58
    static const VertexID InvalidVertexID;
-
 
59
    static const FaceID InvalidFaceID;
-
 
60
    static const HalfEdgeID InvalidHalfEdgeID;
-
 
61
 
-
 
62
    template<typename T>
-
 
63
    inline ItemID<T>::ItemID() : index(INVALID_INDEX){}
-
 
64
 
-
 
65
    template<typename T>
-
 
66
    inline ItemID<T>::ItemID(IndexType _index) : index(_index){}
-
 
67
 
-
 
68
    template<typename T>
-
 
69
    inline bool ItemID<T>::operator ==(const ItemID& other) const
-
 
70
    { return index == other.index; }
-
 
71
 
-
 
72
    template<typename T>
-
 
73
    inline bool ItemID<T>::operator !=(const ItemID& other) const
-
 
74
    { return index != other.index; }
-
 
75
 
-
 
76
    template<typename T>
-
 
77
    inline bool ItemID<T>::operator <(const ItemID& other) const
-
 
78
    { return index < other.index; }
-
 
79
 
-
 
80
	template<typename T>
52
	template<typename T>
81
	inline std::ostream& operator<<(std::ostream& os, const ItemID<T>& iid)
53
	inline std::ostream& operator<<(std::ostream& os, const ItemID<T>& iid)
82
	{
54
	{
83
		return (os << iid.index);
55
		return (os << iid.index);
84
	}
56
	}