#include <TFifo.h>
Definition at line 10 of file TFifo.h.
◆ Flags
◆ Flags_
Enumerator |
---|
Flags_None | |
Flags_PollSemaphore | |
Flags_NoSemaphore | |
Definition at line 14 of file TFifo.h.
◆ TGenericFifo()
TGenericFifo::TGenericFifo |
( |
| ) |
|
|
protecteddefault |
◆ Create()
Definition at line 12 of file TFifo.cpp.
13{
14 TASSERT( a_iMaxItems > 0,
"Max items is less than zero" );
15 TASSERT( a_iItemSize > 0,
"Item size is less than zero" );
16
17 m_iItemSize = a_iItemSize;
18 m_iMaxItems = a_iMaxItems;
19 m_pDataPopCursor = a_pBuffer;
20 m_pDataPushCursor = a_pBuffer;
21 m_pDataBegin = a_pBuffer;
22 m_pDataEnd = a_pBuffer + ( a_iMaxItems * a_iItemSize );
23
25 bResult = m_Semaphore1.Create( m_iMaxItems, m_iMaxItems );
26 TASSERT( bResult !=
TFALSE,
"Unable to create semaphore for TGenericFifo" );
27 bResult = m_Semaphore2.Create( 0, m_iMaxItems );
28 TASSERT( bResult !=
TFALSE,
"Unable to create semaphore for TGenericFifo" );
29
30 InitializeCriticalSection( &m_CriticalSection );
32}
◆ Destroy()
TBOOL TGenericFifo::Destroy |
( |
| ) |
|
|
protected |
Definition at line 34 of file TFifo.cpp.
35{
36 DeleteCriticalSection( &m_CriticalSection );
37 m_Semaphore1.Destroy();
38 m_Semaphore2.Destroy();
40}
◆ Pop()
TBOOL TGenericFifo::Pop |
( |
void * | a_pOut, |
|
|
Flags | a_iFlags ) |
|
protected |
Definition at line 67 of file TFifo.cpp.
68{
70 if ( !bResult )
return TFALSE;
71
72 EnterCriticalSection( &m_CriticalSection );
73
74
76 m_pDataPopCursor += m_iItemSize;
77
78 if ( m_pDataPopCursor == m_pDataEnd )
79 {
80
81 m_pDataPopCursor = m_pDataBegin;
82 }
83
84 LeaveCriticalSection( &m_CriticalSection );
85
86 bResult = m_Semaphore1.Signal();
87 TASSERT( bResult !=
TFALSE,
"TSemaphore::Signal returned TFALSE" );
88
90}
static void * MemCopy(void *dst, const void *src, TSIZE size)
◆ Push()
TBOOL TGenericFifo::Push |
( |
void * | a_pItem, |
|
|
Flags | a_iFlags ) |
|
protected |
Definition at line 42 of file TFifo.cpp.
43{
45 if ( !bResult )
return TFALSE;
46
47 EnterCriticalSection( &m_CriticalSection );
48
49
50 Toshi::TUtil::MemCopy( m_pDataPushCursor, a_pItem, m_iItemSize );
51 m_pDataPushCursor += m_iItemSize;
52
53 if ( m_pDataPushCursor == m_pDataEnd )
54 {
55
56 m_pDataPushCursor = m_pDataBegin;
57 }
58
59 LeaveCriticalSection( &m_CriticalSection );
60
61 bResult = m_Semaphore2.Signal();
62 TASSERT( bResult !=
TFALSE,
"TSemaphore::Signal returned TFALSE" );
63
65}
The documentation for this class was generated from the following files:
- D:/_dev/OpenBarnyard/Source/Toshi/Source/Toshi/TFifo.h
- D:/_dev/OpenBarnyard/Source/Toshi/Source/Toshi/TFifo.cpp