tesseract  5.0.0
tesseract::WorkingPartSet Class Reference

#include <workingpartset.h>

Inheritance diagram for tesseract::WorkingPartSet:
tesseract::ELIST_LINK

Public Member Functions

 WorkingPartSet (ColPartition *column)
 
ColPartitioncolumn () const
 
void set_column (ColPartition *col)
 
void AddPartition (ColPartition *part)
 
void ExtractCompletedBlocks (const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *used_parts, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)
 
void InsertCompletedBlocks (BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks)
 
- Public Member Functions inherited from tesseract::ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Detailed Description

Definition at line 32 of file workingpartset.h.

Constructor & Destructor Documentation

◆ WorkingPartSet()

tesseract::WorkingPartSet::WorkingPartSet ( ColPartition column)
inlineexplicit

Definition at line 34 of file workingpartset.h.

35  : column_(column), latest_part_(nullptr), part_it_(&part_set_) {}
ColPartition * column() const

Member Function Documentation

◆ AddPartition()

void tesseract::WorkingPartSet::AddPartition ( ColPartition part)

Definition at line 29 of file workingpartset.cpp.

29  {
30  ColPartition *partner = part->SingletonPartner(true);
31  if (partner != nullptr) {
32  ASSERT_HOST(partner->SingletonPartner(false) == part);
33  }
34  if (latest_part_ == nullptr || partner == nullptr) {
35  // This partition goes at the end of the list
36  part_it_.move_to_last();
37  } else if (latest_part_->SingletonPartner(false) != part) {
38  // Reposition the iterator to the correct partner, or at the end.
39  for (part_it_.move_to_first(); !part_it_.at_last() && part_it_.data() != partner;
40  part_it_.forward()) {
41  ;
42  }
43  }
44  part_it_.add_after_then_move(part);
45  latest_part_ = part;
46 }
#define ASSERT_HOST(x)
Definition: errcode.h:59
ColPartition * SingletonPartner(bool upper)

◆ column()

ColPartition* tesseract::WorkingPartSet::column ( ) const
inline

Definition at line 38 of file workingpartset.h.

38  {
39  return column_;
40  }

◆ ExtractCompletedBlocks()

void tesseract::WorkingPartSet::ExtractCompletedBlocks ( const ICOORD bleft,
const ICOORD tright,
int  resolution,
ColPartition_LIST *  used_parts,
BLOCK_LIST *  blocks,
TO_BLOCK_LIST *  to_blocks 
)

Definition at line 54 of file workingpartset.cpp.

56  {
57  MakeBlocks(bleft, tright, resolution, used_parts);
58  BLOCK_IT block_it(blocks);
59  block_it.move_to_last();
60  block_it.add_list_after(&completed_blocks_);
61  TO_BLOCK_IT to_block_it(to_blocks);
62  to_block_it.move_to_last();
63  to_block_it.add_list_after(&to_blocks_);
64 }

◆ InsertCompletedBlocks()

void tesseract::WorkingPartSet::InsertCompletedBlocks ( BLOCK_LIST *  blocks,
TO_BLOCK_LIST *  to_blocks 
)

Definition at line 68 of file workingpartset.cpp.

68  {
69  BLOCK_IT block_it(&completed_blocks_);
70  block_it.add_list_before(blocks);
71  TO_BLOCK_IT to_block_it(&to_blocks_);
72  to_block_it.add_list_before(to_blocks);
73 }

◆ set_column()

void tesseract::WorkingPartSet::set_column ( ColPartition col)
inline

Definition at line 41 of file workingpartset.h.

41  {
42  column_ = col;
43  }

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