NAME

OTC_Cursor - Abstract base class for implementations of iterators.

SYNOPSIS


#include <OTC/collctn/cursor.hh>

template<class T>
class OTC_Cursor : public OTC_Resource
{
  public:
    ~OTC_Cursor();
    OTC_Cursor();
    virtual void reset() = 0;
    virtual void next() = 0;
    virtual T& item() = 0;
    virtual OTC_Boolean isValid() const = 0;
    virtual OTC_Cursor<T>* clone() = 0;
    static void apply(
      OTC_Cursor<T>* theCursor,
      OTC_Visitor<T>& theApplicator
    );
    static void apply(
      OTC_Cursor<T>* theCursor,
      OTC_Worker<T>& theApplicator
    );
    static void assign(
      OTC_Cursor<T>*& theLeft,
      OTC_Cursor<T>* theRight
    );
    static void replace(
      OTC_Cursor<T>*& theLeft,
      OTC_Cursor<T>* theRight
    );
};

CLASS TYPE

Abstract

DESCRIPTION

Abstract base class, for classes which implement iteration over specific types of collections.

MOVEMENT

Following operations allow movement of the iterator over the collection.
virtual void reset() = 0;
virtual void next() = 0;

RETRIEVAL

These operations provide access to the current item in the collection. Although dependent on the derived iterator and how the collection being iterated over is implemented, an exception will generally result if an attempt is made to access an item, when the iterator is not currently located at one.
virtual T& item() = 0;
virtual OTC_Boolean isValid() const = 0;

CLONING

virtual OTC_Cursor<T>* clone() = 0;

APPLICATORS

static void apply(
  OTC_Cursor<T>* theCursor,
  OTC_Visitor<T>& theApplicator
);
static void apply(
  OTC_Cursor<T>* theCursor,
  OTC_Worker<T>& theApplicator
);

REFERENCE COUNTING

static void assign(OTC_Cursor<T>*& theLeft, OTC_Cursor<T>* theRight);
static void replace(OTC_Cursor<T>*& theLeft, OTC_Cursor<T>* theRight);

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1991 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED