Main Page   Compound List   File List   Compound Members  

list.h

00001 
00002 #ifndef LIST_H
00003 #define LIST_H
00004 
00005 #include <stdexcept>
00006 #include <new>
00007 #include "node.h"
00008 
00009 using namespace std;
00010 
00011 /*=========================================================================*/
00012 
00021 template <typename T>
00022 class List {
00023 
00024   public:
00025     List();
00026     List( const List<T> & ) throw ( bad_alloc );
00027     ~List();
00028     unsigned size() const;
00029     void clear();
00030     bool empty() const;
00031     void push_back(const T &) throw ( bad_alloc );
00032     void push_front(const T &) throw ( bad_alloc );
00033     T pop_front() throw ( ListEmpty );
00034     T pop_back() throw ( ListEmpty );
00035     T &getFront() const throw ( ListEmpty );
00036     T &getCurrent() const throw ( ListEmpty );
00037     T &getBack() const throw ( ListEmpty );
00038     void insertBeforeCurrent(const T &) throw ( ListEmpty, bad_alloc );
00039     void insertAfterCurrent(const T &) throw ( ListEmpty, bad_alloc );
00040     T removeCurrent() throw ( ListEmpty );
00041     void setToFront() throw ( ListEmpty );
00042     void setToBack() throw ( ListEmpty );
00043     void moveForward() throw ( ListEmpty );
00044     void moveBackward() throw ( ListEmpty );
00045     bool find( const T & ) throw ( ListEmpty );
00046     bool atFront() const throw ( ListEmpty );
00047     bool atBack() const throw ( ListEmpty );
00048     const List<T> &operator=( const List<T> & ) throw ( bad_alloc);
00049 
00050   private:
00051     Node<T> *head, *tail;
00052     Node<T> *current;
00053     unsigned sz;
00054 
00055 }; // List class
00056 
00057 /*------------------------------------------------------------------------*/
00058 
00063 template <typename T>
00064 List<T>::List()
00065 {
00066 } // List<T>::List
00067 
00068 /*------------------------------------------------------------------------*/
00069 
00076 template <typename T>
00077 List<T>::List( const List<T> &l ) throw ( bad_alloc )
00078 {
00079 } // List<T>::List
00080 
00081 /*------------------------------------------------------------------------*/
00082 
00087 template <typename T>
00088 List<T>::~List()
00089 {
00090 } // List<T>::~List
00091 
00092 /*------------------------------------------------------------------------*/
00093 
00100 template <typename T>
00101 unsigned List<T>::size() const
00102 {
00103 } // List<T>::size
00104 
00105 /*------------------------------------------------------------------------*/
00106 
00111 template <typename T>
00112 void List<T>::clear()
00113 {
00114 } // List<T>::clear
00115 
00116 /*------------------------------------------------------------------------*/
00117 
00124 template <typename T>
00125 bool List<T>::empty() const
00126 {
00127 } // List<T>::empty
00128 
00129 /*------------------------------------------------------------------------*/
00130 
00139 template <typename T>
00140 void List<T>::push_back(const T &object) throw ( bad_alloc )
00141 {
00142 } // List<T>::push_back
00143 
00144 /*------------------------------------------------------------------------*/
00145 
00154 template <typename T>
00155 void List<T>::push_front(const T &object) throw ( bad_alloc )
00156 {
00157 } // List<T>::push_front
00158 
00159 /*------------------------------------------------------------------------*/
00160 
00170 template <typename T>
00171 T List<T>::pop_front() throw ( ListEmpty )
00172 {
00173 } // List<T>::pop_front
00174 
00175 /*------------------------------------------------------------------------*/
00176 
00186 template <typename T>
00187 T List<T>::pop_back() throw ( ListEmpty )
00188 {
00189 } // List<T>::pop_back
00190 
00191 /*------------------------------------------------------------------------*/
00192 
00201 template <typename T>
00202 T &List<T>::getFront() const throw ( ListEmpty )
00203 {
00204 } // List<T>::getFront
00205 
00206 /*------------------------------------------------------------------------*/
00207 
00215 template <typename T>
00216 T &List<T>::getCurrent() const throw ( ListEmpty )
00217 {
00218 } // List<T>::getCurrent
00219 
00220 /*------------------------------------------------------------------------*/
00221 
00230 template <typename T>
00231 T &List<T>::getBack() const throw ( ListEmpty )
00232 {
00233 } // List<T>::getBack
00234 
00235 /*------------------------------------------------------------------------*/
00236 
00246 template <typename T>
00247 void List<T>::insertBeforeCurrent(const T &object) throw (ListEmpty, bad_alloc)
00248 {
00249 } // List<T>::insertBeforeCurrent
00250 
00251 /*------------------------------------------------------------------------*/
00252 
00262 template <typename T>
00263 void List<T>::insertAfterCurrent(const T &object) throw (ListEmpty, bad_alloc)
00264 {
00265 } // List<T>::insertAfterCurrent
00266 
00267 /*------------------------------------------------------------------------*/
00268 
00278 template <typename T>
00279 T List<T>::removeCurrent() throw ( ListEmpty )
00280 {
00281 } // List<T>::removeCurrent
00282 
00283 /*------------------------------------------------------------------------*/
00284 
00291 template <typename T>
00292 void List<T>::setToFront() throw ( ListEmpty )
00293 {
00294 } // List<T>::setToFront
00295 
00296 /*------------------------------------------------------------------------*/
00297 
00304 template <typename T>
00305 void List<T>::setToBack() throw ( ListEmpty )
00306 {
00307 } // List<T>::setToBack
00308 
00309 /*------------------------------------------------------------------------*/
00310 
00318 template <typename T>
00319 void List<T>::moveForward() throw ( ListEmpty )
00320 {
00321 } // List<T>::moveForward
00322 
00323 /*------------------------------------------------------------------------*/
00324 
00332 template <typename T>
00333 void List<T>::moveBackward() throw ( ListEmpty )
00334 {
00335 } // List<T>::moveBackward
00336 
00337 /*------------------------------------------------------------------------*/
00338 
00349 template <typename T>
00350 bool List<T>::find( const T &object ) throw ( ListEmpty )
00351 {
00352 } // List<T>::find
00353 
00354 /*------------------------------------------------------------------------*/
00355 
00364 template <typename T>
00365 bool List<T>::atFront() const throw ( ListEmpty )
00366 {
00367 } // List<T>::atFront
00368 
00369 /*------------------------------------------------------------------------*/
00370 
00379 template <typename T>
00380 bool List<T>::atBack() const throw ( ListEmpty )
00381 {
00382 } // List<T>::atBack
00383 
00384 /*------------------------------------------------------------------------*/
00385 
00394 template <typename T>
00395 const List<T> &List<T>::operator=( const List<T> &list ) throw ( bad_alloc )
00396 {
00397 } // List<T>::operator=
00398 
00399 #endif // LIST_H

Generated on Thu Mar 31 18:12:54 2005 by doxygen1.3