MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
WEMPrimitive.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#pragma once
14
15#include "MLWEMIncludes.h"
16
18
20
22#define WEM_TRAVERSED_BIT 16
23
25
28{
29public:
31 WEMPrimitive(const WEMPrimitive&) = default;
36 virtual ~WEMPrimitive() = default;
42 inline int getEntryNumber() const
43 {
44 return _entryNumber;
45 }
47 inline void setEntryNumber(int e)
48 {
49 _entryNumber = e;
50 }
52 inline bool isSet(unsigned int bit) const
53 {
54 return ((_bitFlag & (1U << bit)) != 0);
55 }
57 inline void setFlag(unsigned int bit)
58 {
59 _bitFlag |= (1U << bit);
60 }
62 inline void unsetFlag(unsigned int bit)
63 {
64 _bitFlag &= (~(1U << bit));
65 }
67 inline void clearFlag()
68 {
69 _bitFlag = 0;
70 }
72 inline bool isTraversed() const
73 {
74 return ((_bitFlag & (1U << WEM_TRAVERSED_BIT)) != 0);
75 }
79 inline int getHeapPosition() const
80 {
81 return _heapPosition;
82 }
84 inline bool inHeap() const
85 {
86 return (_heapPosition != -1);
87 }
89 inline void setHeapPosition(int heapPosition)
90 {
91 _heapPosition = heapPosition;
92 }
94 inline double getHeapValue() const
95 {
96 return _heapValue;
97 }
99 inline void setHeapValue(double heapValue)
100 {
101 _heapValue = heapValue;
102 }
103
104protected:
106 unsigned int _bitFlag;
113};
114
116
118{
119 static bool less(const WEMPrimitive& x, const WEMPrimitive& y);
120};
121
122
#define MLWEM_EXPORT
Definition MLWEMSystem.h:18
#define WEM_TRAVERSED_BIT
Traversed bit.
This is the base class for the WEM elements nodes, edges, and faces.
WEMPrimitive(WEMPrimitive &&p) noexcept
int getHeapPosition() const
Returns the heap position.
double _heapValue
Element value, used for heap sorting.
int _entryNumber
Entry number in index vector, for easy deletion and reference.
int getEntryNumber() const
Returns the entry number.
void setFlag(unsigned int bit)
Sets the given bit-flag.
void setTraversed(bool traversed)
Sets the traversed flag.
int _heapPosition
Heap position, same like entryNumber but for heaps.
void resetPrimitive()
Resets the object to its default constructed state.
bool isTraversed() const
Returns whether this primitive has been traversed.
virtual ~WEMPrimitive()=default
Standard destructor.
void setHeapPosition(int heapPosition)
Sets the heap position.
unsigned int _bitFlag
Bit-wise flag for custom use.
void setHeapValue(double heapValue)
Sets the heap value.
WEMPrimitive & operator=(WEMPrimitive &&p) noexcept
void clearFlag()
Clears the bit-flag.
void setEntryNumber(int e)
Sets the entry number.
void unsetFlag(unsigned int bit)
Unsets the given bit-flag.
WEMPrimitive & operator=(const WEMPrimitive &)=default
double getHeapValue() const
Returns the heap value.
bool inHeap() const
Returns whether this primitive is in the heap.
bool isSet(unsigned int bit) const
Returns whether the bit-flag is set.
WEMPrimitive(const WEMPrimitive &)=default
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
static bool less(const WEMPrimitive &x, const WEMPrimitive &y)