SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DS_QueueLinkedList.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
20
21
22 #ifndef __QUEUE_LINKED_LIST_H
23 #define __QUEUE_LINKED_LIST_H
24
25 #include "DS_LinkedList.h"
26 #include "Export.h"
27 #include "memoryoverride.h"
28
31 namespace DataStructures
32 {
34 template <class QueueType>
35 class RAK_DLL_EXPORT QueueLinkedList
36 {
37
38 public:
39 QueueLinkedList();
40 QueueLinkedList( const QueueLinkedList& original_copy );
41 bool operator= ( const QueueLinkedList& original_copy );
42 QueueType Pop( void );
43 QueueType& Peek( void );
44 QueueType& EndPeek( void );
45 void Push( const QueueType& input );
46 unsigned int Size( void );
47 void Clear( void );
48 void Compress( void );
49
50 private:
51 LinkedList<QueueType> data;
52 };
53
54 template <class QueueType>
55 QueueLinkedList<QueueType>::QueueLinkedList()
56 {
57 }
58
59 template <class QueueType>
60 inline unsigned int QueueLinkedList<QueueType>::Size()
61 {
62 return data.Size();
63 }
64
65 template <class QueueType>
66 inline QueueType QueueLinkedList<QueueType>::Pop( void )
67 {
68 data.Beginning();
69 return ( QueueType ) data.Pop();
70 }
71
72 template <class QueueType>
73 inline QueueType& QueueLinkedList<QueueType>::Peek( void )
74 {
75 data.Beginning();
76 return ( QueueType ) data.Peek();
77 }
78
79 template <class QueueType>
80 inline QueueType& QueueLinkedList<QueueType>::EndPeek( void )
81 {
82 data.End();
83 return ( QueueType ) data.Peek();
84 }
85
86 template <class QueueType>
87 void QueueLinkedList<QueueType>::Push( const QueueType& input )
88 {
89 data.End();
90 data.Add( input );
91 }
92
93 template <class QueueType>
94 QueueLinkedList<QueueType>::QueueLinkedList( const QueueLinkedList& original_copy )
95 {
96 data = original_copy.data;
97 }
98
99 template <class QueueType>
100 bool QueueLinkedList<QueueType>::operator= ( const QueueLinkedList& original_copy )
101 {
102 if ( ( &original_copy ) == this )
103 return false;
104
105 data = original_copy.data;
106 }
107
108 template <class QueueType>
109 void QueueLinkedList<QueueType>::Clear ( void )
110 {
111 data.Clear();
112 }
113 } // End namespace
114
115 #endif