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

#include <TDList.h>

Inheritance diagram for TGenericPriList:
TPriList< TGenericListener > TPriList< TOrderTable > TPriList< T >

Classes

class  TNode
 

Public Member Functions

TBOOL IsEmpty ()
 
TNodeHead ()
 
TNodeTail ()
 
TNodeBegin ()
 
TNodeEnd ()
 
void Insert (TNode *a_pNode, TINT iPriority)
 
void Insert (TNode *a_pNode)
 
void RemoveAll ()
 

Protected Member Functions

 TGenericPriList ()
 
 ~TGenericPriList ()
 

Detailed Description

Definition at line 82 of file TDList.h.

Constructor & Destructor Documentation

◆ TGenericPriList()

TGenericPriList::TGenericPriList ( )
protected

Definition at line 121 of file TPriList.cpp.

122{
123 m_pNext = End();
124 m_pPrev = End();
125}
TNode * End()
Definition TDList.h:135

◆ ~TGenericPriList()

TGenericPriList::~TGenericPriList ( )
protected

Definition at line 127 of file TPriList.cpp.

128{
129 RemoveAll();
130}

Member Function Documentation

◆ Begin()

TNode * TGenericPriList::Begin ( )
inline

Definition at line 134 of file TDList.h.

134{ return m_pNext; }

◆ End()

TNode * TGenericPriList::End ( )
inline

Definition at line 135 of file TDList.h.

135{ return (TNode*)this; }

◆ Head()

TNode * TGenericPriList::Head ( )
inline

Definition at line 132 of file TDList.h.

132{ return m_pNext; }

◆ Insert() [1/2]

void TGenericPriList::Insert ( TNode * a_pNode)

Definition at line 34 of file TPriList.cpp.

35{
36 TINT iPriority = a_pNode->m_iPriority;
37
38 if ( iPriority < 0 )
39 {
40 TNode* pCurNode = m_pNext;
41
42 while ( pCurNode != End() && pCurNode->m_iPriority <= iPriority )
43 {
44 pCurNode = pCurNode->m_pNext;
45 }
46
47 a_pNode->m_pNext = pCurNode;
48 a_pNode->m_pPrev = pCurNode->m_pPrev;
49 pCurNode->m_pPrev = a_pNode;
50 a_pNode->m_pPrev->m_pNext = a_pNode;
51 }
52 else
53 {
54 TNode* pCurNode = m_pPrev;
55 while ( pCurNode != End() && iPriority < pCurNode->m_iPriority )
56 {
57 pCurNode = pCurNode->m_pPrev;
58 }
59 a_pNode->m_pPrev = pCurNode;
60 a_pNode->m_pNext = pCurNode->m_pNext;
61 pCurNode->m_pNext = a_pNode;
62 a_pNode->m_pNext->m_pPrev = a_pNode;
63 }
64}
int TINT
Definition Typedefs.h:7

◆ Insert() [2/2]

void TGenericPriList::Insert ( TNode * a_pNode,
TINT iPriority )

Definition at line 66 of file TPriList.cpp.

67{
68 a_pNode->SetPriority( iPriority );
69 Insert( a_pNode );
70}
void Insert(TNode *a_pNode, TINT iPriority)
Definition TPriList.cpp:66

◆ IsEmpty()

TBOOL TGenericPriList::IsEmpty ( )
inline

Definition at line 131 of file TDList.h.

131{ return m_pNext == End(); }

◆ RemoveAll()

void TGenericPriList::RemoveAll ( )

Definition at line 72 of file TPriList.cpp.

73{
74 TNode* pNode = m_pNext;
75
76 while ( pNode != End() )
77 {
78 pNode->Remove();
79 pNode = m_pNext;
80 }
81}

◆ Tail()

TNode * TGenericPriList::Tail ( )
inline

Definition at line 133 of file TDList.h.

133{ return m_pPrev; }

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