cgma
CGMAIterator Class Reference

#include <CGMAIterator.hpp>

List of all members.

Public Member Functions

 CGMAIterator (DLIList< RefEntity * > &list, int size)
 Constructor.
void reset ()
 Reset iterator.
bool next (RefEntity **array, int &array_size)
 Get and step.
int size () const
 Get the saved default request size NOTE: This is *not* the number of entities iterated over.
bool at_end () const

Private Attributes

std::vector< RefEntity * > mArray
std::vector< RefEntity * >
::const_iterator 
mIter
int mSize

Detailed Description

Definition at line 24 of file CGMAIterator.hpp.


Constructor & Destructor Documentation

CGMAIterator::CGMAIterator ( DLIList< RefEntity * > &  list,
int  size 
) [inline]

Constructor.

Parameters:
listThe list of entities to iterate over
sizeDefault query size - stored but not used by this class

Definition at line 33 of file CGMAIterator.hpp.

    : mArray(list.size()),
      mIter(mArray.begin()),
      mSize(size)
  {
    list.copy_to( &mArray[0] );
  }

Member Function Documentation

bool CGMAIterator::at_end ( ) const [inline]

Definition at line 82 of file CGMAIterator.hpp.

    { return mIter == mArray.end(); }
bool CGMAIterator::next ( RefEntity **  array,
int &  array_size 
) [inline]

Get and step.

Parameters:
arrayallocated array of pointers to RefEntitys. must be allocated by caller and contain at least array_size entries.
array_sizeAs input, the requested number of entries to retreive and step over. As output, either the input value or a smaller value if there are insufficient entries remaining.

Definition at line 54 of file CGMAIterator.hpp.

  {
    if (array_size <= 0) {
      array_size = 0;
    }
    else {
      std::vector<RefEntity*>::const_iterator end = mArray.end();
      if ((end - mIter) > array_size)
        end = mIter + array_size;
      RefEntity** ptr = std::copy( mIter, end, array );
      array_size = ptr - array;
      mIter += array_size;
    }
    return mIter == mArray.end();
  }
void CGMAIterator::reset ( ) [inline]

Reset iterator.

Definition at line 42 of file CGMAIterator.hpp.

{ mIter = mArray.begin(); }
int CGMAIterator::size ( ) const [inline]

Get the saved default request size NOTE: This is *not* the number of entities iterated over.

Get saved default request size. This value is saved in the iterator class for convenience. It has no affect on the behavior of the class.

Note: This is neither the number of entities iterated over nor the remaining number of entities.

Definition at line 80 of file CGMAIterator.hpp.

{ return mSize; }

Member Data Documentation

std::vector<RefEntity*> CGMAIterator::mArray [private]

Definition at line 87 of file CGMAIterator.hpp.

std::vector<RefEntity*>::const_iterator CGMAIterator::mIter [private]

Definition at line 88 of file CGMAIterator.hpp.

int CGMAIterator::mSize [private]

Definition at line 89 of file CGMAIterator.hpp.


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