00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 # ifndef TPL_DYNLISTQUEUE_H
00045 # define TPL_DYNLISTQUEUE_H
00046
00047 # include <tpl_listQueue.H>
00048
00049 namespace Aleph {
00050
00059 template <typename T>
00060 class DynListQueue : public ListQueue<T>
00061 {
00062 typedef typename ListQueue<T>::Node Node;
00063
00064 public:
00065
00066
00078 T & put(const T & data) throw(std::exception, std::bad_alloc)
00079 {
00080 Node * ptr = new Node (data);
00081
00082 ListQueue<T>::put(ptr);
00083
00084 return ptr->get_data();
00085 }
00086
00094 T get() throw(std::exception, std::underflow_error)
00095 {
00096 Node * ptr = ListQueue<T>::get();
00097
00098 T ret_val = ptr->get_data();
00099 delete ptr;
00100
00101 return ret_val;
00102 }
00103
00105 T & front() const throw(std::exception, std::underflow_error)
00106 {
00107 return ListQueue<T>::front()->get_data();
00108 }
00109
00111 T & rear() const throw(std::exception, std::underflow_error)
00112 {
00113 return ListQueue<T>::rear()->get_data();
00114 }
00115
00117 virtual ~DynListQueue()
00118 {
00119 while (not this->is_empty())
00120 get();
00121 }
00122 };
00123
00124 }
00125 # endif // TPL_DYNLISTQUEUE_H
00126