#include <OTC/collctn/ilist.hh> template<class T> class OTC_IList {
public:
static os_typespec* get_os_typespec();
OTC_IList();
OTC_IList(OTC_IList<T> const& theList);
OTC_IList(OTC_IList<T> const& theList, OTC_ShallowCopy);
~OTC_IList();
OTC_IList<T>& operator=(OTC_IList<T> const& theList);
inline u_int population() const;
inline OTC_Boolean isEmpty() const;
inline T& item();
inline T const& item() const;
inline OTC_Boolean isValid() const;
inline OTC_Boolean isStart() const;
inline OTC_Boolean isEnd() const;
inline void next() const;
inline void prev() const;
inline void resetFirst() const;
inline void resetLast() const;
void apply( OTC_Visitor<T>& theApplicator, OTC_Direction theDirection=OTCLIB_FORWARD, OTC_Protection theProtection=OTCLIB_SAFE ) const;
void apply( OTC_Worker<T>& theApplicator, OTC_Direction theDirection=OTCLIB_FORWARD, OTC_Protection theProtection=OTCLIB_SAFE );
void addBefore(T const& theItem);
void addAfter(T const& theItem);
inline void addFirst(T const& theItem);
inline void addLast(T const& theItem);
inline T& first();
inline T const& first() const;
inline T& last();
inline T const& last() const;
inline void removeAll();
void remove();
inline void removeFirst();
inline void removeLast();
};
OTC_Deque
or OTC_List
is not required. This class
replaces the OTC_SimpleList
class.
Items may be inserted at any position in the list by moving the
inbuilt iterator to the required location and then adding the
item, either before, or after the iterator position. It is also
possible to add items directly onto the head or tail of the list.
The class uses OTC_Bucket
to hold items internally. Therefore,
OTC_BaseActions
can be used to define what occurs when items
are added and removed from the list.
OTC_IList();
OTC_IList(OTC_IList<T> const& theList);
theList
. If the list holds pointers,
only the pointer is copied and not
what the pointer points at.
OTC_IList(OTC_IList<T> const& theList, OTC_ShallowCopy);
theList
.
The same items will be referenced
by each list, however, the iterators
will be independent.
~OTC_IList();
removeAll()
to kill all buckets
in the list.
OTC_IList<T>& operator=(OTC_IList<T> const& theList);
theList
. The iterator is reset
to being off the start of the list.
inline u_int population() const;
inline OTC_Boolean isEmpty() const;
OTCLIB_TRUE
if the list is empty.
inline T& item();
inline T const& item() const;
inline OTC_Boolean isValid() const;
OTCLIB_TRUE
if the iterator is
located over a live item.
inline OTC_Boolean isStart() const;
OTCLIB_TRUE
if the iterator is
located off the start of the list.
inline OTC_Boolean isEnd() const;
OTCLIB_TRUE
if the iterator is
located off the end of the list.
inline void next() const;
inline void prev() const;
inline void resetFirst() const;
inline void resetLast() const;
void apply(
OTC_Visitor<T>& theApplicator,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
) const;
theApplicator
to each of the
items in the collection. The direction
being determined by theDirection
. Valid
values are OTCLIB_FORWARD
and
OTCLIB_BACKWARD
.
void apply(
OTC_Worker<T>& theApplicator,
OTC_Direction theDirection=OTCLIB_FORWARD,
OTC_Protection theProtection=OTCLIB_SAFE
);
theApplicator
to each of the
items in the collection. The direction
being determined by theDirection
. Valid
values are OTCLIB_FORWARD
and
OTCLIB_BACKWARD
.
void addBefore(T const& theItem);
theItem
before the item where the
iterator is currently located. If the
iterator is located off the end of the
list, the effect is that theItem
is
appended to the list. If the iterator is
off the start of the list, the effect
is that theItem
is prepended to the
list. After the operation, the iterator
will be located on the newly inserted
item.
void addAfter(T const& theItem);
theItem
after the item where the
iterator is currently located. If the
iterator is located off the end of the
list, the effect is that theItem
is
appended to the list. If the iterator is
off the start of the list, the effect
is that theItem
is prepended to the
list. After the operation, the iterator
will be located on the newly inserted
item.
inline void addFirst(T const& theItem);
theItem
at the head of the list.
The location of the iterator is unchanged.
inline void addLast(T const& theItem);
theItem
after the last item in
the list. The location of the iterator
is unchanged.
inline T& first();
inline T const& first() const;
inline T& last();
inline T const& last() const;
inline void removeAll();
void remove();
inline void removeFirst();
inline void removeLast();
OTC_Bucket
, OTC_BaseActions