#include <clst.h>
Definition at line 64 of file clst.h.
◆ ~CLIST()
tesseract::CLIST::~CLIST |
( |
| ) |
|
|
inline |
◆ add_sorted()
bool tesseract::CLIST::add_sorted |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
void * |
new_data |
|
) |
| |
Definition at line 138 of file clst.cpp.
140 if (last ==
nullptr || comparator(&last->data, &new_data) < 0) {
141 auto *new_element =
new CLIST_LINK;
142 new_element->data = new_data;
143 if (last ==
nullptr) {
144 new_element->next = new_element;
146 new_element->next = last->next;
147 last->next = new_element;
151 }
else if (!unique || last->data != new_data) {
154 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
155 void *data = it.data();
156 if (data == new_data && unique) {
159 if (comparator(&data, &new_data) > 0) {
163 if (it.cycled_list()) {
164 it.add_to_end(new_data);
166 it.add_before_then_move(new_data);
friend class CLIST_ITERATOR
◆ assign_to_sublist()
Definition at line 86 of file clst.cpp.
89 constexpr ERRCODE LIST_NOT_EMPTY(
"Destination list must be empty before extracting a sublist");
92 LIST_NOT_EMPTY.error(
"CLIST.assign_to_sublist",
ABORT,
nullptr);
95 last = start_it->extract_sublist(end_it);
◆ empty()
bool tesseract::CLIST::empty |
( |
| ) |
const |
|
inline |
◆ internal_deep_clear()
void tesseract::CLIST::internal_deep_clear |
( |
void(*)(void *) |
zapper | ) |
|
Definition at line 36 of file clst.cpp.
39 auto ptr = last->next;
43 auto next = ptr->next;
◆ length()
int32_t tesseract::CLIST::length |
( |
| ) |
const |
|
inline |
Definition at line 106 of file clst.h.
108 if (last !=
nullptr) {
110 for (
auto it = last->next; it != last; it = it->next) {
◆ set_subtract()
void tesseract::CLIST::set_subtract |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
CLIST * |
minuend, |
|
|
CLIST * |
subtrahend |
|
) |
| |
Definition at line 178 of file clst.cpp.
185 for (m_it.mark_cycle_pt(); !m_it.cycled_list(); m_it.forward()) {
186 void *minu = m_it.data();
187 void *subtra =
nullptr;
189 subtra = s_it.data();
190 while (!s_it.at_last() && comparator(&subtra, &minu) < 0) {
192 subtra = s_it.data();
195 if (subtra ==
nullptr || comparator(&subtra, &minu) != 0) {
bool add_sorted(int comparator(const void *, const void *), bool unique, void *new_data)
◆ shallow_clear()
void tesseract::CLIST::shallow_clear |
( |
| ) |
|
Definition at line 60 of file clst.cpp.
62 auto ptr = last->next;
66 auto next = ptr->next;
◆ shallow_copy()
void tesseract::CLIST::shallow_copy |
( |
CLIST * |
from_list | ) |
|
|
inline |
Definition at line 97 of file clst.h.
99 last = from_list->last;
◆ singleton()
bool tesseract::CLIST::singleton |
( |
| ) |
const |
|
inline |
Definition at line 93 of file clst.h.
94 return last !=
nullptr ? (last == last->next) :
false;
◆ sort()
void tesseract::CLIST::sort |
( |
int |
comparator const void *, const void * | ) |
|
Definition at line 104 of file clst.cpp.
111 std::vector<void *> base;
117 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
118 base.push_back(it.extract());
122 qsort(&base[0], count,
sizeof(base[0]), comparator);
125 for (
auto current : base) {
126 it.add_to_end(current);
◆ CLIST_ITERATOR
The documentation for this class was generated from the following files: