NAME

OTC_PairCursor - Abstract base class for cursors over a key/item pair.

SYNOPSIS


#include <OTC/collctn/prcursor.hh>

template<class T1, class T2>
class OTC_PairCursor : public OTC_Resource
{
  public:
    OTC_PairCursor();
    ~OTC_PairCursor();
    virtual void reset() = 0;
    virtual void next() = 0;
    virtual T1& key() = 0;
    virtual T2& item() = 0;
    virtual OTC_Boolean isValid() const = 0;
    virtual OTC_PairCursor<T1,T2>* clone() = 0;
    static void apply(
      OTC_PairCursor<T1,T2>* theCursor,
      OTC_PairVisitor<T1,T2>& theApplicator
    );
    static void apply(
      OTC_PairCursor<T1,T2>* theCursor,
      OTC_PairWorker<T1,T2>& theApplicator
    );
    static void assign(
      OTC_PairCursor<T1,T2>*& theLeft,
      OTC_PairCursor<T1,T2>* theRight
    );
    static void replace(
      OTC_PairCursor<T1,T2>*& theLeft,
      OTC_PairCursor<T1,T2>* theRight
    );
};

CLASS TYPE

Abstract

DESCRIPTION

Abstract base class for cursors providing a means of iteration over collections containing key/item pairs.

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 T1& key() = 0;
virtual T2& item() = 0;
virtual OTC_Boolean isValid() const = 0;

CLONING

virtual OTC_PairCursor<T1,T2>* clone() = 0;

APPLICATORS

static void apply(
  OTC_PairCursor<T1,T2>* theCursor,
  OTC_PairVisitor<T1,T2>& theApplicator
);
static void apply(
  OTC_PairCursor<T1,T2>* theCursor,
  OTC_PairWorker<T1,T2>& theApplicator
);

REFERENCE COUNTING

static void assign(
  OTC_PairCursor<T1,T2>*& theLeft,
  OTC_PairCursor<T1,T2>* theRight
);
static void replace(
  OTC_PairCursor<T1,T2>*& theLeft,
  OTC_PairCursor<T1,T2>* theRight
);

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1993 TELSTRA CORPORATION LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED