5#include "MRPch/MRBindingMacros.h"
24 constexpr Id() noexcept : id_( -1 ) { }
34 template <
typename U =
int, std::enable_if_t<std::is_
integral_v<U>, std::
nullptr_t> =
nullptr>
36 #ifdef MR_PARSING_FOR_ANY_BINDINGS
38 explicit constexpr Id(
int i ) noexcept : id_(
ValueType( i ) ) {}
41 constexpr operator ValueType()
const {
return id_; }
42 constexpr bool valid()
const {
return id_ >= 0; }
43 explicit constexpr operator bool()
const {
return id_ >= 0; }
60 constexpr Id operator --(
int ) {
auto res = *
this; --id_;
return res; }
61 constexpr Id operator ++(
int ) {
auto res = *
this; ++id_;
return res; }
68#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
90 constexpr Id() noexcept : id_( -1 ) { }
92 constexpr Id( UndirectedEdgeId u ) noexcept : id_( (
ValueType)u << 1 ) { assert( u.valid() ); }
94 explicit constexpr Id(
unsigned int i ) noexcept : id_( i ) { }
95 explicit constexpr Id(
size_t i ) noexcept : id_(
ValueType( i ) ) { }
96 constexpr operator ValueType()
const {
return id_; }
97 constexpr bool valid()
const {
return id_ >= 0; }
98 explicit constexpr operator bool()
const {
return id_ >= 0; }
104 constexpr bool even()
const { assert(
valid() );
return (id_ & 1) == 0; }
105 constexpr bool odd()
const { assert(
valid() );
return (id_ & 1) == 1; }
107 constexpr UndirectedEdgeId
undirected()
const { assert(
valid() );
return UndirectedEdgeId( id_ >> 1 ); }
108 constexpr operator UndirectedEdgeId()
const {
return undirected(); }
114 template <
typename U>
116 template <
typename U>
118 template <
typename U>
131#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
147 explicit constexpr Id(
int )
noexcept =
delete;
150 explicit constexpr operator bool()
const {
return id_ !=
~ValueType( 0 ); }
157 template <
typename U>
159 template <
typename U>
161 template <
typename U>
174#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
195inline constexpr FaceId
operator ""_f(
unsigned long long i )
noexcept {
return FaceId{ (int)i }; }
196inline constexpr VertId
operator ""_v(
unsigned long long i )
noexcept {
return VertId{ (int)i }; }
197inline constexpr EdgeId
operator ""_e(
unsigned long long i )
noexcept {
return EdgeId{ (int)i }; }
198inline constexpr UndirectedEdgeId
operator ""_ue(
unsigned long long i )
noexcept {
return UndirectedEdgeId{ (int)i }; }
199inline constexpr VoxelId
operator ""_vox(
unsigned long long i )
noexcept {
return VoxelId{ size_t( i ) }; }
204struct std::hash<
MR::
Id<T>>
206 size_t operator() (
MR::Id<T> const& p )
const noexcept
stores index of some element, it is made as template class to avoid mixing faces, edges and vertices
Definition MRId.h:20
BitSet operator-(const BitSet &a, const BitSet &b)
Definition MRBitSet.h:477
constexpr bool odd() const
Definition MRId.h:105
constexpr bool valid() const
Definition MRId.h:149
size_t ValueType
Definition MRId.h:142
MR_BIND_IGNORE constexpr Id(U i) noexcept
Definition MRId.h:35
constexpr ValueType & get() noexcept
Definition MRId.h:151
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:144
constexpr bool valid() const
Definition MRId.h:97
constexpr bool operator!=(Id b) const
Definition MRId.h:47
constexpr Id & operator+=(ValueType a)
Definition MRId.h:64
constexpr Id & operator++()
Definition MRId.h:58
int ValueType
Definition MRId.h:88
NoInitId()
Definition MRId.h:80
constexpr Id sym() const
returns identifier of the edge with same ends but opposite orientation
Definition MRId.h:102
Id(NoInit) noexcept
Definition MRId.h:25
class MRMESH_CLASS VoxelTag
Definition MRMeshFwd.h:108
constexpr bool operator==(Id b) const
Definition MRId.h:46
Id(NoInit) noexcept
Definition MRId.h:91
constexpr bool valid() const
Definition MRId.h:42
constexpr Id(UndirectedEdgeId u) noexcept
Definition MRId.h:92
constexpr Id(ValueType i) noexcept
Definition MRId.h:93
constexpr Id & operator-=(ValueType a)
Definition MRId.h:63
constexpr Id & operator--()
Definition MRId.h:57
Id(NoInit) noexcept
Definition MRId.h:145
constexpr Id(int) noexcept=delete
constexpr NoInit noInit
Definition MRMeshFwd.h:100
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:24
NoInitId(Id< T > id)
Definition MRId.h:81
constexpr Id(ValueType i) noexcept
Definition MRId.h:146
constexpr bool operator<(Id b) const
Definition MRId.h:48
constexpr ValueType & get() noexcept
Definition MRId.h:44
constexpr Id(size_t i) noexcept
Definition MRId.h:95
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:90
int ValueType
Definition MRId.h:22
constexpr Id(unsigned int i) noexcept
Definition MRId.h:94
class MRMESH_CLASS Id(EdgeId, Id< EdgeTag >)(UndirectedEdgeId
class MRMESH_CLASS EdgeTag
Definition MRMeshFwd.h:103
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
constexpr ValueType & get() noexcept
Definition MRId.h:99
constexpr bool even() const
among each pair of sym-edges: one is always even and the other is odd
Definition MRId.h:104
constexpr UndirectedEdgeId undirected() const
returns unique identifier of the edge ignoring its direction
Definition MRId.h:107
Color operator+(const Color &a, const Color &b)
Definition MRColor.h:109
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshFwd.h:99