text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

ListP.h

Go to the documentation of this file.
00001 
00017 #include "ListException.h"
00018 #include "ListIndexOutOfRangeException.h"
00019 typedef desired-type-of-list-item ListItemType;
00020 
00023 class List
00024 {
00025 public:
00026 // Constructors and destructor:
00027 
00029    List();
00030 
00033    List(const List& aList);
00034 
00036    ~List();
00037 
00038 // List operations:
00039    bool isEmpty() const;
00040    int getLength() const;
00041    void insert(int index, const ListItemType& newItem)
00042       throw(ListIndexOutOfRangeException, ListException);
00043    void remove(int index)
00044       throw(ListIndexOutOfRangeException);
00045    void retrieve(int index, ListItemType& dataItem) const
00046       throw(ListIndexOutOfRangeException);
00047 
00048 private:
00050    struct ListNode
00051    {
00053       ListItemType item;
00055       ListNode    *next;
00056    }; // end ListNode
00057 
00059    int       size;
00061    ListNode *head;
00062 
00070    ListNode *find(int index) const;
00071 }; // end List
00072 // End of header file.

Generated on Sun Aug 27 16:41:19 2006 for AWLogo by  doxygen 1.4.6