forked from NVIDIA-AI-IOT/deepstream_pose_estimation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cover_table.hpp
68 lines (56 loc) · 953 Bytes
/
cover_table.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include <memory>
#include <vector>
class CoverTable
{
public:
CoverTable(int nrows, int ncols) : nrows(nrows), ncols(ncols)
{
rows.resize(nrows);
cols.resize(ncols);
}
inline void coverRow(int row)
{
rows[row] = 1;
}
inline void coverCol(int col)
{
cols[col] = 1;
}
inline void uncoverRow(int row)
{
rows[row] = 0;
}
inline void uncoverCol(int col)
{
cols[col] = 0;
}
inline bool isCovered(int row, int col) const
{
return rows[row] || cols[col];
}
inline bool isRowCovered(int row) const
{
return rows[row];
}
inline bool isColCovered(int col) const
{
return cols[col];
}
inline void clear()
{
for (int i = 0; i < nrows; i++)
{
uncoverRow(i);
}
for (int j = 0; j < ncols; j++)
{
uncoverCol(j);
}
}
const int nrows;
const int ncols;
private:
std::vector<bool> rows;
std::vector<bool> cols;
};