CBaseList class

cbaselist class hierarchy

The CBaseList method implements an abtract list. The CGenericList class template, which derives from CBaseList, provides type checking and a simpler interface than the CBaseList class.

The CBaseList class is modeled after the CObList class in the Microsoft Foundation Classes (MFC) library. Positions within the list are represented by a POSITION structure. The caller should not access the internal members of the POSITION structure; treat it as a pointer to a list node. The position of an object in the list remains valid until the object is deleted.

The list does not require any support by the objects it contains. It performs no storage management or copying on the objects. Objects can be in multiple lists.

Roughly half of the methods in this class act on single objects. These methods have the suffix - I in the method name. The other methods act on entire lists. For example, the CBaseList::AddAfter method appends a list to another list. Single-object operations return POSITION values, or NULL on failure. List operations return TRUE if successful or FALSE otherwise.

Protected Member Variables Description
m_Count Number of items in the list.
m_pFirst Pointer to the first node in the list.
m_pLast Pointer to the last node in the list.
Protected Methods Description
GetNextI Retrieves the item at the specified position, and advances the position.
GetI Retrieves the item at the specified position.
FindI Retrieves the first position that holds the specified item.
RemoveHeadI Removes the first item in the list.
RemoveTailI Removes the last item in the list.
RemoveI Removes the item at the specified position.
AddTailI Adds an item to the end of the list.
AddHeadI Adds an item to the front of the list.
AddAfterI Inserts an item after the specified position.
AddBeforeI Inserts an item before the specified position.
Public Methods Description
CBaseList Constructor method.
~ CBaseList Destructor method.
RemoveAll Removes all nodes from the list.
GetHeadPositionI Retrieves the position of the first item in the list.
GetTailPositionI Retrieves the position of the last item of the list.
GetCountI Retrieves the number of items in the list.
Next Retrieves the next position in the list.
Prev Retrieves the previous position in the list.
AddHead Inserts another list at the front of this list.
AddTail Appends another list to the end of this list.
AddAfter Inserts a list after the specified position.
AddBefore Inserts a list before the specified position.
MoveToTail Splits the list and appends the head portion to the tail of another list.
MoveToHead Splits the list and inserts the tail portion at the head of another list.
Reverse Reverses the order of the list.


Wxlist.h (include Streams.h)
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

DirectShow Base Classes