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.

Classes

class  CONST_ITERATOR
 Constant bidirectional iterator. More...
class  ITERATOR
 End of CONST_ITERATOR. More...
class  OBSERVER
 Base class for observers of this list to inherit from. More...

Public Member Functions

 OBSERVABLE_LIST (const OBSERVABLE_LIST< _LIT > &rhs)
 OBSERVABLE_LIST ()
 ~OBSERVABLE_LIST ()
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< _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 ()

Detailed Description

template<typename _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.


Constructor & Destructor Documentation

template<typename _LIT>
OBSERVABLE_LIST< _LIT >::OBSERVABLE_LIST (  )  [inline]

End of ITERATOR.

Construct empty list.

Deliberate MmAllocC instead of new

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

Copy constructor, copies list items, not observers.

Deliberate MmAllocC instead of new

template<typename _LIT>
OBSERVABLE_LIST< _LIT >::~OBSERVABLE_LIST (  )  [inline]

Destructor.


Member Function Documentation

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

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

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

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

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

Remove all entries from the list.

template<typename _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.

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

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

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

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

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

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

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

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

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

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

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

Return the number of items in the list.

template<typename _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).
template<typename _LIT>
bool OBSERVABLE_LIST< _LIT >::IsEmpty (  )  const [inline]

Determine if any list entries exist.

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

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

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

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

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

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

template<typename _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.

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

Assignment operator, copies list items, not observers.

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

Remove the last item from the list.

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

Remove an item from the beginning of the list.

template<typename _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).
template<typename _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).
template<typename _LIT>
void OBSERVABLE_LIST< _LIT >::Raise ( ITERATOR  it  )  [inline]

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

template<typename _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
template<typename _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.

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

Remove item specified by reference from the list.

Parameters:
item Item to remove
template<typename _LIT>
void OBSERVABLE_LIST< _LIT >::RemoveDuplicates (  )  [inline]

Remove duplicate entries.

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

Remove item at specified position.

Parameters:
pos Position starting at 0 for beginning of list
template<typename _LIT>
void OBSERVABLE_LIST< _LIT >::Sort ( bool(*)(const _LIT &lhs, const _LIT &rhs)  PredFunc  )  [inline]

Sort the list in operator< () order.

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

Sort the list in operator< () order.


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:33:41 2012 for TNTsdk 2012 by  doxygen 1.6.1