23#ifndef VCL_MESH_COMPONENTS_BIT_FLAGS_H
24#define VCL_MESH_COMPONENTS_BIT_FLAGS_H
26#include "bases/component.h"
28#include <vclib/concepts/mesh/components/bit_flags.h>
29#include <vclib/space/core/bit_set.h>
70template<
typename ParentElemType =
void,
bool OPT = false>
73 BitFlags<ParentElemType, OPT>,
77 !std::is_same_v<ParentElemType, void>,
80 using Base = Component<
85 !std::is_same_v<ParentElemType, void>,
98 static const uint FIRST_USER_BIT = 4;
113 if constexpr (!Base::IS_VERTICAL) {
128 void init() { flags().reset(); }
136 bool deleted()
const {
return flags()[DELETED]; }
149 bool selected()
const {
return flags()[SELECTED]; }
175 bool visited()
const {
return flags()[VISITED]; }
188 return flags()[
bit + FIRST_USER_BIT];
203 return flags()[
bit + FIRST_USER_BIT];
257 template<
typename Element>
258 void importFrom(
const Element& e,
bool =
true)
264 deletedBit() = e.deleted();
269 for (uint
i = 0;
i <
UM; ++
i)
278 void serialize(std::ostream& os)
const { flags().serialize(os); }
280 void deserialize(std::istream& is) { flags().deserialize(is); }
285 BitSet<FT>& flags() {
return Base::data(); }
287 BitSet<FT> flags()
const {
return Base::data(); }
The Element class.
Definition element.h:57
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The BitFlags component class represents a collection of 8 bits that will be part of an Element (e....
Definition bit_flags.h:79
void init()
Initializes the bits to false.
Definition bit_flags.h:128
bool onBorder() const
Returns whether the current Element is on border or not.
Definition bit_flags.h:162
void importFlagsFromVCGFormat(int f)
Sets all the flags of this element to the values contained in the integer input parameter,...
Definition bit_flags.h:223
bool deleted() const
Returns whether the current Element is deleted or not.
Definition bit_flags.h:136
BitFlags()
Initializes the bits to false.
Definition bit_flags.h:111
BitProxy< FT > userBit(uint bit)
Returns the boolean value of the user bit of this Element given in input. The bit is checked to be le...
Definition bit_flags.h:200
bool visited() const
Returns whether the current Element has been visited or not.
Definition bit_flags.h:175
BitProxy< FT > onBorder()
Accesses the 'onBorder' bit of this Element, returning a reference to it.
Definition bit_flags.h:156
void resetBitFlags()
Unsets all the flags of this Element and sets them to false, except the deleted flag,...
Definition bit_flags.h:210
BitProxy< FT > selected()
Accesses the 'selected' bit of this Element, returning a reference to it.
Definition bit_flags.h:143
bool selected() const
Returns whether the current Element is selected or not.
Definition bit_flags.h:149
static const uint USER_BITS_NUMBER
Static number of bits that can have custom meanings to the user.
Definition bit_flags.h:104
BitProxy< FT > visited()
Accesses the 'visited' bit of this Element, returning a reference to it.
Definition bit_flags.h:169
bool userBit(uint bit) const
Returns a reference to the value of the user bit of this Element given in input. The bit is checked t...
Definition bit_flags.h:185
int exportFlagsToVCGFormat() const
Returns the bit flags of this element in the format of the VCG library.
Definition bit_flags.h:241