DirectShow Animated Header -- CGenericList Class DirectShow Animated Header -- CGenericList Class* Microsoft DirectShow SDK
*Index  *Topic Contents
*Previous Topic: CFactoryTemplate Class
*Next Topic: CGuidNameList Class

CGenericList Class


CGenericList class hierarchy

CGenericList is a template class that allows for a type-specific implementation of a list. It is derived from CBaseList and uses that class's typeless implementation. The constructor creates a CBaseList object, and all CGenericList member functions call CBaseList member functions but provide type-checking dependent on the template.

Member Functions
Name Description
AddAfter Inserts a node or list of nodes after the specified node.
AddBefore Inserts a node or list of nodes before the specified node.
AddHead Inserts a node or list of nodes at the front of the list.
AddTail Appends a node or list of nodes to the end of the list.
CGenericList Constructs a CGenericList object.
Find Returns the first position that contains the specified object.
Get Returns the object at the specified position.
GetCount Returns the number of objects (object count) in the list.
GetHead Returns the object at the head of the list.
GetHeadPosition Returns a cursor identifying the first element of the list.
GetNext Returns the specified object and update position.
GetTailPosition Returns a cursor identifying the last element of the list.
Remove Removes the specified node from the list.
RemoveHead Removes the first node in the list.
RemoveTail Removes the last node in the list.


CGenericList::AddAfter

CGenericList Class

Inserts a node or list of nodes after the specified node.

POSITION AddAfter(
  POSITION p,
  OBJECT * pObj
  );
BOOL AddAfter(
  POSITION pos,
  CGenericList<OBJECT> *pList
  );

Parameters
pos
Position after which to add the node or list of nodes.
pObj
Pointer to the object to add.
pList
Pointer to the list of objects to add.
Return Values

Returns the position of the inserted object in the case of single-object insertion. For list insertion, returns TRUE if successful; otherwise, returns FALSE.

Remarks

This member function calls the CBaseList::AddAfter member function when passed a list of nodes. CGenericList::AddAfter calls the CBaseList::AddAfterI member function when passed a single node.


CGenericList::AddBefore

CGenericList Class

Inserts a node or list of nodes before the specified node.

POSITION AddBefore(
  POSITION p,
  OBJECT * pObj
  );
BOOL AddBefore(
  POSITION pos,
  CGenericList<OBJECT> *pList
  );

Parameters
pos
Position before which to add the node or list of nodes.
pObj
Pointer to the object to add.
pList
Pointer to the list of objects to add.
Return Values

Returns the position of the inserted object in the case of single-object insertion. For list insertion, returns TRUE if successful; otherwise, returns FALSE.

Remarks

This member function calls the CBaseList::AddBefore member function when passed a list of nodes. CGenericList::AddBefore calls the CBaseList::AddBeforeI member function when passed a single node.


CGenericList::AddHead

CGenericList Class

Inserts a node or list of nodes at the front of the list.

POSITION AddHead(
  OBJECT * pObj
  );
BOOL AddHead(
  CGenericList<OBJECT> *pList
  );

Parameters
pObj
Pointer to the object to add.
pList
Pointer to the list of objects to add.
Return Values

Returns the new head position, or NULL if unsuccessful in the case of single-node additions. For list insertions, returns TRUE if successful; otherwise, returns FALSE.

Remarks

This member function calls the CBaseList::AddHead member function when passed a list of nodes. CGenericList::AddHead calls the CBaseList::AddHeadI member function when passed a single node.


CGenericList::AddTail

CGenericList Class

Appends a node or list of nodes to the end of the list.

POSITION AddTail(
  OBJECT * pObj
  );
BOOL AddTail(
  CGenericList<OBJECT> *pList
  );

Parameters
pObj
Pointer to the object to add.
pList
Pointer to the list of objects to add.
Return Values

Returns the new tail position, or NULL if unsuccessful in the case of single-node insertions. For list insertions, returns TRUE if successful; otherwise, returns FALSE.

Remarks

This member function calls the CBaseList::AddTail member function when passed a list of nodes. CGenericList::AddTail calls the CBaseList::AddTailI member function when passed a single node.


CGenericList::CGenericList

CGenericList Class

Constructs a CGenericList object.

CGenericList(
  TCHAR *pName,
  INT iItems,
  BOOL bLock,
  BOOL bAlert
  );

CGenericList(
  TCHAR *pName
  );

Parameters
pName
Name of the list.
iItems
Number of items in the list.
bLock
TRUE if the list is locked and FALSE otherwise. This parameter defaults to TRUE.
bAlert
Not used.
Return Values

No return value.

Remarks

This constructor calls the CBaseList constructor.


CGenericList::Find

CGenericList Class

Retrieves the first position that contains the specified object.

POSITION Find(
  OBJECT * pObj
  );

Parameters
pObj
Pointer to the object to find.
Return Values

Returns a position cursor.

Remarks

This member function calls the CBaseList::FindI member function.


CGenericList::Get

CGenericList Class

Retrieves the object at the specified position.

OBJECT *Get(
  POSITION pos
  );

Parameters
pos
Position in the list from which to retrieve the object.
Return Values

Returns a pointer to an object.

Remarks

This member function calls the CBaseList::GetI member function.


CGenericList::GetCount

CGenericList Class

Retrieves the number of objects (object count) in the list.

int GetCount( );

Return Values

Returns the value of m_Count.


CGenericList::GetHead

CGenericList Class

Retrieves the object at the head of the list.

OBJECT GetHead( );

Return Values

Returns the head of the list by calling CGenericList::GetHeadPosition.


CGenericList::GetHeadPosition

CGenericList Class

Retrieves a cursor identifying the first element of the list.

POSITION GetHeadPosition( );

Return Values

Returns the position cursor held by m_pFirst.


CGenericList::GetNext

CGenericList Class

Retrieves the specified object and update position.

OBJECT *GetNext(
  POSITION& rp
  );

Parameters
rp
Returned pointer to the next object.
Return Values

Returns a pointer to an object at the next position.

Remarks

This member function calls the CBaseList::GetNextI member function.


CGenericList::GetTailPosition

CGenericList Class

Retrieves a cursor identifying the last element of the list.

POSITION GetTailPosition( );

Return Values

Returns the position cursor held by m_pLast.


CGenericList::Remove

CGenericList Class

Removes the specified node from the list.

OBJECT *Remove(
  POSITION pos
  );

Parameters
pos
Position in the list of nodes to remove.
Return Values

Returns the pointer to the object that was removed.

Remarks

This member function calls the CBaseList::RemoveI member function.


CGenericList::RemoveHead

CGenericList Class

Removes the first node in the list.

OBJECT *RemoveHead( );

Return Values

Returns the pointer to the object that was removed.

Remarks

This member function calls the CBaseList::RemoveHeadI member function.


CGenericList::RemoveTail

CGenericList Class

Removes the last node in the list.

OBJECT *RemoveTail( );

Return Values

Returns the pointer to the object that was removed.

Remarks

This member function calls the CBaseList::RemoveTailI member function.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page