KiCad PCB EDA Suite
SHAPE_INDEX< T >::Iterator Class Reference

#include <shape_index.h>

Public Member Functions

 Iterator (SHAPE_INDEX *aIndex)
 Iterator constructor. More...
 
operator * ()
 Operator * (prefix) More...
 
bool operator++ ()
 Operator ++ (prefix) More...
 
bool operator++ (int)
 Operator ++ (postfix) More...
 
bool IsNull ()
 Function IsNull() More...
 
bool IsNotNull ()
 Function IsNotNull() More...
 
Next ()
 Function Next() More...
 

Private Types

typedef RTree< T, int, 2, double >::Iterator RTreeIterator
 

Private Member Functions

void Init (RTree< T, int, 2, double > *aTree)
 Function Init() More...
 

Private Attributes

RTreeIterator iterator
 

Detailed Description

template<class T = SHAPE*>
class SHAPE_INDEX< T >::Iterator

Definition at line 110 of file shape_index.h.

Member Typedef Documentation

◆ RTreeIterator

template<class T = SHAPE*>
typedef RTree<T, int, 2, double>::Iterator SHAPE_INDEX< T >::Iterator::RTreeIterator
private

Definition at line 113 of file shape_index.h.

Constructor & Destructor Documentation

◆ Iterator()

template<class T = SHAPE*>
SHAPE_INDEX< T >::Iterator::Iterator ( SHAPE_INDEX aIndex)
inline

Iterator constructor.

Creates an iterator for the index object

Parameters
aIndexSHAPE_INDEX object to iterate

Definition at line 134 of file shape_index.h.

135  {
136  Init( aIndex->m_tree );
137  }
void Init(RTree< T, int, 2, double > *aTree)
Function Init()
Definition: shape_index.h:122
RTree< T, int, 2, double > * m_tree
Definition: shape_index.h:290

References SHAPE_INDEX< T >::Iterator::Init(), and SHAPE_INDEX< T >::m_tree.

Member Function Documentation

◆ Init()

template<class T = SHAPE*>
void SHAPE_INDEX< T >::Iterator::Init ( RTree< T, int, 2, double > *  aTree)
inlineprivate

Function Init()

Setup the internal tree iterator.

Parameters
aTreepointer to a RTREE object

Definition at line 122 of file shape_index.h.

123  {
124  aTree->GetFirst( iterator );
125  }
void GetFirst(Iterator &a_it)
Get 'first' for iteration.
Definition: rtree.h:333
RTreeIterator iterator
Definition: shape_index.h:114

References RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::GetFirst(), and SHAPE_INDEX< T >::Iterator::iterator.

Referenced by SHAPE_INDEX< T >::Iterator::Iterator().

◆ IsNotNull()

template<class T = SHAPE*>
bool SHAPE_INDEX< T >::Iterator::IsNotNull ( )
inline

Function IsNotNull()

Checks if the iterator has not reached the end.

Returns
true if it is in an valid position (data not finished)

Definition at line 186 of file shape_index.h.

187  {
188  return iterator.IsNotNull();
189  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

◆ IsNull()

template<class T = SHAPE*>
bool SHAPE_INDEX< T >::Iterator::IsNull ( )
inline

Function IsNull()

Checks if the iterator has reached the end.

Returns
true if it is in an invalid position (data finished)

Definition at line 175 of file shape_index.h.

176  {
177  return iterator.IsNull();
178  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

Referenced by SHAPE_INDEX< T >::Accept(), and SHAPE_INDEX< T >::Reindex().

◆ Next()

template<class T = SHAPE*>
T SHAPE_INDEX< T >::Iterator::Next ( )
inline

Function Next()

Returns the current element of the iterator and moves to the next position.

Returns
SHAPE object pointed by the iterator before moving to the next position.

Definition at line 198 of file shape_index.h.

199  {
200  T object = *iterator;
201  ++iterator;
202 
203  return object;
204  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

◆ operator *()

template<class T = SHAPE*>
T SHAPE_INDEX< T >::Iterator::operator * ( )
inline

Operator * (prefix)

Returns the next data element.

Definition at line 144 of file shape_index.h.

145  {
146  return *iterator;
147  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

◆ operator++() [1/2]

template<class T = SHAPE*>
bool SHAPE_INDEX< T >::Iterator::operator++ ( )
inline

Operator ++ (prefix)

Shifts the iterator to the next element.

Definition at line 154 of file shape_index.h.

155  {
156  return ++iterator;
157  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

◆ operator++() [2/2]

template<class T = SHAPE*>
bool SHAPE_INDEX< T >::Iterator::operator++ ( int  )
inline

Operator ++ (postfix)

Shifts the iterator to the next element.

Definition at line 164 of file shape_index.h.

165  {
166  return ++iterator;
167  }
RTreeIterator iterator
Definition: shape_index.h:114

References SHAPE_INDEX< T >::Iterator::iterator.

Member Data Documentation

◆ iterator


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