src
tools
lvr2_ascii_viewer
include
ascii_viewer
BitField.hpp
Go to the documentation of this file.
1
#ifndef LVR2_ASCII_RENDERER_BITFIELD_HPP
2
#define LVR2_ASCII_RENDERER_BITFIELD_HPP
3
4
#include <iostream>
5
6
namespace
lvr2
{
7
8
template
<
unsigned
int
W,
unsigned
int
H>
9
struct
BitField
{
10
// storage
11
unsigned
char
data
= 0;
12
13
BitField
():
data
(0){}
14
15
void
set
(
const
unsigned
int
& i,
const
unsigned
int
& j)
16
{
17
data
|= 1UL << (i * H + j);
18
}
19
20
bool
get
(
const
unsigned
int
& i,
const
unsigned
int
& j)
const
21
{
22
return
(
data
>> (i * H + j)) & 1U;
23
}
24
25
void
toggle
(
const
unsigned
int
& i,
const
unsigned
int
& j)
26
{
27
data
^= 1UL << (i * H + j);
28
}
29
30
void
clear
(
const
unsigned
int
& i,
const
unsigned
int
& j)
31
{
32
data
&= ~(1UL << (i * H + j) );
33
}
34
35
36
};
37
38
}
// namespace lvr2
39
40
#endif // LVR2_ASCII_RENDERER_BITFIELD_HPP
lvr2::BitField::get
bool get(const unsigned int &i, const unsigned int &j) const
Definition:
BitField.hpp:20
lvr2::BitField::toggle
void toggle(const unsigned int &i, const unsigned int &j)
Definition:
BitField.hpp:25
lvr2::BitField::data
unsigned char data
Definition:
BitField.hpp:11
lvr2::BitField::BitField
BitField()
Definition:
BitField.hpp:13
lvr2
Definition:
BaseBufferManipulators.hpp:39
lvr2::BitField
Definition:
BitField.hpp:9
lvr2::BitField::clear
void clear(const unsigned int &i, const unsigned int &j)
Definition:
BitField.hpp:30
lvr2::BitField::set
void set(const unsigned int &i, const unsigned int &j)
Definition:
BitField.hpp:15
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz
, Alexander Mock
, Lars Kiesow
, Lukas Kalbertodt
, Tristan Igelbrink
, Johan M. von Behren
, Dominik Feldschnieders
, Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:22