cgma
DynamicTreeIterator< TreeType, OutType, Which > Class Template Reference

#include <DynamicTreeIterator.hpp>

Inheritance diagram for DynamicTreeIterator< TreeType, OutType, Which >:
DynamicDLIIterator< OutType >

List of all members.

Public Member Functions

 DynamicTreeIterator ()
 ~DynamicTreeIterator ()
void watch (TreeType &the_tree)
virtual void reset ()
virtual void step (int n=1)
virtual unsigned int size () const
virtual OutType * get () const
virtual OutType * next (int n=1) const
virtual OutType * get_and_step (int n=1)
virtual CubitBoolean move_to (OutType *item)
virtual CubitBoolean is_in_list (OutType *item) const
virtual CubitBoolean is_at_end () const
virtual CubitBoolean is_at_beginning () const
virtual DynamicDLIIterator
< OutType > * 
clone () const

Private Member Functions

TreeType::iterator find_item (OutType *item) const

Private Attributes

TreeType * mTree
TreeType::iterator mIter

Detailed Description

template<class TreeType, class OutType, class Which>
class DynamicTreeIterator< TreeType, OutType, Which >

Definition at line 60 of file DynamicTreeIterator.hpp.


Constructor & Destructor Documentation

template<class TreeType, class OutType, class Which>
DynamicTreeIterator< TreeType, OutType, Which >::DynamicTreeIterator ( ) [inline]

Definition at line 64 of file DynamicTreeIterator.hpp.

: mTree(0) {}
template<class TreeType, class OutType, class Which>
DynamicTreeIterator< TreeType, OutType, Which >::~DynamicTreeIterator ( ) [inline]

Definition at line 65 of file DynamicTreeIterator.hpp.

{}

Member Function Documentation

template<class TreeType, class OutType, class Which>
virtual DynamicDLIIterator<OutType>* DynamicTreeIterator< TreeType, OutType, Which >::clone ( ) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 145 of file DynamicTreeIterator.hpp.

    {
      DynamicTreeIterator<TreeType, OutType, Which>* new_iterator = new DynamicTreeIterator<TreeType, OutType, Which>;
      *new_iterator = *this;
      return new_iterator;
    }
template<class TreeType, class OutType, class Which>
TreeType::iterator DynamicTreeIterator< TreeType, OutType, Which >::find_item ( OutType *  item) const [inline, private]

Definition at line 153 of file DynamicTreeIterator.hpp.

    {
      typename TreeType::iterator iter = std::find_if(mIter, mTree->end(), 
                TreeSelectFind<TreeType, OutType, Which>(item));
      if(iter == mTree->end())
      {
        iter = std::find_if(mTree->begin(), mIter, 
                    TreeSelectFind<TreeType, OutType, Which>(item));
        if(iter == mIter)
          iter = mTree->end();
      }
      return iter;
    }
template<class TreeType, class OutType, class Which>
virtual OutType* DynamicTreeIterator< TreeType, OutType, Which >::get ( ) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 93 of file DynamicTreeIterator.hpp.

    {
      if(mTree->empty())
        return NULL;
      return Which()(*mIter);
    }
template<class TreeType, class OutType, class Which>
virtual OutType* DynamicTreeIterator< TreeType, OutType, Which >::get_and_step ( int  n = 1) [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 111 of file DynamicTreeIterator.hpp.

    {
      OutType* tmp = get();
      step(n);
      return tmp;
    }
template<class TreeType, class OutType, class Which>
virtual CubitBoolean DynamicTreeIterator< TreeType, OutType, Which >::is_at_beginning ( ) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 141 of file DynamicTreeIterator.hpp.

    {
      return mTree->begin() == mIter;
    }
template<class TreeType, class OutType, class Which>
virtual CubitBoolean DynamicTreeIterator< TreeType, OutType, Which >::is_at_end ( ) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 133 of file DynamicTreeIterator.hpp.

    {
      if(mTree->empty())
        return CUBIT_TRUE;
      typename TreeType::iterator iter = mIter;
      ++iter;
      return iter == mTree->end();
    }
template<class TreeType, class OutType, class Which>
virtual CubitBoolean DynamicTreeIterator< TreeType, OutType, Which >::is_in_list ( OutType *  item) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 129 of file DynamicTreeIterator.hpp.

    {
      return find_item(item) != mTree->end();
    }
template<class TreeType, class OutType, class Which>
virtual CubitBoolean DynamicTreeIterator< TreeType, OutType, Which >::move_to ( OutType *  item) [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 118 of file DynamicTreeIterator.hpp.

    {
      typename TreeType::iterator iter = find_item(item);
      if(iter != mTree->end())
      {
        mIter = iter;
        return CUBIT_TRUE;
      }
      return CUBIT_FALSE;
    }
template<class TreeType, class OutType, class Which>
virtual OutType* DynamicTreeIterator< TreeType, OutType, Which >::next ( int  n = 1) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 99 of file DynamicTreeIterator.hpp.

    {
      if(mTree->empty())
        return NULL;
      typename TreeType::iterator iter = mIter;
      while(n--)
      {
        if(++iter == mTree->end())
          iter = mTree->begin();
      }
      return Which()(*iter);
    }
template<class TreeType, class OutType, class Which>
virtual void DynamicTreeIterator< TreeType, OutType, Which >::reset ( ) [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 73 of file DynamicTreeIterator.hpp.

    {
      mIter = mTree->begin();
    }
template<class TreeType, class OutType, class Which>
virtual unsigned int DynamicTreeIterator< TreeType, OutType, Which >::size ( ) const [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 89 of file DynamicTreeIterator.hpp.

    {
      return mTree->size();
    }
template<class TreeType, class OutType, class Which>
virtual void DynamicTreeIterator< TreeType, OutType, Which >::step ( int  n = 1) [inline, virtual]

Implements DynamicDLIIterator< OutType >.

Definition at line 78 of file DynamicTreeIterator.hpp.

    {
      if(mTree->empty())
        return;
      while(n--)
      {
        if(++mIter == mTree->end())
          mIter = mTree->begin();
      }
    }
template<class TreeType, class OutType, class Which>
void DynamicTreeIterator< TreeType, OutType, Which >::watch ( TreeType &  the_tree) [inline]

Definition at line 67 of file DynamicTreeIterator.hpp.

    {
      mTree = &the_tree;
      mIter = mTree->begin();
    }

Member Data Documentation

template<class TreeType, class OutType, class Which>
TreeType::iterator DynamicTreeIterator< TreeType, OutType, Which >::mIter [private]

Definition at line 167 of file DynamicTreeIterator.hpp.

template<class TreeType, class OutType, class Which>
TreeType* DynamicTreeIterator< TreeType, OutType, Which >::mTree [private]

Definition at line 166 of file DynamicTreeIterator.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines