OpenBarnyard
 
Loading...
Searching...
No Matches
T2GenericSList Class Reference

#include <T2SList.h>

Inheritance diagram for T2GenericSList:
T2SList< T, Unknown >

Classes

class  Node
 

Public Member Functions

 T2GenericSList ()=default
 
 ~T2GenericSList ()=default
 
void Reset ()
 
NodeBegin () const
 
NodeRBegin () const
 
NodeEnd () const
 
NodeREnd () const
 
TBOOL IsLinked () const
 
TBOOL IsEmpty () const
 
NodeBack () const
 
NodeFindNodeBefore (Node *a_pNode)
 
void PushBack (Node *a_pNode)
 
void PushFront (Node *a_pNode)
 
NodePopBack ()
 
NodePopFront ()
 
NodeErase (Node *a_pFrom, Node *a_pTo)
 
void Clear ()
 
TUINT Size () const
 
NodeTransfer (Node *a_pNode, T2GenericSList &a_rList)
 

Detailed Description

Definition at line 6 of file T2SList.h.

Constructor & Destructor Documentation

◆ T2GenericSList()

T2GenericSList::T2GenericSList ( )
default

◆ ~T2GenericSList()

T2GenericSList::~T2GenericSList ( )
default

Member Function Documentation

◆ Back()

Node * T2GenericSList::Back ( ) const
inline

Definition at line 87 of file T2SList.h.

88 {
89 Node* pBack = End();
90
91 for ( auto it = Begin(); it != End(); it = it->Next() )
92 {
93 pBack = it;
94 }
95
96 return pBack;
97 }
Node * End() const
Definition T2SList.h:67
Node * Begin() const
Definition T2SList.h:57

◆ Begin()

Node * T2GenericSList::Begin ( ) const
inline

Definition at line 57 of file T2SList.h.

58 {
59 return m_oRoot.Next();
60 }

◆ Clear()

void T2GenericSList::Clear ( )
inline

Definition at line 156 of file T2SList.h.

157 {
158 Node* pNode = Begin();
159
160 while ( pNode != End() )
161 {
162 Node* pNext = pNode->Next();
163 pNode->m_pNext = pNode;
164 pNode = pNext;
165 }
166
167 m_oRoot.m_pNext = &m_oRoot;
168 }

◆ End()

Node * T2GenericSList::End ( ) const
inline

Definition at line 67 of file T2SList.h.

68 {
69 return &m_oRoot;
70 }

◆ Erase()

Node * T2GenericSList::Erase ( Node * a_pFrom,
Node * a_pTo )
inline

Definition at line 141 of file T2SList.h.

142 {
143 Node* pNodeBefore = FindNodeBefore( a_pFrom );
144
145 while ( a_pFrom != a_pTo )
146 {
147 Node* pNext = a_pFrom->m_pNext;
148 a_pFrom->m_pNext = a_pFrom;
149 a_pFrom = pNext;
150 }
151
152 pNodeBefore->m_pNext = a_pTo;
153 return a_pTo;
154 }
Node * FindNodeBefore(Node *a_pNode)
Definition T2SList.h:99

◆ FindNodeBefore()

Node * T2GenericSList::FindNodeBefore ( Node * a_pNode)
inline

Definition at line 99 of file T2SList.h.

100 {
101 Node* pResult = End();
102
103 for ( auto it = Begin(); it != a_pNode; it = it->Next() )
104 {
105 TASSERT( it != End() );
106 pResult = it;
107 }
108
109 return pResult;
110 }
#define TASSERT(X,...)
Definition Defines.h:138

◆ IsEmpty()

TBOOL T2GenericSList::IsEmpty ( ) const
inline

Definition at line 82 of file T2SList.h.

83 {
84 return m_oRoot.m_pNext == &m_oRoot;
85 }

◆ IsLinked()

TBOOL T2GenericSList::IsLinked ( ) const
inline

Definition at line 77 of file T2SList.h.

78 {
79 return m_oRoot.m_pNext != &m_oRoot;
80 }

◆ PopBack()

Node * T2GenericSList::PopBack ( )
inline

Definition at line 122 of file T2SList.h.

123 {
124 Node* pBack = Back();
125 Node* pNodeBefore = FindNodeBefore( pBack );
126
127 pNodeBefore->m_pNext = &m_oRoot;
128 pBack->m_pNext = pBack;
129
130 return pBack;
131 }
Node * Back() const
Definition T2SList.h:87

◆ PopFront()

Node * T2GenericSList::PopFront ( )
inline

Definition at line 133 of file T2SList.h.

134 {
135 Node* pNode = Begin();
136 m_oRoot.m_pNext = pNode->m_pNext;
137 pNode->m_pNext = pNode;
138 return pNode;
139 }

◆ PushBack()

void T2GenericSList::PushBack ( Node * a_pNode)
inline

Definition at line 112 of file T2SList.h.

113 {
114 a_pNode->InsertAfter( Back() );
115 }

◆ PushFront()

void T2GenericSList::PushFront ( Node * a_pNode)
inline

Definition at line 117 of file T2SList.h.

118 {
119 a_pNode->InsertAfter( &m_oRoot );
120 }

◆ RBegin()

Node * T2GenericSList::RBegin ( ) const
inline

Definition at line 62 of file T2SList.h.

63 {
64 return m_oRoot.Next();
65 }

◆ REnd()

Node * T2GenericSList::REnd ( ) const
inline

Definition at line 72 of file T2SList.h.

73 {
74 return &m_oRoot;
75 }

◆ Reset()

void T2GenericSList::Reset ( )
inline

Definition at line 52 of file T2SList.h.

53 {
54 m_oRoot.Reset();
55 }

◆ Size()

TUINT T2GenericSList::Size ( ) const
inline

Definition at line 170 of file T2SList.h.

171 {
172 TUINT uiSize = 0;
173
174 for ( auto it = Begin(); it != End(); it = it->Next() )
175 {
176 uiSize++;
177 }
178
179 return uiSize;
180 }
unsigned int TUINT
Definition Typedefs.h:8

◆ Transfer()

Node * T2GenericSList::Transfer ( Node * a_pNode,
T2GenericSList & a_rList )
inline

Definition at line 182 of file T2SList.h.

183 {
184 Node* pNodeBefore = FindNodeBefore( a_pNode );
185 pNodeBefore->m_pNext = a_pNode->m_pNext;
186 a_pNode->m_pNext = a_pNode;
187 a_rList.PushBack( a_pNode );
188
189 return pNodeBefore;
190 }
void PushBack(Node *a_pNode)
Definition T2SList.h:112

The documentation for this class was generated from the following file: