OBSERVABLE_LIST< _LIT > Class Template Reference

Template for a list container which supports the OBSERVER pattern (see observer.h). More...

#include <mi32/obslist.h>

List of all members.

Public Member Functions

CONST_ITERATOR Begin () const
ITERATOR Begin ()
void Clear ()
CONST_ITERATOR End () const
ITERATOR End ()
_LIT & GetBack ()
const _LIT & GetBack () const
_LIT & GetFront ()
const _LIT & GetFront () const
INT32 GetNumItems () const
_LIT & Insert (ITERATOR p, const _LIT &item)
bool IsEmpty () const
void Lower (ITERATOR it)
void MoveToBack (ITERATOR it)
void MoveToFront (ITERATOR it)
void NotifyChanged (const _LIT &item)
 OBSERVABLE_LIST (const OBSERVABLE_LIST< _LIT > &rhs)
 OBSERVABLE_LIST ()
OBSERVABLE_LIST< _LIT > & operator= (const OBSERVABLE_LIST< _LIT > &rhs)
void PopBack ()
void PopFront ()
_LIT & PushBack (const _LIT &item)
_LIT & PushFront (const _LIT &item)
void Raise (ITERATOR it)
void Remove (ITERATOR start, ITERATOR end)
void Remove (ITERATOR it, bool notify=true)
void Remove (const _LIT &item)
void RemoveDuplicates ()
void RemovePos (int pos)
void Sort (bool(*PredFunc)(const _LIT &lhs, const _LIT &rhs))
void Sort ()
 ~OBSERVABLE_LIST ()


Detailed Description

template<class _LIT>
class OBSERVABLE_LIST< _LIT >

Template for a list container which supports the OBSERVER pattern (see observer.h).

An observer is defined by inheriting from OBSERVABLE_LIST<type>::OBSERVER and overriding the desired virtual methods. Each list may have as many OBSERVERs as desired, however, a particular OBSERVER may only be associated with one list at a time. Notification when items are added, removed, reordered or sorted is automatic. However, if an item is changed (through a non-const reference) then notification is the responsibility of the programmer. NotifyChanged() should be called after the change is made so that all observers are notified of the change.

Definition at line 62 of file obslist.h.


Constructor & Destructor Documentation

template<class _LIT>
OBSERVABLE_LIST< _LIT >::OBSERVABLE_LIST  )  [inline]
 

Construct empty list.

Deliberate MmAllocC instead of new

Definition at line 291 of file obslist.h.

template<class _LIT>
OBSERVABLE_LIST< _LIT >::OBSERVABLE_LIST const OBSERVABLE_LIST< _LIT > &  rhs  )  [inline]
 

Copy constructor, copies list items, not observers.

Deliberate MmAllocC instead of new

Definition at line 298 of file obslist.h.

template<class _LIT>
OBSERVABLE_LIST< _LIT >::~OBSERVABLE_LIST  )  [inline]
 

Destructor.

Definition at line 309 of file obslist.h.


Member Function Documentation

template<class _LIT>
CONST_ITERATOR OBSERVABLE_LIST< _LIT >::Begin  )  const [inline]
 

Return a CONST_ITERATOR that refers to the beginning of the list.

Definition at line 333 of file obslist.h.

template<class _LIT>
ITERATOR OBSERVABLE_LIST< _LIT >::Begin  )  [inline]
 

Return an ITERATOR that refers to the beginning of the list.

Definition at line 329 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Clear  )  [inline]
 

Remove all entries from the list.

Definition at line 337 of file obslist.h.

template<class _LIT>
CONST_ITERATOR OBSERVABLE_LIST< _LIT >::End  )  const [inline]
 

Return a CONST_ITERATOR that refers to the end of the list, not a valid list item.

Definition at line 351 of file obslist.h.

template<class _LIT>
ITERATOR OBSERVABLE_LIST< _LIT >::End  )  [inline]
 

Return an ITERATOR that refers to the end of the list, not a valid list item.

Definition at line 347 of file obslist.h.

template<class _LIT>
_LIT& OBSERVABLE_LIST< _LIT >::GetBack  )  [inline]
 

Return a reference to a _LIT item from the front of the list.

Definition at line 359 of file obslist.h.

template<class _LIT>
const _LIT& OBSERVABLE_LIST< _LIT >::GetBack  )  const [inline]
 

Return a reference to a const _LIT item from the front of the list.

Definition at line 355 of file obslist.h.

template<class _LIT>
_LIT& OBSERVABLE_LIST< _LIT >::GetFront  )  [inline]
 

Return a reference to a _LIT item from the front of the list.

Definition at line 367 of file obslist.h.

template<class _LIT>
const _LIT& OBSERVABLE_LIST< _LIT >::GetFront  )  const [inline]
 

Return a reference to a const _LIT item from the front of the list.

Definition at line 363 of file obslist.h.

template<class _LIT>
INT32 OBSERVABLE_LIST< _LIT >::GetNumItems  )  const [inline]
 

Return the number of items in the list.

Definition at line 371 of file obslist.h.

template<class _LIT>
_LIT& OBSERVABLE_LIST< _LIT >::Insert ITERATOR  p,
const _LIT &  item
[inline]
 

Insert an item into the place BEFORE the iterator.

Returns:
Reference to new item in list (not same as 'item' parameter as will be copied).

Definition at line 376 of file obslist.h.

template<class _LIT>
bool OBSERVABLE_LIST< _LIT >::IsEmpty  )  const [inline]
 

Determine if any list entries exist.

Definition at line 392 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Lower ITERATOR  it  )  [inline]
 

Moves the item referenced by the iterator toward the beginning of the list.

Definition at line 396 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::MoveToBack ITERATOR  it  )  [inline]
 

Moves the item referenced by the iterator to the back of the list.

Definition at line 410 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::MoveToFront ITERATOR  it  )  [inline]
 

Moves the item referenced by the iterator to the front of the list.

Definition at line 422 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::NotifyChanged const _LIT &  item  )  [inline]
 

Notify all list observers that a change has been made to the specified item.

There is no verification that the item is actually in the list.

Definition at line 435 of file obslist.h.

template<class _LIT>
OBSERVABLE_LIST<_LIT>& OBSERVABLE_LIST< _LIT >::operator= const OBSERVABLE_LIST< _LIT > &  rhs  )  [inline]
 

Assignment operator, copies list items, not observers.

Definition at line 316 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::PopBack  )  [inline]
 

Remove the last item from the list.

Definition at line 456 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::PopFront  )  [inline]
 

Remove an item from the beginning of the list.

Definition at line 446 of file obslist.h.

template<class _LIT>
_LIT& OBSERVABLE_LIST< _LIT >::PushBack const _LIT &  item  )  [inline]
 

Insert an item on the end of the list.

Returns:
Reference to new item in list (not same as 'item' parameter as will be copied).

Definition at line 451 of file obslist.h.

template<class _LIT>
_LIT& OBSERVABLE_LIST< _LIT >::PushFront const _LIT &  item  )  [inline]
 

Insert an item at the beginning of the list.

Returns:
Reference to new item in list (not same as 'item' parameter as will be copied).

Definition at line 441 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Raise ITERATOR  it  )  [inline]
 

Moves the item referenced by the iterator toward the end of the list.

Definition at line 460 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Remove ITERATOR  start,
ITERATOR  end
[inline]
 

Remove a range of items from the list.

Parameters:
start  Iterator for first item to remove
end  Ending item, exclusive, will not be removed

Definition at line 501 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Remove ITERATOR  it,
bool  notify = true
[inline]
 

Remove item specified by ITERATOR from the list.

Do not use the specified iterator after using this method as it will be invalid.

Definition at line 490 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Remove const _LIT &  item  )  [inline]
 

Remove item specified by reference from the list.

Parameters:
item  Item to remove

Definition at line 474 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::RemoveDuplicates  )  [inline]
 

Remove duplicate entries.

Definition at line 540 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::RemovePos int  pos  )  [inline]
 

Remove item at specified position.

Parameters:
pos  Position starting at 0 for beginning of list

Definition at line 512 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Sort bool(*  PredFunc)(const _LIT &lhs, const _LIT &rhs)  )  [inline]
 

Sort the list in operator< () order.

Definition at line 531 of file obslist.h.

template<class _LIT>
void OBSERVABLE_LIST< _LIT >::Sort  )  [inline]
 

Sort the list in operator< () order.

Definition at line 523 of file obslist.h.


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:20:08 2004 for TNTsdk by  doxygen 1.3.8-20040913