#include <elst2.h>
Definition at line 86 of file elst2.h.
◆ add_sorted()
void tesseract::ELIST2::add_sorted |
( |
int |
comparatorconst void *, const void *, |
|
|
ELIST2_LINK * |
new_link |
|
) |
| |
Definition at line 120 of file elst2.cpp.
122 if (last ==
nullptr || comparator(&last, &new_link) < 0) {
123 if (last ==
nullptr) {
124 new_link->next = new_link;
125 new_link->prev = new_link;
127 new_link->next = last->next;
128 new_link->prev = last;
129 last->next = new_link;
130 new_link->next->prev = new_link;
136 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
137 ELIST2_LINK *link = it.data();
138 if (comparator(&link, &new_link) > 0) {
142 if (it.cycled_list()) {
143 it.add_to_end(new_link);
145 it.add_before_then_move(new_link);
friend class ELIST2_ITERATOR
◆ assign_to_sublist()
Definition at line 68 of file elst2.cpp.
71 constexpr ERRCODE LIST_NOT_EMPTY(
"Destination list must be empty before extracting a sublist");
74 LIST_NOT_EMPTY.error(
"ELIST2.assign_to_sublist",
ABORT,
nullptr);
77 last = start_it->extract_sublist(end_it);
◆ empty()
bool tesseract::ELIST2::empty |
( |
| ) |
const |
|
inline |
◆ internal_clear()
void tesseract::ELIST2::internal_clear |
( |
void(*)(void *) |
zapper | ) |
|
◆ internal_deep_copy()
◆ length()
int32_t tesseract::ELIST2::length |
( |
| ) |
const |
|
inline |
Definition at line 121 of file elst2.h.
123 if (last !=
nullptr) {
125 for (
auto it = last->next; it != last; it = it->next) {
◆ shallow_copy()
void tesseract::ELIST2::shallow_copy |
( |
ELIST2 * |
from_list | ) |
|
|
inline |
Definition at line 107 of file elst2.h.
109 last = from_list->last;
◆ singleton()
bool tesseract::ELIST2::singleton |
( |
| ) |
const |
|
inline |
◆ sort()
void tesseract::ELIST2::sort |
( |
int |
comparator const void *, const void * | ) |
|
Definition at line 88 of file elst2.cpp.
95 std::vector<ELIST2_LINK *> base;
101 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
102 base.push_back(it.extract());
106 qsort(&base[0], count,
sizeof(base[0]), comparator);
109 for (
auto current : base) {
110 it.add_to_end(current);
◆ ELIST2_ITERATOR
The documentation for this class was generated from the following files: