tesseract  4.1.0
ELIST_ITERATOR Class Reference

#include <elst.h>

Public Member Functions

 ELIST_ITERATOR ()
 
 ELIST_ITERATOR (ELIST *list_to_iterate)
 
void set_to_list (ELIST *list_to_iterate)
 
void add_after_then_move (ELIST_LINK *new_link)
 
void add_after_stay_put (ELIST_LINK *new_link)
 
void add_before_then_move (ELIST_LINK *new_link)
 
void add_before_stay_put (ELIST_LINK *new_link)
 
void add_list_after (ELIST *list_to_add)
 
void add_list_before (ELIST *list_to_add)
 
ELIST_LINKdata ()
 
ELIST_LINKdata_relative (int8_t offset)
 
ELIST_LINKforward ()
 
ELIST_LINKextract ()
 
ELIST_LINKmove_to_first ()
 
ELIST_LINKmove_to_last ()
 
void mark_cycle_pt ()
 
bool empty ()
 
bool current_extracted ()
 
bool at_first ()
 
bool at_last ()
 
bool cycled_list ()
 
void add_to_end (ELIST_LINK *new_link)
 
void exchange (ELIST_ITERATOR *other_it)
 
int32_t length ()
 
void sort (int comparator( const void *, const void *))
 

Friends

void ELIST::assign_to_sublist (ELIST_ITERATOR *, ELIST_ITERATOR *)
 

Detailed Description

Definition at line 185 of file elst.h.

Constructor & Destructor Documentation

ELIST_ITERATOR::ELIST_ITERATOR ( )
inline

Definition at line 206 of file elst.h.

206  { //constructor
207  list = nullptr;
208  } //unassigned list
ELIST_ITERATOR::ELIST_ITERATOR ( ELIST list_to_iterate)
inlineexplicit

Definition at line 320 of file elst.h.

320  {
321  set_to_list(list_to_iterate);
322 }
void set_to_list(ELIST *list_to_iterate)
Definition: elst.h:295

Member Function Documentation

void ELIST_ITERATOR::add_after_stay_put ( ELIST_LINK new_link)
inline

Definition at line 377 of file elst.h.

378  {
379  #ifndef NDEBUG
380  if (!list)
381  NO_LIST.error ("ELIST_ITERATOR::add_after_stay_put", ABORT, nullptr);
382  if (!new_element)
383  BAD_PARAMETER.error ("ELIST_ITERATOR::add_after_stay_put", ABORT,
384  "new_element is nullptr");
385  if (new_element->next)
386  STILL_LINKED.error ("ELIST_ITERATOR::add_after_stay_put", ABORT, nullptr);
387  #endif
388 
389  if (list->empty ()) {
390  new_element->next = new_element;
391  list->last = new_element;
392  prev = next = new_element;
393  ex_current_was_last = false;
394  current = nullptr;
395  }
396  else {
397  new_element->next = next;
398 
399  if (current) { //not extracted
400  current->next = new_element;
401  if (prev == current)
402  prev = new_element;
403  if (current == list->last)
404  list->last = new_element;
405  }
406  else { //current extracted
407  prev->next = new_element;
408  if (ex_current_was_last) {
409  list->last = new_element;
410  ex_current_was_last = false;
411  }
412  }
413  next = new_element;
414  }
415 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
void ELIST_ITERATOR::add_after_then_move ( ELIST_LINK new_link)
inline

Definition at line 332 of file elst.h.

333  {
334  #ifndef NDEBUG
335  if (!list)
336  NO_LIST.error ("ELIST_ITERATOR::add_after_then_move", ABORT, nullptr);
337  if (!new_element)
338  BAD_PARAMETER.error ("ELIST_ITERATOR::add_after_then_move", ABORT,
339  "new_element is nullptr");
340  if (new_element->next)
341  STILL_LINKED.error ("ELIST_ITERATOR::add_after_then_move", ABORT, nullptr);
342  #endif
343 
344  if (list->empty ()) {
345  new_element->next = new_element;
346  list->last = new_element;
347  prev = next = new_element;
348  }
349  else {
350  new_element->next = next;
351 
352  if (current) { //not extracted
353  current->next = new_element;
354  prev = current;
355  if (current == list->last)
356  list->last = new_element;
357  }
358  else { //current extracted
359  prev->next = new_element;
360  if (ex_current_was_last)
361  list->last = new_element;
362  if (ex_current_was_cycle_pt)
363  cycle_pt = new_element;
364  }
365  }
366  current = new_element;
367 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
void ELIST_ITERATOR::add_before_stay_put ( ELIST_LINK new_link)
inline

Definition at line 466 of file elst.h.

467  {
468  #ifndef NDEBUG
469  if (!list)
470  NO_LIST.error ("ELIST_ITERATOR::add_before_stay_put", ABORT, nullptr);
471  if (!new_element)
472  BAD_PARAMETER.error ("ELIST_ITERATOR::add_before_stay_put", ABORT,
473  "new_element is nullptr");
474  if (new_element->next)
475  STILL_LINKED.error ("ELIST_ITERATOR::add_before_stay_put", ABORT, nullptr);
476  #endif
477 
478  if (list->empty ()) {
479  new_element->next = new_element;
480  list->last = new_element;
481  prev = next = new_element;
482  ex_current_was_last = true;
483  current = nullptr;
484  }
485  else {
486  prev->next = new_element;
487  if (current) { //not extracted
488  new_element->next = current;
489  if (next == current)
490  next = new_element;
491  }
492  else { //current extracted
493  new_element->next = next;
494  if (ex_current_was_last)
495  list->last = new_element;
496  }
497  prev = new_element;
498  }
499 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
void ELIST_ITERATOR::add_before_then_move ( ELIST_LINK new_link)
inline

Definition at line 425 of file elst.h.

426  {
427  #ifndef NDEBUG
428  if (!list)
429  NO_LIST.error ("ELIST_ITERATOR::add_before_then_move", ABORT, nullptr);
430  if (!new_element)
431  BAD_PARAMETER.error ("ELIST_ITERATOR::add_before_then_move", ABORT,
432  "new_element is nullptr");
433  if (new_element->next)
434  STILL_LINKED.error ("ELIST_ITERATOR::add_before_then_move", ABORT, nullptr);
435  #endif
436 
437  if (list->empty ()) {
438  new_element->next = new_element;
439  list->last = new_element;
440  prev = next = new_element;
441  }
442  else {
443  prev->next = new_element;
444  if (current) { //not extracted
445  new_element->next = current;
446  next = current;
447  }
448  else { //current extracted
449  new_element->next = next;
450  if (ex_current_was_last)
451  list->last = new_element;
452  if (ex_current_was_cycle_pt)
453  cycle_pt = new_element;
454  }
455  }
456  current = new_element;
457 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
void ELIST_ITERATOR::add_list_after ( ELIST list_to_add)
inline

Definition at line 509 of file elst.h.

509  {
510  #ifndef NDEBUG
511  if (!list)
512  NO_LIST.error ("ELIST_ITERATOR::add_list_after", ABORT, nullptr);
513  if (!list_to_add)
514  BAD_PARAMETER.error ("ELIST_ITERATOR::add_list_after", ABORT,
515  "list_to_add is nullptr");
516  #endif
517 
518  if (!list_to_add->empty ()) {
519  if (list->empty ()) {
520  list->last = list_to_add->last;
521  prev = list->last;
522  next = list->First ();
523  ex_current_was_last = true;
524  current = nullptr;
525  }
526  else {
527  if (current) { //not extracted
528  current->next = list_to_add->First ();
529  if (current == list->last)
530  list->last = list_to_add->last;
531  list_to_add->last->next = next;
532  next = current->next;
533  }
534  else { //current extracted
535  prev->next = list_to_add->First ();
536  if (ex_current_was_last) {
537  list->last = list_to_add->last;
538  ex_current_was_last = false;
539  }
540  list_to_add->last->next = next;
541  next = prev->next;
542  }
543  }
544  list_to_add->last = nullptr;
545  }
546 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
void ELIST_ITERATOR::add_list_before ( ELIST list_to_add)
inline

Definition at line 557 of file elst.h.

557  {
558  #ifndef NDEBUG
559  if (!list)
560  NO_LIST.error ("ELIST_ITERATOR::add_list_before", ABORT, nullptr);
561  if (!list_to_add)
562  BAD_PARAMETER.error ("ELIST_ITERATOR::add_list_before", ABORT,
563  "list_to_add is nullptr");
564  #endif
565 
566  if (!list_to_add->empty ()) {
567  if (list->empty ()) {
568  list->last = list_to_add->last;
569  prev = list->last;
570  current = list->First ();
571  next = current->next;
572  ex_current_was_last = false;
573  }
574  else {
575  prev->next = list_to_add->First ();
576  if (current) { //not extracted
577  list_to_add->last->next = current;
578  }
579  else { //current extracted
580  list_to_add->last->next = next;
581  if (ex_current_was_last)
582  list->last = list_to_add->last;
583  if (ex_current_was_cycle_pt)
584  cycle_pt = prev->next;
585  }
586  current = prev->next;
587  next = current->next;
588  }
589  list_to_add->last = nullptr;
590  }
591 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
void ELIST_ITERATOR::add_to_end ( ELIST_LINK new_link)
inline

Definition at line 784 of file elst.h.

785  {
786  #ifndef NDEBUG
787  if (!list)
788  NO_LIST.error ("ELIST_ITERATOR::add_to_end", ABORT, nullptr);
789  if (!new_element)
790  BAD_PARAMETER.error ("ELIST_ITERATOR::add_to_end", ABORT,
791  "new_element is nullptr");
792  if (new_element->next)
793  STILL_LINKED.error ("ELIST_ITERATOR::add_to_end", ABORT, nullptr);
794  #endif
795 
796  if (this->at_last ()) {
797  this->add_after_stay_put (new_element);
798  }
799  else {
800  if (this->at_first ()) {
801  this->add_before_stay_put (new_element);
802  list->last = new_element;
803  }
804  else { //Iteratr is elsewhere
805  new_element->next = list->last->next;
806  list->last->next = new_element;
807  list->last = new_element;
808  }
809  }
810 }
bool at_first()
Definition: elst.h:685
void add_after_stay_put(ELIST_LINK *new_link)
Definition: elst.h:377
bool at_last()
Definition: elst.h:705
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE STILL_LINKED("Attempting to add an element with non nullptr links, to a list")
void add_before_stay_put(ELIST_LINK *new_link)
Definition: elst.h:466
bool ELIST_ITERATOR::at_first ( )
inline

Definition at line 685 of file elst.h.

685  {
686  #ifndef NDEBUG
687  if (!list)
688  NO_LIST.error ("ELIST_ITERATOR::at_first", ABORT, nullptr);
689  #endif
690 
691  //we're at a deleted
692  return ((list->empty ()) || (current == list->First ()) || ((current == nullptr) &&
693  (prev == list->last) && //NON-last pt between
694  !ex_current_was_last)); //first and last
695 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
bool ELIST_ITERATOR::at_last ( )
inline

Definition at line 705 of file elst.h.

705  {
706  #ifndef NDEBUG
707  if (!list)
708  NO_LIST.error ("ELIST_ITERATOR::at_last", ABORT, nullptr);
709  #endif
710 
711  //we're at a deleted
712  return ((list->empty ()) || (current == list->last) || ((current == nullptr) &&
713  (prev == list->last) && //last point between
714  ex_current_was_last)); //first and last
715 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
bool ELIST_ITERATOR::current_extracted ( )
inline

Definition at line 264 of file elst.h.

264  { //current extracted?
265  return !current;
266  }
bool ELIST_ITERATOR::cycled_list ( )
inline

Definition at line 725 of file elst.h.

725  {
726  #ifndef NDEBUG
727  if (!list)
728  NO_LIST.error ("ELIST_ITERATOR::cycled_list", ABORT, nullptr);
729  #endif
730 
731  return ((list->empty ()) || ((current == cycle_pt) && started_cycling));
732 
733 }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
ELIST_LINK* ELIST_ITERATOR::data ( )
inline

Definition at line 233 of file elst.h.

233  { //get current data
234  #ifndef NDEBUG
235  if (!list)
236  NO_LIST.error ("ELIST_ITERATOR::data", ABORT, nullptr);
237  if (!current)
238  NULL_DATA.error ("ELIST_ITERATOR::data", ABORT, nullptr);
239  #endif
240  return current;
241  }
constexpr ERRCODE NULL_DATA("List would have returned a nullptr data pointer")
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
ELIST_LINK * ELIST_ITERATOR::data_relative ( int8_t  offset)

Definition at line 234 of file elst.cpp.

235  { //offset from current
236  ELIST_LINK *ptr;
237 
238  #ifndef NDEBUG
239  if (!list)
240  NO_LIST.error ("ELIST_ITERATOR::data_relative", ABORT, nullptr);
241  if (list->empty ())
242  EMPTY_LIST.error ("ELIST_ITERATOR::data_relative", ABORT, nullptr);
243  if (offset < -1)
244  BAD_PARAMETER.error ("ELIST_ITERATOR::data_relative", ABORT,
245  "offset < -l");
246  #endif
247 
248  if (offset == -1)
249  ptr = prev;
250  else
251  for (ptr = current ? current : prev; offset-- > 0; ptr = ptr->next);
252 
253  #ifndef NDEBUG
254  if (!ptr)
255  NULL_DATA.error ("ELIST_ITERATOR::data_relative", ABORT, nullptr);
256  #endif
257 
258  return ptr;
259 }
bool empty() const
Definition: elst.h:130
constexpr ERRCODE NULL_DATA("List would have returned a nullptr data pointer")
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE EMPTY_LIST("List is empty")
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
bool ELIST_ITERATOR::empty ( )
inline

Definition at line 256 of file elst.h.

256  { //is list empty?
257  #ifndef NDEBUG
258  if (!list)
259  NO_LIST.error ("ELIST_ITERATOR::empty", ABORT, nullptr);
260  #endif
261  return list->empty ();
262  }
bool empty() const
Definition: elst.h:130
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
void ELIST_ITERATOR::exchange ( ELIST_ITERATOR other_it)

Definition at line 291 of file elst.cpp.

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

Definition at line 603 of file elst.h.

603  {
604  ELIST_LINK *extracted_link;
605 
606  #ifndef NDEBUG
607  if (!list)
608  NO_LIST.error ("ELIST_ITERATOR::extract", ABORT, nullptr);
609  if (!current) //list empty or
610  //element extracted
611  NULL_CURRENT.error ("ELIST_ITERATOR::extract",
612  ABORT, nullptr);
613  #endif
614 
615  if (list->singleton()) {
616  // Special case where we do need to change the iterator.
617  prev = next = list->last = nullptr;
618  } else {
619  prev->next = next; //remove from list
620 
621  ex_current_was_last = (current == list->last);
622  if (ex_current_was_last) list->last = prev;
623  }
624  // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
625  ex_current_was_cycle_pt = (current == cycle_pt);
626  extracted_link = current;
627  extracted_link->next = nullptr; //for safety
628  current = nullptr;
629  return extracted_link;
630 }
bool singleton() const
Definition: elst.h:134
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE NULL_CURRENT("List current position is nullptr")
ELIST_LINK * ELIST_ITERATOR::forward ( )

Definition at line 193 of file elst.cpp.

193  {
194  #ifndef NDEBUG
195  if (!list)
196  NO_LIST.error ("ELIST_ITERATOR::forward", ABORT, nullptr);
197  #endif
198  if (list->empty ())
199  return nullptr;
200 
201  if (current) { //not removed so
202  //set previous
203  prev = current;
204  started_cycling = true;
205  // In case next is deleted by another iterator, get next from current.
206  current = current->next;
207  } else {
208  if (ex_current_was_cycle_pt)
209  cycle_pt = next;
210  current = next;
211  }
212 #ifndef NDEBUG
213  if (!current)
214  NULL_DATA.error ("ELIST_ITERATOR::forward", ABORT, nullptr);
215 #endif
216  next = current->next;
217 
218  #ifndef NDEBUG
219  if (!next)
220  NULL_NEXT.error ("ELIST_ITERATOR::forward", ABORT,
221  "This is: %p Current is: %p", this, current);
222  #endif
223  return current;
224 }
bool empty() const
Definition: elst.h:130
constexpr ERRCODE NULL_DATA("List would have returned a nullptr data pointer")
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
constexpr ERRCODE NULL_NEXT("Next element on the list is nullptr")
int32_t ELIST_ITERATOR::length ( )
inline

Definition at line 743 of file elst.h.

743  {
744  #ifndef NDEBUG
745  if (!list)
746  NO_LIST.error ("ELIST_ITERATOR::length", ABORT, nullptr);
747  #endif
748 
749  return list->length ();
750 }
int32_t length() const
Definition: elst.cpp:89
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
void ELIST_ITERATOR::mark_cycle_pt ( )
inline

Definition at line 664 of file elst.h.

664  {
665  #ifndef NDEBUG
666  if (!list)
667  NO_LIST.error ("ELIST_ITERATOR::mark_cycle_pt", ABORT, nullptr);
668  #endif
669 
670  if (current)
671  cycle_pt = current;
672  else
673  ex_current_was_cycle_pt = true;
674  started_cycling = false;
675 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
ELIST_LINK * ELIST_ITERATOR::move_to_first ( )
inline

Definition at line 640 of file elst.h.

640  {
641  #ifndef NDEBUG
642  if (!list)
643  NO_LIST.error ("ELIST_ITERATOR::move_to_first", ABORT, nullptr);
644  #endif
645 
646  current = list->First ();
647  prev = list->last;
648  next = current ? current->next : nullptr;
649  return current;
650 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
ELIST_LINK * ELIST_ITERATOR::move_to_last ( )

Definition at line 269 of file elst.cpp.

269  {
270  #ifndef NDEBUG
271  if (!list)
272  NO_LIST.error ("ELIST_ITERATOR::move_to_last", ABORT, nullptr);
273  #endif
274 
275  while (current != list->last)
276  forward();
277 
278  return current;
279 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")
ELIST_LINK * forward()
Definition: elst.cpp:193
void ELIST_ITERATOR::set_to_list ( ELIST list_to_iterate)
inline

Definition at line 295 of file elst.h.

296  {
297  #ifndef NDEBUG
298  if (!list_to_iterate)
299  BAD_PARAMETER.error ("ELIST_ITERATOR::set_to_list", ABORT,
300  "list_to_iterate is nullptr");
301  #endif
302 
303  list = list_to_iterate;
304  prev = list->last;
305  current = list->First ();
306  next = current ? current->next : nullptr;
307  cycle_pt = nullptr; //await explicit set
308  started_cycling = false;
309  ex_current_was_last = false;
310  ex_current_was_cycle_pt = false;
311 }
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
constexpr ERRCODE BAD_PARAMETER("List parameter error")
Definition: errcode.h:29
void ELIST_ITERATOR::sort ( int   comparator const void *, const void *)
inline

Definition at line 761 of file elst.h.

763  {
764  #ifndef NDEBUG
765  if (!list)
766  NO_LIST.error ("ELIST_ITERATOR::sort", ABORT, nullptr);
767  #endif
768 
769  list->sort (comparator);
770  move_to_first();
771 }
ELIST_LINK * move_to_first()
Definition: elst.h:640
void sort(int comparator( const void *, const void *))
Definition: elst.cpp:107
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
Definition: errcode.cpp:35
Definition: errcode.h:29
constexpr ERRCODE NO_LIST("Iterator not set to a list")

Friends And Related Function Documentation


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