tesseract  5.0.0-alpha-619-ge9db
tesseract::WorkingPartSet Class Reference

#include <workingpartset.h>

Inheritance diagram for tesseract::WorkingPartSet:
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 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_) {
36  }

Member Function Documentation

◆ AddPartition()

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

Definition at line 31 of file workingpartset.cpp.

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

◆ column()

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

Definition at line 39 of file workingpartset.h.

39  {
40  return column_;
41  }

◆ 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 55 of file workingpartset.cpp.

60  {
61  MakeBlocks(bleft, tright, resolution, used_parts);
62  BLOCK_IT block_it(blocks);
63  block_it.move_to_last();
64  block_it.add_list_after(&completed_blocks_);
65  TO_BLOCK_IT to_block_it(to_blocks);
66  to_block_it.move_to_last();
67  to_block_it.add_list_after(&to_blocks_);
68 }

◆ InsertCompletedBlocks()

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

Definition at line 72 of file workingpartset.cpp.

73  {
74  BLOCK_IT block_it(&completed_blocks_);
75  block_it.add_list_before(blocks);
76  TO_BLOCK_IT to_block_it(&to_blocks_);
77  to_block_it.add_list_before(to_blocks);
78 }

◆ set_column()

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

Definition at line 42 of file workingpartset.h.

42  {
43  column_ = col;
44  }

The documentation for this class was generated from the following files:
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
tesseract::ColPartition::SingletonPartner
ColPartition * SingletonPartner(bool upper)
Definition: colpartition.cpp:629
tesseract::WorkingPartSet::column
ColPartition * column() const
Definition: workingpartset.h:39