# Katabatic Documentation

# Katabatic - Routing Toolbox

List of all members | Public Member Functions
LocatorHelper Class Reference

Locator Helper Collection's Locators. More...

## Public Member Functions

| LocatorHelper (AutoContact *, unsigned int flags=0)
bool | isValid () const
AutoSegment * | getSegment () const
void | progress ()

## Detailed Description

Locator Helper Collection's Locators.

Provide a small uniform walktough over the AutoSegments anchored on AutoContacts. The `flags` argument allows to choose between direction and include perpandiculars (in that case all segments are processeds).

# Implementation Details

As, at most, two horizontals and two verticals may be anchored on any AutoContact subtype, the locator helper perform a walk through a virtual table of 4 elements. The two first are the horizontals, the two last the verticals. The meaning of this index is consistent whith the `index` argument of AutoContact::getSegment(). When a segment is not present in an AutoContact, the `getSegment()` returns `NULL` and the LocatorHelper::progress() function will skip it.

The private methods:

- `LocatorHelper::_min()`
- `LocatorHelper::_max()`

Computes the bounds of `_index` according to the value of `_flags:`

- `KbHorizontal` : `0` to less than `2`.
- `KbVertical` : `2` to less than `4`.
- `KbHorizontal|KbVertical` : `0` to less than `4`.

## Constructor & Destructor Documentation

## ◆ LocatorHelper()

LocatorHelper | ( | AutoContact * | contact,
|  | unsigned int | flags = `0`
| ) |  |

inline

Create a helper to iterate over the AutoSegments anchored on `contact`. The `flags` arguments allow to select:

- The direction: Katabatic::KbHorizontal or Katabatic::KbVertical.
- Perpandicular inclusion: Katabatic::KbWithPerpands.

When setting KbWithPerpands, all the segments will be iterated over. It may seems a somewhat contorted way of doing things, the reason is the ability to share (an pass) flags directly between different functions.

References AutoContact::getSegment(), and LocatorHelper::progress().

## Member Function Documentation

## ◆ isValid()

bool isValid | ( |  | ) | const

inline

Returns: true if there is an AutoSegment to be processed.

## ◆ getSegment()

AutoSegment * getSegment | ( |  | ) | const

inline

Returns: The current AutoSegment. `NULL` if the loop is over.

References AutoContact::getSegment().

## ◆ progress()

void progress | ( |  | ) |

inline

Returns: Go to the next AutoSegment.

References AutoContact::getSegment().

Referenced by LocatorHelper::LocatorHelper().

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

- AutoContact.h
- AutoContact.dox