|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CBufFIFO Class ReferenceThis class is a dynamic size FIFO that contains variable size uint8 buffer.
More...
#include <buf_fifo.h>
List of all members.
Detailed Description
This class is a dynamic size FIFO that contains variable size uint8 buffer.
It's used in the layer1 network for storing temporary messages. You can resize the internal FIFO buffer if you know the average size of data you'll put in it. It have the same behavior as STL so if the buffer is full the size will be automatically increase by 2. CBufFIFO fifo;
fifo.resize(10000);
vector<uint8> vec;
vec.resize(rand()%256);
memset (&(vec[0]), '-', vec.size());
fifo.push(vec);
fifo.display();
vector<uint8> vec2;
fifo.pop(vec2);
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 64 of file buf_fifo.h.
Member Typedef Documentation
typedef uint32 NLMISC::CBufFIFO::TFifoSize [private]
|
|
Constructor & Destructor Documentation
NLMISC::CBufFIFO::CBufFIFO |
( |
|
) |
|
|
NLMISC::CBufFIFO::~CBufFIFO |
( |
|
) |
|
|
Member Function Documentation
bool NLMISC::CBufFIFO::canFit |
( |
uint32 |
size |
) |
[private] |
|
void NLMISC::CBufFIFO::clear |
( |
|
) |
|
|
void NLMISC::CBufFIFO::display |
( |
|
) |
|
|
|
display the FIFO to stdout (used to debug the FIFO).
Definition at line 524 of file buf_fifo.cpp.
References _Buffer, _BufferSize, _Head, _Rewinder, _Tail, NLMISC::DebugLog, size, and NLMISC::smprintf.
Referenced by front, pop, push, and resize. |
void NLMISC::CBufFIFO::displayStats |
( |
|
) |
|
|
|
display the FIFO statistics (speed, nbcall, etc...) to stdout.
Definition at line 510 of file buf_fifo.cpp.
References _BiggestBlock, _BiggestBuffer, _Fronted, _FrontedTime, _Pushed, _PushedTime, _Resized, _ResizedTime, _SmallestBlock, _SmallestBuffer, and nlinfo. |
bool NLMISC::CBufFIFO::empty |
( |
|
) |
[inline] |
|
void NLMISC::CBufFIFO::front |
( |
uint8 *& |
buffer, |
|
|
uint32 & |
size |
|
) |
|
|
|
Definition at line 343 of file buf_fifo.cpp.
References _Buffer, _Fronted, _FrontedTime, _Rewinder, _Tail, display, empty, nldebug, nlwarning, size, TFifoSize, and NLMISC::TTicks. |
void NLMISC::CBufFIFO::front |
( |
std::vector< uint8 > & |
buffer |
) |
|
|
uint8 NLMISC::CBufFIFO::frontLast |
( |
|
) |
|
|
void NLMISC::CBufFIFO::pop |
( |
|
) |
|
|
|
Pop the buffer in the tail of the FIFO.
Definition at line 157 of file buf_fifo.cpp.
References _Buffer, _Empty, _Head, _Rewinder, _Tail, display, empty, nldebug, nlwarning, size, and TFifoSize.
Referenced by NLNET::CBufSock::flush. |
void NLMISC::CBufFIFO::push |
( |
const std::vector< uint8 > & |
buffer1, |
|
|
const std::vector< uint8 > & |
buffer2 |
|
) |
|
|
|
Concate and push 'buffer1' and buffer2 in the head of the FIFO. The goal is to avoid a copy.
Definition at line 106 of file buf_fifo.cpp.
References _BiggestBlock, _BufferSize, _Empty, _Head, _Pushed, _PushedTime, _SmallestBlock, canFit, display, nlassert, nldebug, resize, size, TFifoSize, and NLMISC::TTicks. |
void NLMISC::CBufFIFO::push |
( |
const uint8 * |
buffer, |
|
|
uint32 |
size |
|
) |
|
|
|
Definition at line 65 of file buf_fifo.cpp.
References _BiggestBlock, _BufferSize, _Empty, _Head, _Pushed, _PushedTime, _SmallestBlock, canFit, display, nlassert, nldebug, resize, size, TFifoSize, and NLMISC::TTicks. |
void NLMISC::CBufFIFO::push |
( |
const std::vector< uint8 > & |
buffer |
) |
[inline] |
|
void NLMISC::CBufFIFO::resize |
( |
uint32 |
size |
) |
|
|
|
Set the size of the FIFO buffer in byte.
Definition at line 422 of file buf_fifo.cpp.
References _BiggestBuffer, _Buffer, _BufferSize, _Head, _Resized, _ResizedTime, _Rewinder, _SmallestBuffer, _Tail, display, empty, nlassert, nldebug, nlerror, nlwarning, size, size, and NLMISC::TTicks.
Referenced by push. |
uint32 NLMISC::CBufFIFO::size |
( |
|
) |
|
|
|
Returns the size of the FIFO.
Definition at line 395 of file buf_fifo.cpp.
References _Buffer, _BufferSize, _Head, _Rewinder, _Tail, empty, nlassert, and nlstop.
Referenced by canFit, display, front, frontLast, pop, push, resize, and NLNET::CBufSock::update. |
Member Data Documentation
uint32 NLMISC::CBufFIFO::_BiggestBlock [private]
|
|
uint32 NLMISC::CBufFIFO::_BiggestBuffer [private]
|
|
uint8* NLMISC::CBufFIFO::_Buffer [private]
|
|
uint32 NLMISC::CBufFIFO::_BufferSize [private]
|
|
bool NLMISC::CBufFIFO::_Empty [private]
|
|
uint32 NLMISC::CBufFIFO::_Fronted [private]
|
|
TTicks NLMISC::CBufFIFO::_FrontedTime [private]
|
|
uint8* NLMISC::CBufFIFO::_Head [private]
|
|
uint32 NLMISC::CBufFIFO::_Pushed [private]
|
|
TTicks NLMISC::CBufFIFO::_PushedTime [private]
|
|
uint32 NLMISC::CBufFIFO::_Resized [private]
|
|
TTicks NLMISC::CBufFIFO::_ResizedTime [private]
|
|
uint8* NLMISC::CBufFIFO::_Rewinder [private]
|
|
uint32 NLMISC::CBufFIFO::_SmallestBlock [private]
|
|
uint32 NLMISC::CBufFIFO::_SmallestBuffer [private]
|
|
uint8* NLMISC::CBufFIFO::_Tail [private]
|
|
The documentation for this class was generated from the following files:
|
|