MeVisLab Toolbox Reference
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;
33 WEMPrimitive& operator=(const WEMPrimitive &) = default;
36 virtual ~WEMPrimitive() = default;
42 inline int getEntryNumber() const { return _entryNumber; }
44 inline void setEntryNumber(int e) { _entryNumber = e; }
46 inline bool isSet(unsigned int bit) const { return ((_bitFlag & (1 << bit)) != 0); }
48 inline void setFlag(unsigned int bit) { _bitFlag |= (1 << bit); }
50 inline void unsetFlag(unsigned int bit) { _bitFlag &= (~(1 << bit)); }
52 inline void clearFlag() { _bitFlag = 0; }
54 inline bool isTraversed() const { return ((_bitFlag & (1 << WEM_TRAVERSED_BIT)) != 0); }
58 inline int getHeapPosition() const { return _heapPosition; }
60 inline bool inHeap() const { return (_heapPosition != -1); }
62 inline void setHeapPosition(int heapPosition) { _heapPosition = heapPosition; }
64 inline double getHeapValue() const { return _heapValue; }
66 inline void setHeapValue(double heapValue) { _heapValue = heapValue; }
67
68protected:
69
71 unsigned int _bitFlag;
77 double _heapValue;
78};
79
81
83{
84 static bool less(const WEMPrimitive &x, const WEMPrimitive &y);
85};
86
87
88
#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)