44#ifndef OPENMESH_HANDLES_HH
45#define OPENMESH_HANDLES_HH
50#include <OpenMesh/Core/System/config.h>
62class OPENMESHDLLEXPORT BaseHandle
66 explicit BaseHandle(
int _idx=-1) : idx_(_idx) {}
69 int idx()
const {
return idx_; }
79 bool operator==(
const BaseHandle& _rhs)
const {
80 return (this->idx_ == _rhs.idx_);
83 bool operator!=(
const BaseHandle& _rhs)
const {
84 return (this->idx_ != _rhs.idx_);
87 bool operator<(
const BaseHandle& _rhs)
const {
88 return (this->idx_ < _rhs.idx_);
93 void __increment() { ++idx_; }
94 void __decrement() { --idx_; }
96 void __increment(
int amount) { idx_ += amount; }
97 void __decrement(
int amount) { idx_ -= amount; }
105inline size_t hash_value(
const BaseHandle& h) {
return h.idx(); }
112 return (_os << _hnd.
idx());
120struct OPENMESHDLLEXPORT VertexHandle :
public BaseHandle
122 explicit VertexHandle(
int _idx=-1) : BaseHandle(_idx) {}
127struct OPENMESHDLLEXPORT HalfedgeHandle :
public BaseHandle
129 explicit HalfedgeHandle(
int _idx=-1) : BaseHandle(_idx) {}
134struct OPENMESHDLLEXPORT EdgeHandle :
public BaseHandle
136 explicit EdgeHandle(
int _idx=-1) : BaseHandle(_idx) {}
141struct OPENMESHDLLEXPORT FaceHandle :
public BaseHandle
143 explicit FaceHandle(
int _idx=-1) : BaseHandle(_idx) {}
148struct OPENMESHDLLEXPORT MeshHandle :
public BaseHandle
150 explicit MeshHandle(
int _idx=-1) : BaseHandle(_idx) {}
164#if defined(_MSVC_VER)
165# pragma warning(push)
166# pragma warning(disable:4099)
174 typedef std::size_t result_type;
183struct hash<OpenMesh::VertexHandle >
185 typedef OpenMesh::VertexHandle argument_type;
186 typedef std::size_t result_type;
188 std::size_t operator()(
const OpenMesh::VertexHandle& h)
const
195struct hash<OpenMesh::HalfedgeHandle >
198 typedef OpenMesh::HalfedgeHandle argument_type;
199 typedef std::size_t result_type;
201 std::size_t operator()(
const OpenMesh::HalfedgeHandle& h)
const
208struct hash<OpenMesh::EdgeHandle >
211 typedef OpenMesh::EdgeHandle argument_type;
212 typedef std::size_t result_type;
214 std::size_t operator()(
const OpenMesh::EdgeHandle& h)
const
221struct hash<OpenMesh::FaceHandle >
224 typedef OpenMesh::FaceHandle argument_type;
225 typedef std::size_t result_type;
227 std::size_t operator()(
const OpenMesh::FaceHandle& h)
const
233#if defined(_MSVC_VER)
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59
auto operator<<(std::ostream &os, const VectorT< Scalar, DIM > &_vec) -> typename std::enable_if< sizeof(decltype(os<< _vec[0])) >=0
output a vector by printing its space-separated compontens
Base class for all handle types.
Definition Handles.hh:63
bool is_valid() const
The handle is valid iff the index is not negative.
Definition Handles.hh:72
void invalidate()
reset handle to be invalid
Definition Handles.hh:77
void reset()
reset handle to be invalid
Definition Handles.hh:75
int idx() const
Get the underlying index of this handle.
Definition Handles.hh:69