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. |
Inserts a node or list of nodes after the specified node.
POSITION AddAfter(
POSITION p,
OBJECT * pObj
);
BOOL AddAfter(
POSITION pos,
CGenericList<OBJECT> *pList
);
Returns the position of the inserted object in the case of single-object insertion. For list insertion, returns TRUE if successful; otherwise, returns FALSE.
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.
Inserts a node or list of nodes before the specified node.
POSITION AddBefore(
POSITION p,
OBJECT * pObj
);
BOOL AddBefore(
POSITION pos,
CGenericList<OBJECT> *pList
);
Returns the position of the inserted object in the case of single-object insertion. For list insertion, returns TRUE if successful; otherwise, returns FALSE.
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.
Inserts a node or list of nodes at the front of the list.
POSITION AddHead(
OBJECT * pObj
);
BOOL AddHead(
CGenericList<OBJECT> *pList
);
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.
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.
Appends a node or list of nodes to the end of the list.
POSITION AddTail(
OBJECT * pObj
);
BOOL AddTail(
CGenericList<OBJECT> *pList
);
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.
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.
Constructs a CGenericList object.
CGenericList(
TCHAR *pName,
INT iItems,
BOOL bLock,
BOOL bAlert
);
CGenericList(
TCHAR *pName
);
No return value.
This constructor calls the CBaseList constructor.
Retrieves the first position that contains the specified object.
POSITION Find(
OBJECT * pObj
);
Returns a position cursor.
This member function calls the CBaseList::FindI member function.
Retrieves the object at the specified position.
OBJECT *Get(
POSITION pos
);
Returns a pointer to an object.
This member function calls the CBaseList::GetI member function.
Retrieves the number of objects (object count) in the list.
int GetCount( );
Returns the value of m_Count.
Retrieves the object at the head of the list.
OBJECT GetHead( );
Returns the head of the list by calling CGenericList::GetHeadPosition.
Retrieves a cursor identifying the first element of the list.
POSITION GetHeadPosition( );
Returns the position cursor held by m_pFirst.
Retrieves the specified object and update position.
OBJECT *GetNext(
POSITION& rp
);
Returns a pointer to an object at the next position.
This member function calls the CBaseList::GetNextI member function.
Retrieves a cursor identifying the last element of the list.
POSITION GetTailPosition( );
Returns the position cursor held by m_pLast.
Removes the specified node from the list.
OBJECT *Remove(
POSITION pos
);
Returns the pointer to the object that was removed.
This member function calls the CBaseList::RemoveI member function.
Removes the first node in the list.
OBJECT *RemoveHead( );
Returns the pointer to the object that was removed.
This member function calls the CBaseList::RemoveHeadI member function.
Removes the last node in the list.
OBJECT *RemoveTail( );
Returns the pointer to the object that was removed.
This member function calls the CBaseList::RemoveTailI member function.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.