00001
00002 #ifndef LIST_H
00003 #define LIST_H
00004
00005 #include <iostream>
00006 #include <stdexcept>
00007 #include <new>
00008 #include "node.h"
00009
00010 using namespace std;
00011
00012
00013
00021 class ListEmpty : public runtime_error {
00022 public:
00023 ListEmpty::ListEmpty()
00024 : runtime_error( "list empty" ) {}
00025 };
00026
00027
00028
00037 template <typename T>
00038 class List {
00039
00040 public:
00041 List();
00042 ~List();
00043 void clear();
00044 bool empty() const;
00045 void push_back(const T &) throw ( bad_alloc );
00046 void push_front(const T &) throw ( bad_alloc );
00047 T pop_front() throw ( ListEmpty );
00048 T pop_back() throw ( ListEmpty );
00049 T getFront() const throw ( ListEmpty );
00050 T getCurrent() const throw ( ListEmpty );
00051 T getBack() const throw ( ListEmpty );
00052 void insertBeforeCurrent(const T &) throw ( ListEmpty, bad_alloc );
00053 void insertAfterCurrent(const T &) throw ( ListEmpty, bad_alloc );
00054 T removeCurrent() throw ( ListEmpty );
00055 void setToFront() throw ( ListEmpty );
00056 void setToBack() throw ( ListEmpty );
00057 void moveForward() throw ( ListEmpty );
00058 void moveBackward() throw ( ListEmpty );
00059 bool atFront() const throw ( ListEmpty );
00060 bool atBack() const throw ( ListEmpty );
00061
00062 private:
00063 Node<T> *head, *tail;
00064 Node<T> *current;
00065
00066 };
00067
00068
00069
00074 template <typename T>
00075 List<T>::List()
00076 {
00077 }
00078
00079
00080
00085 template <typename T>
00086 List<T>::~List()
00087 {
00088 }
00089
00090
00091
00096 template <typename T>
00097 void List<T>::clear()
00098 {
00099 }
00100
00101
00102
00109 template <typename T>
00110 bool List<T>::empty() const
00111 {
00112 }
00113
00114
00115
00124 template <typename T>
00125 void List<T>::push_back(const T &object) throw ( bad_alloc )
00126 {
00127 }
00128
00129
00130
00139 template <typename T>
00140 void List<T>::push_front(const T &object) throw ( bad_alloc )
00141 {
00142 }
00143
00144
00145
00155 template <typename T>
00156 T List<T>::pop_front() throw ( ListEmpty )
00157 {
00158 }
00159
00160
00161
00171 template <typename T>
00172 T List<T>::pop_back() throw ( ListEmpty )
00173 {
00174 }
00175
00176
00177
00186 template <typename T>
00187 T List<T>::getFront() const throw ( ListEmpty )
00188 {
00189 }
00190
00191
00192
00200 template <typename T>
00201 T List<T>::getCurrent() const throw ( ListEmpty )
00202 {
00203 }
00204
00205
00206
00215 template <typename T>
00216 T List<T>::getBack() const throw ( ListEmpty )
00217 {
00218 }
00219
00220
00221
00231 template <typename T>
00232 void List<T>::insertBeforeCurrent(const T &object) throw ( ListEmpty, bad_alloc )
00233 {
00234 }
00235
00236
00237
00247 template <typename T>
00248 void List<T>::insertAfterCurrent(const T &object) throw ( ListEmpty, bad_alloc )
00249 {
00250 }
00251
00252
00253
00263 template <typename T>
00264 T List<T>::removeCurrent() throw ( ListEmpty )
00265 {
00266 }
00267
00268
00269
00276 template <typename T>
00277 void List<T>::setToFront() throw ( ListEmpty )
00278 {
00279 }
00280
00281
00282
00289 template <typename T>
00290 void List<T>::setToBack() throw ( ListEmpty )
00291 {
00292 }
00293
00294
00295
00303 template <typename T>
00304 void List<T>::moveForward() throw ( ListEmpty )
00305 {
00306 }
00307
00308
00309
00317 template <typename T>
00318 void List<T>::moveBackward() throw ( ListEmpty )
00319 {
00320 }
00321
00322
00323
00332 template <typename T>
00333 bool List<T>::atFront() const throw ( ListEmpty )
00334 {
00335 }
00336
00337
00338
00347 template <typename T>
00348 bool List<T>::atBack() const throw ( ListEmpty )
00349 {
00350 }
00351
00352 #endif // LIST_H