NAME
OTC_BucketCursor -
Iterator over items held in OTC_Bucket.
SYNOPSIS
#include <OTC/collctn/buckcurs.hh>
template<class T>
class OTC_BucketCursor : public OTC_Cursor<T>
{
public:
static os_typespec* get_os_typespec();
~OTC_BucketCursor();
OTC_BucketCursor(
OTC_LinkList* aList,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
);
OTC_BucketCursor(
OTC_LinkList* aList,
OTC_Linkable* theStart,
OTC_Linkable* theEnd,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
);
OTC_BucketCursor(OTC_BucketCursor<T> const& aIter);
void reset();
void next();
T& item();
OTC_Boolean isValid() const;
OTC_Cursor<T>* clone();
inline OTC_Direction direction() const;
void reverse();
};
CLASS TYPE
Concrete
DESCRIPTION
Derived version of OTC_Cursor, which iterates over the items
in an instance of OTC_LinkList, where the derived type of
link is OTC_Bucket.
This class should no longer be used. Instead the OTC_ItemCursor
class should be used. The OTC_BucketCursor class will be
removed in OSE 4.0.
INITIALISATION
OTC_BucketCursor(
OTC_LinkList* aList,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
);
aList is the list being iterated over.
theDirection indicates which way
traversal is to occur. If theDirection
is OTCLIB_FORWARD, traversal will be
from the start of aList to the end. If
it is OTCLIB_BACKWARD, it will be in the
opposite direction. theProtection
determines whether reference counting is
performed on the links in the list.
Reference counting ensures the integrity of
the iterator when removals and additions
are perfomed. The values for theProtection
are OTCLIB_SAFE and OTCLIB_UNSAFE.
The default argument is OTCLIB_UNSAFE.
OTC_BucketCursor(
OTC_LinkList* aList,
OTC_Linkable* theStart,
OTC_Linkable* theEnd,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
);
aList is the list being iterated over.
theStart and theEnd are the anchor
points within the list which define the
bounds of the iterator. If theDirection
is OTCLIB_FORWARD, traversal will be
from the theStart to theEnd. If it
is OTCLIB_BACKWARD, it will be in
the opposite direction. Note that this
class relies on theStart preceeding
theEnd in the list. theProtection
determines whether reference counting is
performed on the links in the list.
Reference counting ensures the integrity of
the iterator when removals and additions
are perfomed. The values for theProtection
are OTCLIB_SAFE and OTCLIB_UNSAFE.
The default argument is OTCLIB_UNSAFE.
OTC_BucketCursor(OTC_BucketCursor<T> const& aIter);
Create an iterator at the same location as
aIter.
MOVEMENT
Following operations allow movement of the iterator over the
list.
void reset();
Resets the iterator to the first item.
void next();
Moves the iterator to the next item.
RETRIEVAL
T& item();
Returns the item under the current
location of the iterator. If no such item
exists, an exception is raised. Note that
this returns the item even if the bucket
has been marked as dead.
OTC_Boolean isValid() const;
Returns OTCLIB_TRUE while there is a
link under the current location of the
iterator and not an anchor point. In other
words if the iterator is located over a
link which has been marked as dead, then
OTCLIB_TRUE will still be returned.
CLONING
OTC_Cursor<T>* clone();
Creates a new iterator at the same location
as this one but which operates
independently.
DIRECTION
inline OTC_Direction direction() const;
Returns the direction in which the iterator
is moving.
void reverse();
Change the direction the iterator is
moving.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED