#include <common_functions.h>
◆ DisjointSet() [1/2]
apollo::perception::camera::DisjointSet::DisjointSet |
( |
| ) |
|
|
inline |
◆ DisjointSet() [2/2]
apollo::perception::camera::DisjointSet::DisjointSet |
( |
size_t |
size | ) |
|
|
inlineexplicit |
在文件 common_functions.h 第 211 行定义.
211 : disjoint_array_(), subset_num_(0) {
212 disjoint_array_.reserve(size);
213 }
◆ ~DisjointSet()
apollo::perception::camera::DisjointSet::~DisjointSet |
( |
| ) |
|
|
inline |
◆ Add()
int apollo::perception::camera::DisjointSet::Add |
( |
| ) |
|
DisjointSet
在文件 common_functions.cc 第 26 行定义.
26 {
27 int cur_size = static_cast<int>(disjoint_array_.size());
28 disjoint_array_.push_back(cur_size);
29 ++subset_num_;
30 return cur_size;
31}
◆ Find()
int apollo::perception::camera::DisjointSet::Find |
( |
int |
x | ) |
|
在文件 common_functions.cc 第 33 行定义.
33 {
34 if (disjoint_array_[x] == x) {
35 return x;
36 }
37
38 int y = x;
39 while (y != disjoint_array_[y]) {
40 y = disjoint_array_[y];
41 }
42 while (true) {
43 const int z = disjoint_array_[x];
44 if (z == x) {
45 break;
46 }
47 disjoint_array_[x] = y;
48 x = z;
49 }
50 return y;
51}
◆ Init()
void apollo::perception::camera::DisjointSet::Init |
( |
size_t |
size | ) |
|
|
inline |
在文件 common_functions.h 第 216 行定义.
216 {
217 disjoint_array_.clear();
218 disjoint_array_.reserve(size);
219 subset_num_ = 0;
220 }
◆ Num()
size_t apollo::perception::camera::DisjointSet::Num |
( |
| ) |
const |
|
inline |
◆ Reset()
void apollo::perception::camera::DisjointSet::Reset |
( |
| ) |
|
|
inline |
◆ Size()
int apollo::perception::camera::DisjointSet::Size |
( |
| ) |
const |
|
inline |
◆ Unite()
void apollo::perception::camera::DisjointSet::Unite |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
在文件 common_functions.cc 第 54 行定义.
54 {
55 if (x == y) {
56 return;
57 }
60 if (x_root == y_root) {
61 return;
62 } else if (x_root < y_root) {
63 disjoint_array_[y_root] = x_root;
64 } else {
65 disjoint_array_[x_root] = y_root;
66 }
67 --subset_num_;
68}
该类的文档由以下文件生成: