#ifndef __LISTINT_H__ #define __LISTINT_H__ #include "datalibx.h" ////////////////////////////////////////////////////////////////////////////// // CListInt Class // // This class does not take responsibility for deleting the data indexed by it class CListIterInt; class CListInt { public: friend class CListIterInt; public: CListInt(); ~CListInt(); BOOL Init(); protected: VOID Uninit(); public: // Insertion Functions inline VOID *Insert(VOID *pData, INT_32 iKey); VOID *InsertForward(VOID *pData, INT_32 iKey); VOID *InsertBackward(VOID *pData, INT_32 iKey); VOID *InsertFirst(VOID *pData, INT_32 iKey); VOID *InsertLast(VOID *pData, INT_32 iKey); VOID InsertArray(VOID *pDataArray, size_t sizeItem, UINT_32 uiNumItems); // Deletion Functions inline VOID *Remove(INT_32 iKey); VOID *Remove(VOID *pvData); VOID *RemoveForward(INT_32 iKey); VOID *RemoveBackward(INT_32 iKey); VOID *RemoveFirst(INT_32 *piKey = NULL); VOID *RemoveLast(INT_32 *piKey = NULL); VOID RemoveAll(); // Look up Functions inline VOID *Peek(INT_32 iKey) const; VOID *PeekForward(INT_32 iKey) const; VOID *PeekBackward(INT_32 iKey) const; VOID *PeekFirst(INT_32 *piKey = NULL) const; VOID *PeekLast(INT_32 *piKey = NULL) const; #define SORT_ENABLED #ifdef SORT_ENABLED // Sorting Functions BOOL Sort(); // This preforms a Merge Sort #endif // SORT_ENABLED // Display Functions VOID Display(); //Inlined Functions public: UINT_32 GetLength(); protected: VOID *m_pCList; }; ////////////////////////////////////////////////// // Inlined Functions // inline VOID *CListInt::Insert(VOID *pvData, INT_32 iKey) { return InsertForward(pvData, iKey); } inline VOID *CListInt::Remove(INT_32 iKey) { return RemoveForward(iKey); } inline VOID *CListInt::Peek(INT_32 iKey) const { return PeekForward(iKey); } ////////////////////////////////////////////////////////////////////////////// // CListIterInt Class // class CListIterInt { public: CListIterInt(); ~CListIterInt(); BOOL Init(const CListInt *pCListInt); protected: VOID Uninit(); public: // Iteration Functions VOID *Peek(INT_32 iKey); VOID *PeekForward(INT_32 iKey); VOID *PeekBackward(INT_32 iKey); VOID *PeekFirst(INT_32 *piKey = NULL); VOID *PeekNext(INT_32 *piKey = NULL); VOID *PeekLast(INT_32 *piKey = NULL); VOID *PeekPrev(INT_32 *piKey = NULL); protected: VOID *m_pCListIter; }; ////////////////////////////////////////////////// // Inlined Functions // inline VOID *CListIterInt::Peek(INT_32 iKey) { return PeekForward(iKey); } #endif // __LISTINT_H__