Rev 526 | Rev 547 | 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__
#include <iostream>
namespace HMesh
{
template<typename ITEM, typename ITEMID>
class AttributeVector;
struct VertexTag {};
struct FaceTag {};
struct HalfEdgeTag {};
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;
friend std::ostream& operator<<(std::ostream& os, const ItemID<FaceTag>&);
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;
};
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; }
inline std::ostream& operator<<(std::ostream& os, const FaceID& iid)
{
return (os << iid.index);
}
}
#endif
Generated by GNU Enscript 1.6.6.