![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 #ifndef __QUEUE_LINKED_LIST_H 00011 #define __QUEUE_LINKED_LIST_H 00012 00013 #include "DS_LinkedList.h" 00014 #include "Export.h" 00015 #include "RakMemoryOverride.h" 00016 00019 namespace DataStructures 00020 { 00022 template <class QueueType> 00023 class RAK_DLL_EXPORT QueueLinkedList 00024 { 00025 00026 public: 00027 QueueLinkedList(); 00028 QueueLinkedList( const QueueLinkedList& original_copy ); 00029 bool operator= ( const QueueLinkedList& original_copy ); 00030 QueueType Pop( void ); 00031 QueueType& Peek( void ); 00032 QueueType& EndPeek( void ); 00033 void Push( const QueueType& input ); 00034 unsigned int Size( void ); 00035 void Clear( void ); 00036 void Compress( void ); 00037 00038 private: 00039 LinkedList<QueueType> data; 00040 }; 00041 00042 template <class QueueType> 00043 QueueLinkedList<QueueType>::QueueLinkedList() 00044 { 00045 } 00046 00047 template <class QueueType> 00048 inline unsigned int QueueLinkedList<QueueType>::Size() 00049 { 00050 return data.Size(); 00051 } 00052 00053 template <class QueueType> 00054 inline QueueType QueueLinkedList<QueueType>::Pop( void ) 00055 { 00056 data.Beginning(); 00057 return ( QueueType ) data.Pop(); 00058 } 00059 00060 template <class QueueType> 00061 inline QueueType& QueueLinkedList<QueueType>::Peek( void ) 00062 { 00063 data.Beginning(); 00064 return ( QueueType ) data.Peek(); 00065 } 00066 00067 template <class QueueType> 00068 inline QueueType& QueueLinkedList<QueueType>::EndPeek( void ) 00069 { 00070 data.End(); 00071 return ( QueueType ) data.Peek(); 00072 } 00073 00074 template <class QueueType> 00075 void QueueLinkedList<QueueType>::Push( const QueueType& input ) 00076 { 00077 data.End(); 00078 data.Add( input ); 00079 } 00080 00081 template <class QueueType> 00082 QueueLinkedList<QueueType>::QueueLinkedList( const QueueLinkedList& original_copy ) 00083 { 00084 data = original_copy.data; 00085 } 00086 00087 template <class QueueType> 00088 bool QueueLinkedList<QueueType>::operator= ( const QueueLinkedList& original_copy ) 00089 { 00090 if ( ( &original_copy ) == this ) 00091 return false; 00092 00093 data = original_copy.data; 00094 } 00095 00096 template <class QueueType> 00097 void QueueLinkedList<QueueType>::Clear ( void ) 00098 { 00099 data.Clear(_FILE_AND_LINE_); 00100 } 00101 } // End namespace 00102 00103 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.