degate  0.1.2
Public Member Functions | Private Member Functions | Private Attributes
degate::down_iterator< T > Class Template Reference

#include <QuadTreeDownIterator.h>

List of all members.

Public Member Functions

 down_iterator ()
 down_iterator (QuadTree< T > *node)
virtual ~down_iterator ()
virtual down_iteratoroperator= (const down_iterator &other)
virtual down_iteratoroperator++ ()
virtual bool operator== (const down_iterator &other) const
virtual bool operator!= (const down_iterator &other) const
virtual T * operator-> () const
virtual T operator* () const

Private Member Functions

void next_node ()

Private Attributes

QuadTree< T > * node
bool done
std::list< T >::iterator children_iter
std::list< T >::iterator children_iter_end
std::list< QuadTree< T > * > open_list

Detailed Description

template<typename T>
class degate::down_iterator< T >

Definition at line 30 of file QuadTreeDownIterator.h.


Constructor & Destructor Documentation

template<typename T >
degate::down_iterator< T >::down_iterator ( )

Definition at line 57 of file QuadTreeDownIterator.h.

                                : node(NULL), done(true) {
}
template<typename T >
degate::down_iterator< T >::down_iterator ( QuadTree< T > *  node)

Definition at line 61 of file QuadTreeDownIterator.h.

References degate::down_iterator< T >::next_node(), and degate::down_iterator< T >::open_list.

                                                   :
  node(NULL),
  done(false) {

  assert(_node != NULL);

  open_list.push_back(_node);
  next_node();
}

Here is the call graph for this function:

template<typename T >
virtual degate::down_iterator< T >::~down_iterator ( ) [inline, virtual]

Definition at line 46 of file QuadTreeDownIterator.h.

{}

Member Function Documentation

template<typename T >
void degate::down_iterator< T >::next_node ( ) [private]

Definition at line 72 of file QuadTreeDownIterator.h.

References degate::QuadTree< T >::subtree_nodes.

Referenced by degate::down_iterator< T >::down_iterator().

                                 {
  if(node == NULL) {
    if(open_list.size() > 0) {
      node = open_list.front();
      open_list.pop_front();

      // add subtree nodes to open list
      for(typename std::vector<QuadTree<T> >::iterator it = node->subtree_nodes.begin();
          it != node->subtree_nodes.end();
          ++it)
        open_list.push_back(&*it);

      // reset iterator for current
      children_iter = node->children.begin();
      children_iter_end = node->children.end();

      if(children_iter == children_iter_end) {
        done = true;
      }

    }
    else {
      done = true;
    }
  }

}

Here is the caller graph for this function:

template<typename T >
bool degate::down_iterator< T >::operator!= ( const down_iterator< T > &  other) const [virtual]

Definition at line 140 of file QuadTreeDownIterator.h.

                                                                  {
  return !(*this == other);
}
template<typename T >
T degate::down_iterator< T >::operator* ( ) const [virtual]

Definition at line 150 of file QuadTreeDownIterator.h.

                                    {
  return *children_iter;
}
template<typename T >
down_iterator< T > & degate::down_iterator< T >::operator++ ( ) [virtual]

Definition at line 101 of file QuadTreeDownIterator.h.

                                               {

  if(!done) {
    ++children_iter;
  }

  if(!done && children_iter == children_iter_end) {
    node = NULL;
    next_node();
  }


  return (*this);
}
template<typename T >
T * degate::down_iterator< T >::operator-> ( ) const [virtual]

Definition at line 145 of file QuadTreeDownIterator.h.

                                       {
  return &*children_iter;
}
template<typename T >
down_iterator< T > & degate::down_iterator< T >::operator= ( const down_iterator< T > &  other) [virtual]

Definition at line 117 of file QuadTreeDownIterator.h.

References degate::down_iterator< T >::children_iter, degate::down_iterator< T >::children_iter_end, degate::down_iterator< T >::done, degate::down_iterator< T >::node, and degate::down_iterator< T >::open_list.

                                                                        {
  node = other.node;
  done = other.done;
  open_list = other.open_list;
  children_iter = other.children_iter;
  children_iter_end = other.children_iter_end;
  return(*this);
}
template<typename T >
bool degate::down_iterator< T >::operator== ( const down_iterator< T > &  other) const [virtual]

Definition at line 127 of file QuadTreeDownIterator.h.

References degate::down_iterator< T >::children_iter, degate::down_iterator< T >::done, degate::down_iterator< T >::node, and degate::down_iterator< T >::open_list.

                                                                  {

  if(done == true && other.done == true)
    return true;
  else
    return (node == other.node &&
            children_iter == other.children_iter &&
            open_list == other.open_list &&
            done == other.done);
}

Member Data Documentation

template<typename T >
std::list<T>::iterator degate::down_iterator< T >::children_iter [private]
template<typename T >
std::list<T>::iterator degate::down_iterator< T >::children_iter_end [private]

Definition at line 37 of file QuadTreeDownIterator.h.

Referenced by degate::down_iterator< T >::operator=().

template<typename T >
bool degate::down_iterator< T >::done [private]
template<typename T >
QuadTree<T>* degate::down_iterator< T >::node [private]
template<typename T >
std::list<QuadTree<T> *> degate::down_iterator< T >::open_list [private]

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