tesseract  5.0.0
tesseract::ELIST2_ITERATOR Class Reference

#include <elst2.h>

Public Member Functions

 ELIST2_ITERATOR (ELIST2 *list_to_iterate)
 
void set_to_list (ELIST2 *list_to_iterate)
 
void add_after_then_move (ELIST2_LINK *new_link)
 
void add_after_stay_put (ELIST2_LINK *new_link)
 
void add_before_then_move (ELIST2_LINK *new_link)
 
void add_before_stay_put (ELIST2_LINK *new_link)
 
void add_list_after (ELIST2 *list_to_add)
 
void add_list_before (ELIST2 *list_to_add)
 
ELIST2_LINKdata ()
 
ELIST2_LINKdata_relative (int8_t offset)
 
ELIST2_LINKforward ()
 
ELIST2_LINKbackward ()
 
ELIST2_LINKextract ()
 
ELIST2_LINKmove_to_first ()
 
ELIST2_LINKmove_to_last ()
 
void mark_cycle_pt ()
 
bool empty () const
 
bool current_extracted () const
 
bool at_first () const
 
bool at_last () const
 
bool cycled_list () const
 
void add_to_end (ELIST2_LINK *new_link)
 
void exchange (ELIST2_ITERATOR *other_it)
 
int32_t length () const
 
void sort (int comparator(const void *, const void *))
 

Friends

void ELIST2::assign_to_sublist (ELIST2_ITERATOR *, ELIST2_ITERATOR *)
 

Detailed Description

Definition at line 151 of file elst2.h.

Constructor & Destructor Documentation

◆ ELIST2_ITERATOR()

tesseract::ELIST2_ITERATOR::ELIST2_ITERATOR ( ELIST2 list_to_iterate)
inline

Definition at line 289 of file elst2.h.

289  {
290  set_to_list(list_to_iterate);
291 }
void set_to_list(ELIST2 *list_to_iterate)
Definition: elst2.h:265

Member Function Documentation

◆ add_after_stay_put()

void tesseract::ELIST2_ITERATOR::add_after_stay_put ( ELIST2_LINK new_link)
inline

Definition at line 351 of file elst2.h.

352  {
353 #ifndef NDEBUG
354  if (!list) {
355  NO_LIST.error("ELIST2_ITERATOR::add_after_stay_put", ABORT, nullptr);
356  }
357  if (!new_element) {
358  BAD_PARAMETER.error("ELIST2_ITERATOR::add_after_stay_put", ABORT, "new_element is nullptr");
359  }
360  if (new_element->next) {
361  STILL_LINKED.error("ELIST2_ITERATOR::add_after_stay_put", ABORT, nullptr);
362  }
363 #endif
364 
365  if (list->empty()) {
366  new_element->next = new_element;
367  new_element->prev = new_element;
368  list->last = new_element;
369  prev = next = new_element;
370  ex_current_was_last = false;
371  current = nullptr;
372  } else {
373  new_element->next = next;
374  next->prev = new_element;
375 
376  if (current) { // not extracted
377  new_element->prev = current;
378  current->next = new_element;
379  if (prev == current) {
380  prev = new_element;
381  }
382  if (current == list->last) {
383  list->last = new_element;
384  }
385  } else { // current extracted
386  new_element->prev = prev;
387  prev->next = new_element;
388  if (ex_current_was_last) {
389  list->last = new_element;
390  ex_current_was_last = false;
391  }
392  }
393  next = new_element;
394  }
395 }
constexpr ERRCODE BAD_PARAMETER("List parameter error")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
constexpr ERRCODE NO_LIST("Iterator not set to a list")
@ ABORT
Definition: errcode.h:31
bool empty() const
Definition: elst2.h:99
void error(const char *caller, TessErrorLogCode action, const char *format,...) const __attribute__((format(printf
Definition: errcode.cpp:38

◆ add_after_then_move()

void tesseract::ELIST2_ITERATOR::add_after_then_move ( ELIST2_LINK new_link)
inline

Definition at line 300 of file elst2.h.

301  {
302 #ifndef NDEBUG
303  if (!list) {
304  NO_LIST.error("ELIST2_ITERATOR::add_after_then_move", ABORT, nullptr);
305  }
306  if (!new_element) {
307  BAD_PARAMETER.error("ELIST2_ITERATOR::add_after_then_move", ABORT, "new_element is nullptr");
308  }
309  if (new_element->next) {
310  STILL_LINKED.error("ELIST2_ITERATOR::add_after_then_move", ABORT, nullptr);
311  }
312 #endif
313 
314  if (list->empty()) {
315  new_element->next = new_element;
316  new_element->prev = new_element;
317  list->last = new_element;
318  prev = next = new_element;
319  } else {
320  new_element->next = next;
321  next->prev = new_element;
322 
323  if (current) { // not extracted
324  new_element->prev = current;
325  current->next = new_element;
326  prev = current;
327  if (current == list->last) {
328  list->last = new_element;
329  }
330  } else { // current extracted
331  new_element->prev = prev;
332  prev->next = new_element;
333  if (ex_current_was_last) {
334  list->last = new_element;
335  }
336  if (ex_current_was_cycle_pt) {
337  cycle_pt = new_element;
338  }
339  }
340  }
341  current = new_element;
342 }

◆ add_before_stay_put()

void tesseract::ELIST2_ITERATOR::add_before_stay_put ( ELIST2_LINK new_link)
inline

Definition at line 452 of file elst2.h.

453  {
454 #ifndef NDEBUG
455  if (!list) {
456  NO_LIST.error("ELIST2_ITERATOR::add_before_stay_put", ABORT, nullptr);
457  }
458  if (!new_element) {
459  BAD_PARAMETER.error("ELIST2_ITERATOR::add_before_stay_put", ABORT, "new_element is nullptr");
460  }
461  if (new_element->next) {
462  STILL_LINKED.error("ELIST2_ITERATOR::add_before_stay_put", ABORT, nullptr);
463  }
464 #endif
465 
466  if (list->empty()) {
467  new_element->next = new_element;
468  new_element->prev = new_element;
469  list->last = new_element;
470  prev = next = new_element;
471  ex_current_was_last = true;
472  current = nullptr;
473  } else {
474  prev->next = new_element;
475  new_element->prev = prev;
476 
477  if (current) { // not extracted
478  new_element->next = current;
479  current->prev = new_element;
480  if (next == current) {
481  next = new_element;
482  }
483  } else { // current extracted
484  new_element->next = next;
485  next->prev = new_element;
486  if (ex_current_was_last) {
487  list->last = new_element;
488  }
489  }
490  prev = new_element;
491  }
492 }

◆ add_before_then_move()

void tesseract::ELIST2_ITERATOR::add_before_then_move ( ELIST2_LINK new_link)
inline

Definition at line 404 of file elst2.h.

405  {
406 #ifndef NDEBUG
407  if (!list) {
408  NO_LIST.error("ELIST2_ITERATOR::add_before_then_move", ABORT, nullptr);
409  }
410  if (!new_element) {
411  BAD_PARAMETER.error("ELIST2_ITERATOR::add_before_then_move", ABORT, "new_element is nullptr");
412  }
413  if (new_element->next) {
414  STILL_LINKED.error("ELIST2_ITERATOR::add_before_then_move", ABORT, nullptr);
415  }
416 #endif
417 
418  if (list->empty()) {
419  new_element->next = new_element;
420  new_element->prev = new_element;
421  list->last = new_element;
422  prev = next = new_element;
423  } else {
424  prev->next = new_element;
425  new_element->prev = prev;
426 
427  if (current) { // not extracted
428  new_element->next = current;
429  current->prev = new_element;
430  next = current;
431  } else { // current extracted
432  new_element->next = next;
433  next->prev = new_element;
434  if (ex_current_was_last) {
435  list->last = new_element;
436  }
437  if (ex_current_was_cycle_pt) {
438  cycle_pt = new_element;
439  }
440  }
441  }
442  current = new_element;
443 }

◆ add_list_after()

void tesseract::ELIST2_ITERATOR::add_list_after ( ELIST2 list_to_add)
inline

Definition at line 502 of file elst2.h.

502  {
503 #ifndef NDEBUG
504  if (!list) {
505  NO_LIST.error("ELIST2_ITERATOR::add_list_after", ABORT, nullptr);
506  }
507  if (!list_to_add) {
508  BAD_PARAMETER.error("ELIST2_ITERATOR::add_list_after", ABORT, "list_to_add is nullptr");
509  }
510 #endif
511 
512  if (!list_to_add->empty()) {
513  if (list->empty()) {
514  list->last = list_to_add->last;
515  prev = list->last;
516  next = list->First();
517  ex_current_was_last = true;
518  current = nullptr;
519  } else {
520  if (current) { // not extracted
521  current->next = list_to_add->First();
522  current->next->prev = current;
523  if (current == list->last) {
524  list->last = list_to_add->last;
525  }
526  list_to_add->last->next = next;
527  next->prev = list_to_add->last;
528  next = current->next;
529  } else { // current extracted
530  prev->next = list_to_add->First();
531  prev->next->prev = prev;
532  if (ex_current_was_last) {
533  list->last = list_to_add->last;
534  ex_current_was_last = false;
535  }
536  list_to_add->last->next = next;
537  next->prev = list_to_add->last;
538  next = prev->next;
539  }
540  }
541  list_to_add->last = nullptr;
542  }
543 }

◆ add_list_before()

void tesseract::ELIST2_ITERATOR::add_list_before ( ELIST2 list_to_add)
inline

Definition at line 553 of file elst2.h.

553  {
554 #ifndef NDEBUG
555  if (!list) {
556  NO_LIST.error("ELIST2_ITERATOR::add_list_before", ABORT, nullptr);
557  }
558  if (!list_to_add) {
559  BAD_PARAMETER.error("ELIST2_ITERATOR::add_list_before", ABORT, "list_to_add is nullptr");
560  }
561 #endif
562 
563  if (!list_to_add->empty()) {
564  if (list->empty()) {
565  list->last = list_to_add->last;
566  prev = list->last;
567  current = list->First();
568  next = current->next;
569  ex_current_was_last = false;
570  } else {
571  prev->next = list_to_add->First();
572  prev->next->prev = prev;
573 
574  if (current) { // not extracted
575  list_to_add->last->next = current;
576  current->prev = list_to_add->last;
577  } else { // current extracted
578  list_to_add->last->next = next;
579  next->prev = list_to_add->last;
580  if (ex_current_was_last) {
581  list->last = list_to_add->last;
582  }
583  if (ex_current_was_cycle_pt) {
584  cycle_pt = prev->next;
585  }
586  }
587  current = prev->next;
588  next = current->next;
589  }
590  list_to_add->last = nullptr;
591  }
592 }

◆ add_to_end()

void tesseract::ELIST2_ITERATOR::add_to_end ( ELIST2_LINK new_link)
inline

Definition at line 792 of file elst2.h.

793  {
794 #ifndef NDEBUG
795  if (!list) {
796  NO_LIST.error("ELIST2_ITERATOR::add_to_end", ABORT, nullptr);
797  }
798  if (!new_element) {
799  BAD_PARAMETER.error("ELIST2_ITERATOR::add_to_end", ABORT, "new_element is nullptr");
800  }
801  if (new_element->next) {
802  STILL_LINKED.error("ELIST2_ITERATOR::add_to_end", ABORT, nullptr);
803  }
804 #endif
805 
806  if (this->at_last()) {
807  this->add_after_stay_put(new_element);
808  } else {
809  if (this->at_first()) {
810  this->add_before_stay_put(new_element);
811  list->last = new_element;
812  } else { // Iteratr is elsewhere
813  new_element->next = list->last->next;
814  new_element->prev = list->last;
815  list->last->next->prev = new_element;
816  list->last->next = new_element;
817  list->last = new_element;
818  }
819  }
820 }
bool at_first() const
Definition: elst2.h:712
void add_after_stay_put(ELIST2_LINK *new_link)
Definition: elst2.h:351
void add_before_stay_put(ELIST2_LINK *new_link)
Definition: elst2.h:452
bool at_last() const
Definition: elst2.h:732

◆ at_first()

bool tesseract::ELIST2_ITERATOR::at_first ( ) const
inline

Definition at line 712 of file elst2.h.

712  {
713 #ifndef NDEBUG
714  if (!list) {
715  NO_LIST.error("ELIST2_ITERATOR::at_first", ABORT, nullptr);
716  }
717 #endif
718 
719  // we're at a deleted
720  return ((list->empty()) || (current == list->First()) ||
721  ((current == nullptr) && (prev == list->last) && // NON-last pt between
722  !ex_current_was_last)); // first and last
723 }

◆ at_last()

bool tesseract::ELIST2_ITERATOR::at_last ( ) const
inline

Definition at line 732 of file elst2.h.

732  {
733 #ifndef NDEBUG
734  if (!list) {
735  NO_LIST.error("ELIST2_ITERATOR::at_last", ABORT, nullptr);
736  }
737 #endif
738 
739  // we're at a deleted
740  return ((list->empty()) || (current == list->last) ||
741  ((current == nullptr) && (prev == list->last) && // last point between
742  ex_current_was_last)); // first and last
743 }

◆ backward()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::backward ( )

Definition at line 207 of file elst2.cpp.

207  {
208 #ifndef NDEBUG
209  if (!list)
210  NO_LIST.error("ELIST2_ITERATOR::backward", ABORT, nullptr);
211 #endif
212  if (list->empty()) {
213  return nullptr;
214  }
215 
216  if (current) { // not removed so
217  // set previous
218  next = current;
219  started_cycling = true;
220  // In case prev is deleted by another iterator, get it from current.
221  current = current->prev;
222  } else {
223  if (ex_current_was_cycle_pt) {
224  cycle_pt = prev;
225  }
226  current = prev;
227  }
228 
229 #ifndef NDEBUG
230  if (!current)
231  NULL_DATA.error("ELIST2_ITERATOR::backward", ABORT, nullptr);
232  if (!prev)
233  NULL_PREV.error("ELIST2_ITERATOR::backward", ABORT, "This is: %p Current is: %p", this,
234  current);
235 #endif
236 
237  prev = current->prev;
238  return current;
239 }
constexpr ERRCODE NULL_PREV("Previous element on the list is nullptr")
constexpr ERRCODE NULL_DATA("List would have returned a nullptr data pointer")

◆ current_extracted()

bool tesseract::ELIST2_ITERATOR::current_extracted ( ) const
inline

Definition at line 228 of file elst2.h.

228  { // current extracted?
229  return !current;
230  }

◆ cycled_list()

bool tesseract::ELIST2_ITERATOR::cycled_list ( ) const
inline

Definition at line 752 of file elst2.h.

752  {
753 #ifndef NDEBUG
754  if (!list) {
755  NO_LIST.error("ELIST2_ITERATOR::cycled_list", ABORT, nullptr);
756  }
757 #endif
758 
759  return ((list->empty()) || ((current == cycle_pt) && started_cycling));
760 }

◆ data()

ELIST2_LINK* tesseract::ELIST2_ITERATOR::data ( )
inline

Definition at line 191 of file elst2.h.

191  { // get current data
192 #ifndef NDEBUG
193  if (!current) {
194  NULL_DATA.error("ELIST2_ITERATOR::data", ABORT, nullptr);
195  }
196  if (!list) {
197  NO_LIST.error("ELIST2_ITERATOR::data", ABORT, nullptr);
198  }
199 #endif
200  return current;
201  }

◆ data_relative()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::data_relative ( int8_t  offset)

Definition at line 248 of file elst2.cpp.

249  { // offset from current
250  ELIST2_LINK *ptr;
251 
252 #ifndef NDEBUG
253  if (!list)
254  NO_LIST.error("ELIST2_ITERATOR::data_relative", ABORT, nullptr);
255  if (list->empty())
256  EMPTY_LIST.error("ELIST2_ITERATOR::data_relative", ABORT, nullptr);
257 #endif
258 
259  if (offset < 0) {
260  for (ptr = current ? current : next; offset++ < 0; ptr = ptr->prev) {
261  ;
262  }
263  } else {
264  for (ptr = current ? current : prev; offset-- > 0; ptr = ptr->next) {
265  ;
266  }
267  }
268 
269 #ifndef NDEBUG
270  if (!ptr)
271  NULL_DATA.error("ELIST2_ITERATOR::data_relative", ABORT, nullptr);
272 #endif
273 
274  return ptr;
275 }
constexpr ERRCODE EMPTY_LIST("List is empty")

◆ empty()

bool tesseract::ELIST2_ITERATOR::empty ( ) const
inline

Definition at line 219 of file elst2.h.

219  { // is list empty?
220 #ifndef NDEBUG
221  if (!list) {
222  NO_LIST.error("ELIST2_ITERATOR::empty", ABORT, nullptr);
223  }
224 #endif
225  return list->empty();
226  }

◆ exchange()

void tesseract::ELIST2_ITERATOR::exchange ( ELIST2_ITERATOR other_it)

Definition at line 287 of file elst2.cpp.

288  { // other iterator
289  constexpr ERRCODE DONT_EXCHANGE_DELETED("Can't exchange deleted elements of lists");
290 
291  ELIST2_LINK *old_current;
292 
293 #ifndef NDEBUG
294  if (!list)
295  NO_LIST.error("ELIST2_ITERATOR::exchange", ABORT, nullptr);
296  if (!other_it)
297  BAD_PARAMETER.error("ELIST2_ITERATOR::exchange", ABORT, "other_it nullptr");
298  if (!(other_it->list))
299  NO_LIST.error("ELIST2_ITERATOR::exchange", ABORT, "other_it");
300 #endif
301 
302  /* Do nothing if either list is empty or if both iterators reference the same
303 link */
304 
305  if ((list->empty()) || (other_it->list->empty()) || (current == other_it->current)) {
306  return;
307  }
308 
309  /* Error if either current element is deleted */
310 
311  if (!current || !other_it->current) {
312  DONT_EXCHANGE_DELETED.error("ELIST2_ITERATOR.exchange", ABORT, nullptr);
313  }
314 
315  /* Now handle the 4 cases: doubleton list; non-doubleton adjacent elements
316 (other before this); non-doubleton adjacent elements (this before other);
317 non-adjacent elements. */
318 
319  // adjacent links
320  if ((next == other_it->current) || (other_it->next == current)) {
321  // doubleton list
322  if ((next == other_it->current) && (other_it->next == current)) {
323  prev = next = current;
324  other_it->prev = other_it->next = other_it->current;
325  } else { // non-doubleton with
326  // adjacent links
327  // other before this
328  if (other_it->next == current) {
329  other_it->prev->next = current;
330  other_it->current->next = next;
331  other_it->current->prev = current;
332  current->next = other_it->current;
333  current->prev = other_it->prev;
334  next->prev = other_it->current;
335 
336  other_it->next = other_it->current;
337  prev = current;
338  } else { // this before other
339  prev->next = other_it->current;
340  current->next = other_it->next;
341  current->prev = other_it->current;
342  other_it->current->next = current;
343  other_it->current->prev = prev;
344  other_it->next->prev = current;
345 
346  next = current;
347  other_it->prev = other_it->current;
348  }
349  }
350  } else { // no overlap
351  prev->next = other_it->current;
352  current->next = other_it->next;
353  current->prev = other_it->prev;
354  next->prev = other_it->current;
355  other_it->prev->next = current;
356  other_it->current->next = next;
357  other_it->current->prev = prev;
358  other_it->next->prev = current;
359  }
360 
361  /* update end of list pointer when necessary (remember that the 2 iterators
362  may iterate over different lists!) */
363 
364  if (list->last == current) {
365  list->last = other_it->current;
366  }
367  if (other_it->list->last == other_it->current) {
368  other_it->list->last = current;
369  }
370 
371  if (current == cycle_pt) {
372  cycle_pt = other_it->cycle_pt;
373  }
374  if (other_it->current == other_it->cycle_pt) {
375  other_it->cycle_pt = cycle_pt;
376  }
377 
378  /* The actual exchange - in all cases*/
379 
380  old_current = current;
381  current = other_it->current;
382  other_it->current = old_current;
383 }

◆ extract()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::extract ( )
inline

Definition at line 603 of file elst2.h.

603  {
604  ELIST2_LINK *extracted_link;
605 
606 #ifndef NDEBUG
607  if (!list) {
608  NO_LIST.error("ELIST2_ITERATOR::extract", ABORT, nullptr);
609  }
610  if (!current) { // list empty or
611  // element extracted
612  NULL_CURRENT.error("ELIST2_ITERATOR::extract", ABORT, nullptr);
613  }
614 #endif
615 
616  if (list->singleton()) {
617  // Special case where we do need to change the iterator.
618  prev = next = list->last = nullptr;
619  } else {
620  prev->next = next; // remove from list
621  next->prev = prev;
622 
623  if (current == list->last) {
624  list->last = prev;
625  ex_current_was_last = true;
626  } else {
627  ex_current_was_last = false;
628  }
629  }
630  // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
631  ex_current_was_cycle_pt = (current == cycle_pt);
632  extracted_link = current;
633  extracted_link->next = nullptr; // for safety
634  extracted_link->prev = nullptr; // for safety
635  current = nullptr;
636  return extracted_link;
637 }
constexpr ERRCODE NULL_CURRENT("List current position is nullptr")
bool singleton() const
Definition: elst2.h:103

◆ forward()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::forward ( )

Definition at line 162 of file elst2.cpp.

162  {
163 #ifndef NDEBUG
164  if (!list)
165  NO_LIST.error("ELIST2_ITERATOR::forward", ABORT, nullptr);
166 #endif
167  if (list->empty()) {
168  return nullptr;
169  }
170 
171  if (current) { // not removed so
172  // set previous
173  prev = current;
174  started_cycling = true;
175  // In case next is deleted by another iterator, get it from the current.
176  current = current->next;
177  } else {
178  if (ex_current_was_cycle_pt) {
179  cycle_pt = next;
180  }
181  current = next;
182  }
183 
184 #ifndef NDEBUG
185  if (!current)
186  NULL_DATA.error("ELIST2_ITERATOR::forward", ABORT, nullptr);
187 #endif
188 
189  next = current->next;
190 
191 #ifndef NDEBUG
192  if (!next)
193  NULL_NEXT.error("ELIST2_ITERATOR::forward", ABORT, "This is: %p Current is: %p", this,
194  current);
195 #endif
196 
197  return current;
198 }
constexpr ERRCODE NULL_NEXT("Next element on the list is nullptr")

◆ length()

int32_t tesseract::ELIST2_ITERATOR::length ( ) const
inline

Definition at line 245 of file elst2.h.

245  {
246  return list->length();
247  }
int32_t length() const
Definition: elst2.h:121

◆ mark_cycle_pt()

void tesseract::ELIST2_ITERATOR::mark_cycle_pt ( )
inline

Definition at line 690 of file elst2.h.

690  {
691 #ifndef NDEBUG
692  if (!list) {
693  NO_LIST.error("ELIST2_ITERATOR::mark_cycle_pt", ABORT, nullptr);
694  }
695 #endif
696 
697  if (current) {
698  cycle_pt = current;
699  } else {
700  ex_current_was_cycle_pt = true;
701  }
702  started_cycling = false;
703 }

◆ move_to_first()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::move_to_first ( )
inline

Definition at line 646 of file elst2.h.

646  {
647 #ifndef NDEBUG
648  if (!list) {
649  NO_LIST.error("ELIST2_ITERATOR::move_to_first", ABORT, nullptr);
650  }
651 #endif
652 
653  current = list->First();
654  prev = list->last;
655  next = current ? current->next : nullptr;
656  return current;
657 }

◆ move_to_last()

ELIST2_LINK * tesseract::ELIST2_ITERATOR::move_to_last ( )
inline

Definition at line 666 of file elst2.h.

666  {
667 #ifndef NDEBUG
668  if (!list) {
669  NO_LIST.error("ELIST2_ITERATOR::move_to_last", ABORT, nullptr);
670  }
671 #endif
672 
673  current = list->last;
674  prev = current ? current->prev : nullptr;
675  next = current ? current->next : nullptr;
676  return current;
677 }

◆ set_to_list()

void tesseract::ELIST2_ITERATOR::set_to_list ( ELIST2 list_to_iterate)
inline

Definition at line 265 of file elst2.h.

266  {
267 #ifndef NDEBUG
268  if (!list_to_iterate) {
269  BAD_PARAMETER.error("ELIST2_ITERATOR::set_to_list", ABORT, "list_to_iterate is nullptr");
270  }
271 #endif
272 
273  list = list_to_iterate;
274  prev = list->last;
275  current = list->First();
276  next = current ? current->next : nullptr;
277  cycle_pt = nullptr; // await explicit set
278  started_cycling = false;
279  ex_current_was_last = false;
280  ex_current_was_cycle_pt = false;
281 }

◆ sort()

void tesseract::ELIST2_ITERATOR::sort ( int   comparator const void *, const void *)
inline

Definition at line 769 of file elst2.h.

771  {
772 #ifndef NDEBUG
773  if (!list) {
774  NO_LIST.error("ELIST2_ITERATOR::sort", ABORT, nullptr);
775  }
776 #endif
777 
778  list->sort(comparator);
779  move_to_first();
780 }
void sort(int comparator(const void *, const void *))
Definition: elst2.cpp:88
ELIST2_LINK * move_to_first()
Definition: elst2.h:646

Friends And Related Function Documentation

◆ ELIST2::assign_to_sublist


The documentation for this class was generated from the following files: