cgma
DLIListIterator< X > Class Template Reference

#include <DLIList.hpp>

List of all members.

Public Member Functions

 DLIListIterator ()
virtual ~DLIListIterator ()
void watch (const DLIList< X > *dl_i_list)
void reset ()
void step (int n=1)
int size () const
X get () const
X next (int n=1) const
X get_and_step (int n=1)
CubitBoolean move_to (X item)
CubitBoolean is_in_list (X item) const
CubitBoolean is_at_end () const
CubitBoolean is_at_beginning () const

Protected Member Functions

int where_is_item (X item) const

Protected Attributes

int mIndex
const DLIList< X > * dlIList

Friends

class DLIList< X >

Detailed Description

template<class X>
class DLIListIterator< X >

Definition at line 1730 of file DLIList.hpp.


Constructor & Destructor Documentation

template<class X>
DLIListIterator< X >::DLIListIterator ( ) [inline]

Definition at line 1735 of file DLIList.hpp.

                    :
      mIndex(0),
      dlIList(NULL)
    {}
template<class X>
virtual DLIListIterator< X >::~DLIListIterator ( ) [inline, virtual]

Definition at line 1741 of file DLIList.hpp.

    {}

Member Function Documentation

template<class X>
X DLIListIterator< X >::get ( ) const [inline]

Definition at line 1769 of file DLIList.hpp.

    { return next(0); }
template<class X>
X DLIListIterator< X >::get_and_step ( int  n = 1) [inline]

Definition at line 1772 of file DLIList.hpp.

    {
      X temp = get();
      step( n );
      return temp;
    }
template<class X>
CubitBoolean DLIListIterator< X >::is_at_beginning ( ) const [inline]

Definition at line 1799 of file DLIList.hpp.

    {
      if (!mIndex || mIndex == size())
        return CUBIT_TRUE;
      return CUBIT_FALSE;
    }
template<class X>
CubitBoolean DLIListIterator< X >::is_at_end ( ) const [inline]

Definition at line 1791 of file DLIList.hpp.

    {
      if (size() == 0 || mIndex == size() - 1)
        return CUBIT_TRUE;
      return CUBIT_FALSE;
    }
template<class X>
CubitBoolean DLIListIterator< X >::is_in_list ( X  item) const [inline]

Definition at line 1787 of file DLIList.hpp.

    { return where_is_item(item) >= 0 ? CUBIT_TRUE : CUBIT_FALSE; }
template<class X>
CubitBoolean DLIListIterator< X >::move_to ( X  item) [inline]

Definition at line 1780 of file DLIList.hpp.

    { 
      mIndex = where_is_item( item );
      return mIndex >= 0 ? CUBIT_TRUE : CUBIT_FALSE; 
    }
template<class X >
X DLIListIterator< X >::next ( int  n = 1) const [inline]

Definition at line 1817 of file DLIList.hpp.

{
  int size_loc = size();
  if ( size_loc == 0 )
    return NULL;
  int index_loc = mIndex + n;
  while ( index_loc < 0 )
    index_loc += size_loc;
  while ( index_loc >= size_loc )
    index_loc -= size_loc;
  
    // if dlIList == NULL, then size == 0 and returned already 
  return dlIList->listArray[index_loc];
}
template<class X>
void DLIListIterator< X >::reset ( ) [inline]

Definition at line 1750 of file DLIList.hpp.

    { mIndex = 0; }
template<class X>
int DLIListIterator< X >::size ( ) const [inline]

Definition at line 1766 of file DLIList.hpp.

    { return dlIList ? dlIList->size() : 0; }
template<class X>
void DLIListIterator< X >::step ( int  n = 1) [inline]

Definition at line 1753 of file DLIList.hpp.

    {
      if (!size())
        mIndex = 0;
      else
      {
        mIndex += n;
        while (mIndex < 0)
          mIndex += dlIList->size();
        mIndex %= dlIList->size();
      }
    }
template<class X>
void DLIListIterator< X >::watch ( const DLIList< X > *  dl_i_list) [inline]

Definition at line 1744 of file DLIList.hpp.

    {
      dlIList = dl_i_list;
      mIndex = dlIList->index;
    }
template<class X>
int DLIListIterator< X >::where_is_item ( X  item) const [inline, protected]

Definition at line 1808 of file DLIList.hpp.

    { return dlIList ? dlIList->where_is_item( item ) : -1; }

Friends And Related Function Documentation

template<class X>
friend class DLIList< X > [friend]

Definition at line 1732 of file DLIList.hpp.


Member Data Documentation

template<class X>
const DLIList<X>* DLIListIterator< X >::dlIList [protected]

Definition at line 1813 of file DLIList.hpp.

template<class X>
int DLIListIterator< X >::mIndex [protected]

Definition at line 1812 of file DLIList.hpp.


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