diff options
Diffstat (limited to 'docs/doxygen/nel/a02301.html')
-rw-r--r-- | docs/doxygen/nel/a02301.html | 1872 |
1 files changed, 1872 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02301.html b/docs/doxygen/nel/a02301.html new file mode 100644 index 00000000..7dbcd7d3 --- /dev/null +++ b/docs/doxygen/nel/a02301.html @@ -0,0 +1,1872 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CBufFIFO class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CBufFIFO Class Reference</h1><code>#include <<a class="el" href="a05509.html">buf_fifo.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +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. <pre class="fragment"><div> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa0">CBufFIFO</a> fifo; + fifo.resize(10000); + vector<uint8> vec; + vec.resize(rand()%256); + memset (&(vec[0]), <span class="charliteral">'-'</span>, vec.size()); + <span class="comment">// push the vector</span> + fifo.push(vec); + <span class="comment">// display the fifo</span> + fifo.display(); + vector<uint8> vec2; + <span class="comment">// get the vector</span> + fifo.pop(vec2); +</div></pre><dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00064">64</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa0">CBufFIFO</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa1">clear</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Erase the FIFO. <a href="#NLMISC_1_1CBufFIFOa1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">display the FIFO to stdout (used to debug the FIFO) <a href="#NLMISC_1_1CBufFIFOa2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa3">displayStats</a> (<a class="el" href="a02813.html">CLog</a> *log=<a class="el" href="a05378.html#a12">InfoLog</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">display the FIFO statistics (speed, nbcall, etc...) to stdout <a href="#NLMISC_1_1CBufFIFOa3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return true if the FIFO is empty. <a href="#NLMISC_1_1CBufFIFOa4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa5">front</a> (<a class="el" href="a04558.html#a7">uint8</a> *&<a class="el" href="a04223.html#a589">buffer</a>, <a class="el" href="a04558.html#a11">uint32</a> &<a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa6">front</a> (<a class="el" href="a02271.html">NLMISC::CMemStream</a> &<a class="el" href="a04223.html#a589">buffer</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa7">front</a> (std::vector< <a class="el" href="a04558.html#a7">uint8</a> > &<a class="el" href="a04223.html#a589">buffer</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the buffer in the tail of the FIFO and put it in 'buffer'. <a href="#NLMISC_1_1CBufFIFOa7"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa8">frontLast</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa9">pop</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Pop the buffer in the tail of the FIFO. <a href="#NLMISC_1_1CBufFIFOa9"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa10">push</a> (const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > &buffer1, const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > &buffer2)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Concate and push 'buffer1' and buffer2 in the head of the FIFO. The goal is to avoid a copy. <a href="#NLMISC_1_1CBufFIFOa10"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa11">push</a> (const <a class="el" href="a04558.html#a7">uint8</a> *<a class="el" href="a04223.html#a589">buffer</a>, <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa12">push</a> (const <a class="el" href="a02271.html">NLMISC::CMemStream</a> &<a class="el" href="a04223.html#a589">buffer</a>)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa13">push</a> (const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > &<a class="el" href="a04223.html#a589">buffer</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Push 'buffer' in the head of the FIFO. <a href="#NLMISC_1_1CBufFIFOa13"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa14">resize</a> (<a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the size of the FIFO buffer in byte. <a href="#NLMISC_1_1CBufFIFOa14"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa15">size</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the FIFO. <a href="#NLMISC_1_1CBufFIFOa15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa16">~CBufFIFO</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOd0">canFit</a> (<a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04223.html#a587">size</a>)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr1">_BiggestBuffer</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr5">_Fronted</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a243">TTicks</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr6">_FrontedTime</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr8">_Pushed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a243">TTicks</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr9">_PushedTime</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr10">_Resized</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a243">TTicks</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr11">_ResizedTime</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr14">_SmallestBuffer</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBufFIFOy0" doxytag="NLMISC::CBufFIFO::TFifoSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOy0">NLMISC::CBufFIFO::TFifoSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00117">117</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00354">front()</a>, <a class="el" href="a05508.html#l00207">frontLast()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, and <a class="el" href="a05508.html#l00068">push()</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBufFIFOa0" doxytag="NLMISC::CBufFIFO::CBufFIFO" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBufFIFO::CBufFIFO </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00042">42</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00140">_BiggestBlock</a>, <a class="el" href="a05509.html#l00142">_BiggestBuffer</a>, <a class="el" href="a05509.html#l00145">_Fronted</a>, <a class="el" href="a05509.html#l00148">_FrontedTime</a>, <a class="el" href="a05509.html#l00144">_Pushed</a>, <a class="el" href="a05509.html#l00147">_PushedTime</a>, <a class="el" href="a05509.html#l00146">_Resized</a>, <a class="el" href="a05509.html#l00149">_ResizedTime</a>, <a class="el" href="a05509.html#l00141">_SmallestBlock</a>, and <a class="el" href="a05509.html#l00143">_SmallestBuffer</a>. +<p> +<div class="fragment"><pre>00042 : <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>(NULL), <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a>(0), <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a>(<span class="keyword">true</span>), <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>(NULL), <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>(NULL), <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a>(NULL) +00043 { +00044 <span class="comment">// reset statistic</span> +00045 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a> = 0; +00046 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a> = 999999999; +00047 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr1">_BiggestBuffer</a> = 0; +00048 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr14">_SmallestBuffer</a> = 999999999; +00049 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr8">_Pushed</a> = 0; +00050 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr5">_Fronted</a> = 0; +00051 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr10">_Resized</a> = 0; +00052 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr9">_PushedTime</a> = 0; +00053 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr6">_FrontedTime</a> = 0; +00054 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr11">_ResizedTime</a> = 0; +00055 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa16" doxytag="NLMISC::CBufFIFO::~CBufFIFO" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBufFIFO::~<a class="el" href="a02301.html">CBufFIFO</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00057">57</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +<div class="fragment"><pre>00058 { +00059 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> != NULL) +00060 { +00061 <span class="keyword">delete</span> []<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00062 <span class="preprocessor">#if DEBUG_FIFO</span> +00063 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p delete"</span>, <span class="keyword">this</span>); +00064 <span class="preprocessor">#endif</span> +00065 <span class="preprocessor"></span> } +00066 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBufFIFOd0" doxytag="NLMISC::CBufFIFO::canFit" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBufFIFO::canFit </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>size</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00606">606</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, and <a class="el" href="a05646.html#l00977">s</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00068">push()</a>. +<p> +<div class="fragment"><pre>00607 { +00608 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>) +00609 { +00610 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a>()) +00611 { +00612 <span class="comment">// is the buffer large enough?</span> +00613 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a> >= <a class="code" href="a04223.html#a626">s</a>) +00614 { +00615 <span class="comment">// reset the pointer</span> +00616 <span class="preprocessor">#if DEBUG_FIFO</span> +00617 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p reset tail and head"</span>, <span class="keyword">this</span>); +00618 <span class="preprocessor">#endif</span> +00619 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00620 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00621 } +00622 <span class="keywordflow">else</span> +00623 { +00624 <span class="comment">// buffer not big enough</span> +00625 <span class="preprocessor">#if DEBUG_FIFO</span> +00626 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p buffer full buffersize<size"</span>, <span class="keyword">this</span>); +00627 <span class="preprocessor">#endif</span> +00628 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00629 } +00630 } +00631 <span class="keywordflow">else</span> +00632 { +00633 <span class="comment">// buffer full</span> +00634 <span class="preprocessor">#if DEBUG_FIFO</span> +00635 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p buffer full h=t"</span>, <span class="keyword">this</span>); +00636 <span class="preprocessor">#endif</span> +00637 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00638 } +00639 } +00640 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>) +00641 { +00642 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> + <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> >= (<a class="code" href="a04558.html#a10">sint32</a>) <a class="code" href="a04223.html#a626">s</a>) +00643 { +00644 <span class="comment">// can fit after _Head</span> +00645 <span class="preprocessor">#if DEBUG_FIFO</span> +00646 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p fit after"</span>, <span class="keyword">this</span>); +00647 <span class="preprocessor">#endif</span> +00648 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">true</span>; +00649 } +00650 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> >= (<a class="code" href="a04558.html#a10">sint32</a>) <a class="code" href="a04223.html#a626">s</a>) +00651 { +00652 <span class="comment">// can fit at the beginning</span> +00653 <span class="preprocessor">#if DEBUG_FIFO</span> +00654 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p fit at beginning"</span>, <span class="keyword">this</span>); +00655 <span class="preprocessor">#endif</span> +00656 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>; +00657 <span class="preprocessor">#if DEBUG_FIFO</span> +00658 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p set the rewinder"</span>, <span class="keyword">this</span>); +00659 <span class="preprocessor">#endif</span> +00660 <span class="preprocessor"></span> _Head = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00661 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00662 } +00663 <span class="keywordflow">else</span> +00664 { +00665 <span class="comment">// can't fit</span> +00666 <span class="preprocessor">#if DEBUG_FIFO</span> +00667 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p no room t<h"</span>, <span class="keyword">this</span>); +00668 <span class="preprocessor">#endif</span> +00669 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00670 } +00671 } +00672 <span class="keywordflow">else</span> <span class="comment">// the last case is : if (_Tail > _Head)</span> +00673 { +00674 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> >= (<a class="code" href="a04558.html#a10">sint32</a>) <a class="code" href="a04223.html#a626">s</a>) +00675 { +00676 <span class="preprocessor">#if DEBUG_FIFO</span> +00677 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p fit t>h"</span>, <span class="keyword">this</span>); +00678 <span class="preprocessor">#endif</span> +00679 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">true</span>; +00680 } +00681 <span class="keywordflow">else</span> +00682 { +00683 <span class="preprocessor">#if DEBUG_FIFO</span> +00684 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p no room t>h"</span>, <span class="keyword">this</span>); +00685 <span class="preprocessor">#endif</span> +00686 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00687 } +00688 } +00689 <a class="code" href="a04199.html#a12">nlstop</a>; +00690 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa1" doxytag="NLMISC::CBufFIFO::clear" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::clear </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Erase the FIFO. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00403">403</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, and <a class="el" href="a05509.html#l00130">_Tail</a>. +<p> +<div class="fragment"><pre>00404 { +00405 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00406 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> = NULL; +00407 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a> = <span class="keyword">true</span>; +00408 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa2" doxytag="NLMISC::CBufFIFO::display" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::display </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +display the FIFO to stdout (used to debug the FIFO) +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00540">540</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05621.html#l00092">NLMISC::DebugLog</a>, <a class="el" href="a05943.html#l00348">NLMISC::CLog::display()</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05586.html#l00161">NLMISC::smprintf()</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00354">front()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, <a class="el" href="a05508.html#l00068">push()</a>, and <a class="el" href="a05508.html#l00437">resize()</a>. +<p> +<div class="fragment"><pre>00541 { +00542 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a626">s</a> = 64; +00543 <span class="keywordtype">int</span> gran = <a class="code" href="a04223.html#a626">s</a>/30; +00544 +00545 <span class="keywordtype">char</span> str[1024]; +00546 +00547 <a class="code" href="a05378.html#a259">smprintf</a>(str, 1024, <span class="stringliteral">"%p %p (%5d %5d) %p %p %p "</span>, <span class="keyword">this</span>, _Buffer, _BufferSize, CBufFIFO::size(), _Rewinder, _Tail, _Head); +00548 +00549 <span class="keywordtype">int</span> i; +00550 <span class="keywordflow">for</span> (i = 0; i < (<a class="code" href="a04558.html#a10">sint32</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a>; i+= gran) +00551 { +00552 <a class="code" href="a04558.html#a7">uint8</a> *pos = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> + i; +00553 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> >= pos && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> < pos + gran) +00554 { +00555 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> >= pos && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> < pos + gran) +00556 { +00557 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> != NULL && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> >= pos && _Rewinder < pos + gran) +00558 { +00559 strncat (str, <span class="stringliteral">"*"</span>, 1024); +00560 } +00561 <span class="keywordflow">else</span> +00562 { +00563 strncat (str, <span class="stringliteral">"</span><span class="stringliteral">@", 1024); + } + } + else + { + strncat (str, "</span>T", 1024); +00564 } +00565 } +00566 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> >= pos && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> < pos + gran) +00567 { +00568 strncat (str, <span class="stringliteral">"H"</span>, 1024); +00569 } +00570 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> != NULL && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> >= pos && _Rewinder < pos + gran) +00571 { +00572 strncat (str, <span class="stringliteral">"R"</span>, 1024); +00573 } +00574 <span class="keywordflow">else</span> +00575 { +00576 <span class="keywordflow">if</span> (strlen(str) < 1023) +00577 { +00578 <a class="code" href="a04558.html#a11">uint32</a> p = strlen(str); +00579 <span class="keywordflow">if</span> (isprint(*pos)) +00580 str[p] = *pos; +00581 <span class="keywordflow">else</span> +00582 str[p] = <span class="charliteral">'$'</span>; +00583 +00584 str[p+1] = <span class="charliteral">'\0'</span>; +00585 } +00586 } +00587 } +00588 +00589 <span class="keywordflow">for</span> (; i < <a class="code" href="a04223.html#a626">s</a>; i+= gran) +00590 { +00591 strncat (str, <span class="stringliteral">" "</span>, 1024); +00592 } +00593 <span class="preprocessor">#ifdef NL_DEBUG</span> +00594 <span class="preprocessor"></span> strncat (str, <span class="stringliteral">"\n"</span>, 1024); +00595 <span class="preprocessor">#else</span> +00596 <span class="preprocessor"></span> strncat (str, <span class="stringliteral">"\r"</span>, 1024); +00597 <span class="preprocessor">#endif</span> +00598 <span class="preprocessor"></span> <a class="code" href="a05378.html#a13">DebugLog</a>->display (str); +00599 } +00600 </pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa3" doxytag="NLMISC::CBufFIFO::displayStats" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::displayStats </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02813.html">CLog</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>log</em> = <a class="el" href="a05378.html#a12">InfoLog</a> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +display the FIFO statistics (speed, nbcall, etc...) to stdout +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00528">528</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00140">_BiggestBlock</a>, <a class="el" href="a05509.html#l00142">_BiggestBuffer</a>, <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00145">_Fronted</a>, <a class="el" href="a05509.html#l00148">_FrontedTime</a>, <a class="el" href="a05509.html#l00144">_Pushed</a>, <a class="el" href="a05509.html#l00147">_PushedTime</a>, <a class="el" href="a05509.html#l00146">_Resized</a>, <a class="el" href="a05509.html#l00149">_ResizedTime</a>, <a class="el" href="a05509.html#l00141">_SmallestBlock</a>, <a class="el" href="a05509.html#l00143">_SmallestBuffer</a>, <a class="el" href="a05943.html#l00323">NLMISC::CLog::displayNL()</a>, <a class="el" href="a05981.html#l00107">NL_I64</a>, <a class="el" href="a05981.html#l00101">sint64</a>, and <a class="el" href="a05508.html#l00410">size()</a>. +<p> +Referenced by <a class="el" href="a05512.html#l00713">NLNET::CBufServer::displaySendQueueStat()</a>, and <a class="el" href="a05507.html#l00137">NLNET::CBufClient::displaySendQueueStat()</a>. +<p> +<div class="fragment"><pre>00529 { +00530 log->displayNL (<span class="stringliteral">"%p CurrentQueueSize: %d, TotalQueueSize: %d"</span>, <span class="keyword">this</span>, <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa15">size</a>(), _BufferSize); +00531 log->displayNL (<span class="stringliteral">"%p InQueue: %d"</span>, <span class="keyword">this</span>, _Pushed - _Fronted); +00532 +00533 log->displayNL (<span class="stringliteral">"%p BiggestBlock: %d, SmallestBlock: %d"</span>, <span class="keyword">this</span>, _BiggestBlock, _SmallestBlock); +00534 log->displayNL (<span class="stringliteral">"%p BiggestBuffer: %d, SmallestBuffer: %d"</span>, <span class="keyword">this</span>, _BiggestBuffer, _SmallestBuffer); +00535 log->displayNL (<span class="stringliteral">"%p Pushed: %d, PushedTime: total %"</span>NL_I64<span class="stringliteral">"d ticks, mean %f ticks"</span>, <span class="keyword">this</span>, _Pushed, _PushedTime, (_Pushed>0?(<span class="keywordtype">double</span>)(<a class="code" href="a04558.html#a12">sint64</a>)_PushedTime / (<span class="keywordtype">double</span>)_Pushed:0.0)); +00536 log->displayNL (<span class="stringliteral">"%p Fronted: %d, FrontedTime: total %"</span>NL_I64<span class="stringliteral">"d ticks, mean %f ticks"</span>, <span class="keyword">this</span>, _Fronted, _FrontedTime, (_Fronted>0?(<span class="keywordtype">double</span>)(sint64)_FrontedTime / (<span class="keywordtype">double</span>)_Fronted:0.0)); +00537 log->displayNL (<span class="stringliteral">"%p Resized: %d, ResizedTime: total %"</span>NL_I64<span class="stringliteral">"d ticks, mean %f ticks"</span>, <span class="keyword">this</span>, _Resized, _ResizedTime, (_Resized>0?(<span class="keywordtype">double</span>)(sint64)_ResizedTime / (<span class="keywordtype">double</span>)_Resized:0.0)); +00538 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa4" doxytag="NLMISC::CBufFIFO::empty" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBufFIFO::empty </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return true if the FIFO is empty. +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00100">100</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05514.html#l00137">NLNET::CBufSock::flush()</a>, <a class="el" href="a05508.html#l00354">front()</a>, <a class="el" href="a05508.html#l00207">frontLast()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, <a class="el" href="a05508.html#l00437">resize()</a>, and <a class="el" href="a05508.html#l00410">size()</a>. +<p> +<div class="fragment"><pre>00100 { <span class="keywordflow">return</span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a>; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa5" doxytag="NLMISC::CBufFIFO::front" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::front </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a7">uint8</a> *& </td> + <td class="mdname" nowrap> <em>buffer</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>size</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00354">354</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00145">_Fronted</a>, <a class="el" href="a05509.html#l00148">_FrontedTime</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05509.html#l00117">TFifoSize</a>, <a class="el" href="a06553.html#l00048">NLMISC::TTicks</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00355 { +00356 <span class="preprocessor">#if STAT_FIFO</span> +00357 <span class="preprocessor"></span> <a class="code" href="a05378.html#a243">TTicks</a> before = CTime::getPerformanceTime (); +00358 <span class="preprocessor">#endif</span> +00359 <span class="preprocessor"></span> +00360 <a class="code" href="a04558.html#a7">uint8</a> *tail = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>; +00361 +00362 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a> ()) +00363 { +00364 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"BF: Try to get the front of an empty fifo!"</span>); +00365 <span class="keywordflow">return</span>; +00366 } +00367 +00368 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr5">_Fronted</a>++; +00369 +00370 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> != NULL && tail == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a>) +00371 { +00372 <span class="preprocessor">#if DEBUG_FIFO</span> +00373 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p front rewind!"</span>, <span class="keyword">this</span>); +00374 <span class="preprocessor">#endif</span> +00375 <span class="preprocessor"></span> +00376 <span class="comment">// need to rewind</span> +00377 tail = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00378 } +00379 +00380 <a class="code" href="a04223.html#a626">s</a> = *(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> *)tail; +00381 +00382 <span class="preprocessor">#if DEBUG_FIFO</span> +00383 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p front(%d)"</span>, <span class="keyword">this</span>, s); +00384 <span class="preprocessor">#endif</span> +00385 <span class="preprocessor"></span> +00386 tail += <span class="keyword">sizeof</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a>); +00387 +00388 <span class="preprocessor">#if STAT_FIFO</span> +00389 <span class="preprocessor"></span> <span class="comment">// stat code</span> +00390 <a class="code" href="a05378.html#a243">TTicks</a> after = CTime::getPerformanceTime (); +00391 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr6">_FrontedTime</a> += after - before; +00392 <span class="preprocessor">#endif</span> +00393 <span class="preprocessor"></span> +00394 <span class="preprocessor">#if DEBUG_FIFO</span> +00395 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> (); +00396 <span class="preprocessor">#endif</span> +00397 <span class="preprocessor"></span> +00398 <a class="code" href="a04223.html#a589">buffer</a> = tail; +00399 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa6" doxytag="NLMISC::CBufFIFO::front" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::front </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02271.html">NLMISC::CMemStream</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>buffer</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00296">296</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05508.html#l00237">front()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00297 { +00298 <a class="code" href="a04558.html#a7">uint8</a> *tmpbuffer; +00299 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a626">s</a>; +00300 +00301 <a class="code" href="a04223.html#a589">buffer</a>.clear (); +00302 +00303 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa7">front</a> (tmpbuffer, s); +00304 +00305 <a class="code" href="a04223.html#a589">buffer</a>.fill (tmpbuffer, s); +00306 +00307 <span class="comment">/*</span> +00308 <span class="comment"> TTicks before = CTime::getPerformanceTime ();</span> +00309 <span class="comment"></span> +00310 <span class="comment"> uint8 *tail = _Tail;</span> +00311 <span class="comment"> </span> +00312 <span class="comment"> buffer.clear ();</span> +00313 <span class="comment"></span> +00314 <span class="comment"> if (empty ())</span> +00315 <span class="comment"> {</span> +00316 <span class="comment"> nlwarning("Try to get the front of an empty fifo!");</span> +00317 <span class="comment"> return;</span> +00318 <span class="comment"> }</span> +00319 <span class="comment"></span> +00320 <span class="comment"> _Fronted++;</span> +00321 <span class="comment"> </span> +00322 <span class="comment"> if (_Rewinder != NULL && tail == _Rewinder)</span> +00323 <span class="comment"> {</span> +00324 <span class="comment">#if DEBUG_FIFO</span> +00325 <span class="comment"> nldebug("%p front rewind!", this);</span> +00326 <span class="comment">#endif</span> +00327 <span class="comment"></span> +00328 <span class="comment"> // need to rewind</span> +00329 <span class="comment"> tail = _Buffer;</span> +00330 <span class="comment"> }</span> +00331 <span class="comment"></span> +00332 <span class="comment"> TFifoSize size = *(TFifoSize *)tail;</span> +00333 <span class="comment"></span> +00334 <span class="comment">#if DEBUG_FIFO</span> +00335 <span class="comment"> nldebug("%p front(%d)", this, size);</span> +00336 <span class="comment">#endif</span> +00337 <span class="comment"></span> +00338 <span class="comment"> tail += sizeof (TFifoSize);</span> +00339 <span class="comment"></span> +00340 <span class="comment"> //buffer.resize (size);</span> +00341 <span class="comment"> //CFastMem::memcpy (&(buffer[0]), tail, size);</span> +00342 <span class="comment"></span> +00343 <span class="comment"> buffer.fill (tail, size);</span> +00344 <span class="comment"></span> +00345 <span class="comment"> // stat code</span> +00346 <span class="comment"> TTicks after = CTime::getPerformanceTime ();</span> +00347 <span class="comment"> _FrontedTime += after - before;</span> +00348 <span class="comment"></span> +00349 <span class="comment">#if DEBUG_FIFO</span> +00350 <span class="comment"> display ();</span> +00351 <span class="comment">#endif*/</span> +00352 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa7" doxytag="NLMISC::CBufFIFO::front" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::front </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a04558.html#a7">uint8</a> > & </td> + <td class="mdname1" valign="top" nowrap> <em>buffer</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Get the buffer in the tail of the FIFO and put it in 'buffer'. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00237">237</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05514.html#l00137">NLNET::CBufSock::flush()</a>, and <a class="el" href="a05508.html#l00296">front()</a>. +<p> +<div class="fragment"><pre>00238 { +00239 <a class="code" href="a04558.html#a7">uint8</a> *tmpbuffer; +00240 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a626">s</a>; +00241 +00242 <a class="code" href="a04223.html#a589">buffer</a>.clear (); +00243 +00244 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa7">front</a> (tmpbuffer, s); +00245 +00246 <a class="code" href="a04223.html#a589">buffer</a>.resize (s); +00247 +00248 CFastMem::memcpy (&(buffer[0]), tmpbuffer, s); +00249 +00250 <span class="comment">/* TTicks before = CTime::getPerformanceTime ();</span> +00251 <span class="comment"></span> +00252 <span class="comment"> uint8 *tail = _Tail;</span> +00253 <span class="comment"> </span> +00254 <span class="comment"> buffer.clear ();</span> +00255 <span class="comment"></span> +00256 <span class="comment"> if (empty ())</span> +00257 <span class="comment"> {</span> +00258 <span class="comment"> nlwarning("Try to get the front of an empty fifo!");</span> +00259 <span class="comment"> return;</span> +00260 <span class="comment"> }</span> +00261 <span class="comment"></span> +00262 <span class="comment"> _Fronted++;</span> +00263 <span class="comment"> </span> +00264 <span class="comment"> if (_Rewinder != NULL && tail == _Rewinder)</span> +00265 <span class="comment"> {</span> +00266 <span class="comment">#if DEBUG_FIFO</span> +00267 <span class="comment"> nldebug("%p front rewind!", this);</span> +00268 <span class="comment">#endif</span> +00269 <span class="comment"></span> +00270 <span class="comment"> // need to rewind</span> +00271 <span class="comment"> tail = _Buffer;</span> +00272 <span class="comment"> }</span> +00273 <span class="comment"></span> +00274 <span class="comment"> TFifoSize size = *(TFifoSize *)tail;</span> +00275 <span class="comment"></span> +00276 <span class="comment">#if DEBUG_FIFO</span> +00277 <span class="comment"> nldebug("%p front(%d)", this, size);</span> +00278 <span class="comment">#endif</span> +00279 <span class="comment"></span> +00280 <span class="comment"> tail += sizeof (TFifoSize);</span> +00281 <span class="comment"></span> +00282 <span class="comment"> buffer.resize (size);</span> +00283 <span class="comment"></span> +00284 <span class="comment"> CFastMem::memcpy (&(buffer[0]), tail, size);</span> +00285 <span class="comment"></span> +00286 <span class="comment"> // stat code</span> +00287 <span class="comment"> TTicks after = CTime::getPerformanceTime ();</span> +00288 <span class="comment"> _FrontedTime += after - before;</span> +00289 <span class="comment"></span> +00290 <span class="comment">#if DEBUG_FIFO</span> +00291 <span class="comment"> display ();</span> +00292 <span class="comment">#endif</span> +00293 <span class="comment">*/</span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa8" doxytag="NLMISC::CBufFIFO::frontLast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> NLMISC::CBufFIFO::frontLast </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +This function returns the last byte of the front message It is used by the network to know a value quickly without doing <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOa7">front()</a> +<p> +Definition at line <a class="el" href="a05508.html#l00207">207</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05509.html#l00117">TFifoSize</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00208 { +00209 <a class="code" href="a04558.html#a7">uint8</a> *tail = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>; +00210 +00211 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a> ()) +00212 { +00213 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"BF: Try to get the front of an empty fifo!"</span>); +00214 <span class="keywordflow">return</span> 0; +00215 } +00216 +00217 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> != NULL && tail == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a>) +00218 { +00219 <span class="preprocessor">#if DEBUG_FIFO</span> +00220 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p front rewind!"</span>, <span class="keyword">this</span>); +00221 <span class="preprocessor">#endif</span> +00222 <span class="preprocessor"></span> +00223 <span class="comment">// need to rewind</span> +00224 tail = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00225 } +00226 +00227 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> <a class="code" href="a04223.html#a626">s</a> = *(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> *)tail; +00228 +00229 <span class="preprocessor">#if DEBUG_FIFO</span> +00230 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p frontLast() returns %d "</span>, <span class="keyword">this</span>, s, *(tail+<span class="keyword">sizeof</span>(TFifoSize)+<a class="code" href="a04223.html#a587">size</a>-1)); +00231 <span class="preprocessor">#endif</span> +00232 <span class="preprocessor"></span> +00233 <span class="keywordflow">return</span> *(tail+<span class="keyword">sizeof</span>(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a>)+<a class="code" href="a04223.html#a626">s</a>-1); +00234 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa9" doxytag="NLMISC::CBufFIFO::pop" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::pop </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Pop the buffer in the tail of the FIFO. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00168">168</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05646.html#l00977">s</a>, and <a class="el" href="a05509.html#l00117">TFifoSize</a>. +<p> +Referenced by <a class="el" href="a05514.html#l00137">NLNET::CBufSock::flush()</a>. +<p> +<div class="fragment"><pre>00169 { +00170 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a> ()) +00171 { +00172 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"BF: Try to pop an empty fifo!"</span>); +00173 <span class="keywordflow">return</span>; +00174 } +00175 +00176 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> != NULL && <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a>) +00177 { +00178 <span class="preprocessor">#if DEBUG_FIFO</span> +00179 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p pop rewind!"</span>, <span class="keyword">this</span>); +00180 <span class="preprocessor">#endif</span> +00181 <span class="preprocessor"></span> +00182 <span class="comment">// need to rewind</span> +00183 _Tail = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00184 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> = NULL; +00185 } +00186 +00187 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> <a class="code" href="a04223.html#a626">s</a> = *(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> *)_Tail; +00188 +00189 <span class="preprocessor">#if DEBUG_FIFO</span> +00190 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p pop(%d)"</span>, <span class="keyword">this</span>, s); +00191 <span class="preprocessor">#endif</span> +00192 <span class="preprocessor"></span> +00193 <span class="preprocessor">#ifdef NL_DEBUG</span> +00194 <span class="preprocessor"></span> <span class="comment">// clear the message to be sure user doesn't use it anymore</span> +00195 memset (_Tail, <span class="charliteral">'-'</span>, s + <span class="keyword">sizeof</span> (TFifoSize)); +00196 <span class="preprocessor">#endif</span> +00197 <span class="preprocessor"></span> +00198 _Tail += <a class="code" href="a04223.html#a626">s</a> + <span class="keyword">sizeof</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a>); +00199 +00200 <span class="keywordflow">if</span> (_Tail == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a> = <span class="keyword">true</span>; +00201 +00202 <span class="preprocessor">#if DEBUG_FIFO</span> +00203 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> (); +00204 <span class="preprocessor">#endif</span> +00205 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa10" doxytag="NLMISC::CBufFIFO::push" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::push </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > & </td> + <td class="mdname" nowrap> <em>buffer1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > & </td> + <td class="mdname" nowrap> <em>buffer2</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Concate and push 'buffer1' and buffer2 in the head of the FIFO. The goal is to avoid a copy. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00113">113</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00140">_BiggestBlock</a>, <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00144">_Pushed</a>, <a class="el" href="a05509.html#l00147">_PushedTime</a>, <a class="el" href="a05509.html#l00141">_SmallestBlock</a>, <a class="el" href="a05508.html#l00606">canFit()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05508.html#l00437">resize()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05508.html#l00410">size()</a>, <a class="el" href="a05509.html#l00117">TFifoSize</a>, and <a class="el" href="a06553.html#l00048">NLMISC::TTicks</a>. +<p> +<div class="fragment"><pre>00114 { +00115 <span class="preprocessor">#if STAT_FIFO</span> +00116 <span class="preprocessor"></span> <a class="code" href="a05378.html#a243">TTicks</a> before = CTime::getPerformanceTime(); +00117 <span class="preprocessor">#endif</span> +00118 <span class="preprocessor"></span> +00119 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> <a class="code" href="a04223.html#a626">s</a> = buffer1.size() + buffer2.size(); +00120 +00121 <span class="preprocessor">#if DEBUG_FIFO</span> +00122 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p push2(%d)"</span>, <span class="keyword">this</span>, s); +00123 <span class="preprocessor">#endif</span> +00124 <span class="preprocessor"></span> +00125 <a class="code" href="a04199.html#a6">nlassert</a>((buffer1.size() + buffer2.size ()) > 0 && (buffer1.size() + buffer2.size ()) < pow(2, <span class="keyword">sizeof</span>(TFifoSize)*8)); +00126 +00127 <span class="comment">// avoid too big fifo</span> +00128 <span class="keywordflow">if</span> (this-><a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa15">size</a>() > 10000000) +00129 { +00130 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">Exception</a> (<span class="stringliteral">"CBufFIFO::push(): stack full (more than 10mb)"</span>); +00131 } +00132 +00133 +00134 <span class="comment">// stat code</span> +00135 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> > <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a> = <a class="code" href="a04223.html#a626">s</a>; +00136 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a> = <a class="code" href="a04223.html#a626">s</a>; +00137 +00138 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr8">_Pushed</a>++; +00139 +00140 <span class="comment">// resize while the buffer is enough big to accept the block</span> +00141 <span class="keywordflow">while</span> (!<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOd0">canFit</a> (s + <span class="keyword">sizeof</span> (TFifoSize))) +00142 { +00143 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa14">resize</a>(_BufferSize * 2); +00144 } +00145 +00146 <span class="comment">// store the size of the block</span> +00147 *(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> *)<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> = <a class="code" href="a04223.html#a626">s</a>; +00148 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> += <span class="keyword">sizeof</span>(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a>); +00149 +00150 <span class="comment">// store the block itself</span> +00151 CFastMem::memcpy(_Head, &(buffer1[0]), buffer1.size()); +00152 CFastMem::memcpy(_Head + buffer1.size(), &(buffer2[0]), buffer2.size()); +00153 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> += <a class="code" href="a04223.html#a626">s</a>; +00154 +00155 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a> = <span class="keyword">false</span>; +00156 +00157 <span class="preprocessor">#if STAT_FIFO</span> +00158 <span class="preprocessor"></span> <span class="comment">// stat code</span> +00159 <a class="code" href="a05378.html#a243">TTicks</a> after = CTime::getPerformanceTime(); +00160 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr9">_PushedTime</a> += after - before; +00161 <span class="preprocessor">#endif</span> +00162 <span class="preprocessor"></span> +00163 <span class="preprocessor">#if DEBUG_FIFO</span> +00164 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> (); +00165 <span class="preprocessor">#endif</span> +00166 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa11" doxytag="NLMISC::CBufFIFO::push" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::push </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a04558.html#a7">uint8</a> * </td> + <td class="mdname" nowrap> <em>buffer</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>size</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00068">68</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00140">_BiggestBlock</a>, <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00144">_Pushed</a>, <a class="el" href="a05509.html#l00147">_PushedTime</a>, <a class="el" href="a05509.html#l00141">_SmallestBlock</a>, <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05508.html#l00606">canFit()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05508.html#l00437">resize()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05509.html#l00117">TFifoSize</a>, <a class="el" href="a06553.html#l00048">NLMISC::TTicks</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00069 { +00070 <span class="comment">// if the buffer is more than 1 meg, there s surely a problem, no?</span> +00071 <span class="comment">// nlassert( buffer.size() < 1000000 ); // size check in debug mode</span> +00072 +00073 <span class="preprocessor">#if STAT_FIFO</span> +00074 <span class="preprocessor"></span> <a class="code" href="a05378.html#a243">TTicks</a> before = CTime::getPerformanceTime(); +00075 <span class="preprocessor">#endif</span> +00076 <span class="preprocessor"></span> +00077 <span class="preprocessor">#if DEBUG_FIFO</span> +00078 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p push(%d)"</span>, <span class="keyword">this</span>, s); +00079 <span class="preprocessor">#endif</span> +00080 <span class="preprocessor"></span> +00081 <a class="code" href="a04199.html#a6">nlassert</a>(s > 0 && s < pow(2, <span class="keyword">sizeof</span>(TFifoSize)*8)); +00082 +00083 <span class="comment">// stat code</span> +00084 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> > <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr0">_BiggestBlock</a> = <a class="code" href="a04223.html#a626">s</a>; +00085 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr13">_SmallestBlock</a> = <a class="code" href="a04223.html#a626">s</a>; +00086 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr8">_Pushed</a>++; +00087 +00088 <span class="keywordflow">while</span> (!<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOd0">canFit</a> (s + <span class="keyword">sizeof</span> (TFifoSize))) +00089 { +00090 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa14">resize</a>(_BufferSize * 2); +00091 } +00092 +00093 *(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a> *)<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> = <a class="code" href="a04223.html#a626">s</a>; +00094 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> += <span class="keyword">sizeof</span>(<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOy0">TFifoSize</a>); +00095 +00096 CFastMem::memcpy(_Head, buffer, s); +00097 +00098 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> += <a class="code" href="a04223.html#a626">s</a>; +00099 +00100 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr4">_Empty</a> = <span class="keyword">false</span>; +00101 +00102 <span class="preprocessor">#if STAT_FIFO</span> +00103 <span class="preprocessor"></span> <span class="comment">// stat code</span> +00104 <a class="code" href="a05378.html#a243">TTicks</a> after = CTime::getPerformanceTime(); +00105 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr9">_PushedTime</a> += after - before; +00106 <span class="preprocessor">#endif</span> +00107 <span class="preprocessor"></span> +00108 <span class="preprocessor">#if DEBUG_FIFO</span> +00109 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> (); +00110 <span class="preprocessor">#endif</span> +00111 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa12" doxytag="NLMISC::CBufFIFO::push" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::push </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02271.html">NLMISC::CMemStream</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>buffer</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00074">74</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, and <a class="el" href="a05509.html#l00072">push()</a>. +<p> +<div class="fragment"><pre>00074 { <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa13">push</a> (<a class="code" href="a04223.html#a589">buffer</a>.buffer(), <a class="code" href="a04223.html#a589">buffer</a>.length()); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa13" doxytag="NLMISC::CBufFIFO::push" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::push </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::vector< <a class="el" href="a04558.html#a7">uint8</a> > & </td> + <td class="mdname1" valign="top" nowrap> <em>buffer</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Push 'buffer' in the head of the FIFO. +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00072">72</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>. +<p> +Referenced by <a class="el" href="a05509.html#l00074">push()</a>, and <a class="el" href="a05515.html#l00178">NLNET::CBufSock::pushBuffer()</a>. +<p> +<div class="fragment"><pre>00072 { <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa13">push</a> (&buffer[0], <a class="code" href="a04223.html#a589">buffer</a>.size()); } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa14" doxytag="NLMISC::CBufFIFO::resize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBufFIFO::resize </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>size</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Set the size of the FIFO buffer in byte. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00437">437</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00142">_BiggestBuffer</a>, <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00146">_Resized</a>, <a class="el" href="a05509.html#l00149">_ResizedTime</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00143">_SmallestBuffer</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05538.html#l02935">size</a>, <a class="el" href="a06553.html#l00048">NLMISC::TTicks</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00068">push()</a>. +<p> +<div class="fragment"><pre>00438 { +00439 <span class="preprocessor">#if STAT_FIFO</span> +00440 <span class="preprocessor"></span> <a class="code" href="a05378.html#a243">TTicks</a> before = CTime::getPerformanceTime(); +00441 <span class="preprocessor">#endif</span> +00442 <span class="preprocessor"></span> +00443 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> == 0) <a class="code" href="a04223.html#a626">s</a> = 100; +00444 +00445 <span class="preprocessor">#if DEBUG_FIFO</span> +00446 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p resize(%d)"</span>, <span class="keyword">this</span>, s); +00447 <span class="preprocessor">#endif</span> +00448 <span class="preprocessor"></span> +00449 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> > <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr1">_BiggestBuffer</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr1">_BiggestBuffer</a> = <a class="code" href="a04223.html#a626">s</a>; +00450 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr14">_SmallestBuffer</a>) <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr14">_SmallestBuffer</a> = <a class="code" href="a04223.html#a626">s</a>; +00451 +00452 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr10">_Resized</a>++; +00453 +00454 <a class="code" href="a04558.html#a11">uint32</a> UsedSize = <a class="code" href="a04115.html#a94">CBufFIFO::size</a>(); +00455 +00456 <span class="comment">// creer un nouveau tableau et copie l ancien dans le nouveau.</span> +00457 <span class="keywordflow">if</span> (s < _BufferSize && UsedSize > <a class="code" href="a04223.html#a626">s</a>) +00458 { +00459 <span class="comment">// probleme, on a pas assez de place pour caser les datas => on fait pas</span> +00460 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"BF: Can't resize the FIFO because there's not enough room in the new wanted buffer (%d bytes needed at least)"</span>, UsedSize); +00461 <span class="keywordflow">return</span>; +00462 } +00463 +00464 <a class="code" href="a04558.html#a7">uint8</a> *NewBuffer = <span class="keyword">new</span> <a class="code" href="a04558.html#a7">uint8</a>[<a class="code" href="a04223.html#a626">s</a>]; +00465 <span class="keywordflow">if</span> (NewBuffer == NULL) +00466 { +00467 <a class="code" href="a04199.html#a3">nlerror</a>(<span class="stringliteral">"Not enough memory to resize the FIFO to %u bytes"</span>, s); +00468 } +00469 <span class="preprocessor">#ifdef NL_DEBUG</span> +00470 <span class="preprocessor"></span> <span class="comment">// clear the message to be sure user doesn't use it anymore</span> +00471 memset (NewBuffer, <span class="charliteral">'-'</span>, s); +00472 <span class="preprocessor">#endif</span> +00473 <span class="preprocessor"></span> +00474 <span class="preprocessor">#if DEBUG_FIFO</span> +00475 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"%p new %d bytes"</span>, <span class="keyword">this</span>, s); +00476 <span class="preprocessor">#endif</span> +00477 <span class="preprocessor"></span> +00478 <span class="comment">// copy the old buffer to the new one</span> +00479 <span class="comment">// if _Tail == _Head => empty fifo, don't copy anything</span> +00480 <span class="keywordflow">if</span> (!<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a>()) +00481 { +00482 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>) +00483 { +00484 CFastMem::memcpy (NewBuffer, _Tail, UsedSize); +00485 } +00486 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> >= <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a>) +00487 { +00488 <a class="code" href="a04199.html#a6">nlassert</a> (_Rewinder != NULL); +00489 +00490 <a class="code" href="a04558.html#a15">uint</a> size1 = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>; +00491 CFastMem::memcpy (NewBuffer, _Tail, size1); +00492 <a class="code" href="a04558.html#a15">uint</a> size2 = <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00493 CFastMem::memcpy (NewBuffer + size1, _Buffer, size2); +00494 +00495 <a class="code" href="a04199.html#a6">nlassert</a> (size1+size2==UsedSize); +00496 } +00497 } +00498 +00499 <span class="comment">// resync the circular pointer</span> +00500 <span class="comment">// Warning: don't invert these 2 lines position or it ll not work</span> +00501 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a> = NewBuffer; +00502 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> = NewBuffer + UsedSize; +00503 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> = NULL; +00504 +00505 <span class="comment">// delete old buffer if needed</span> +00506 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> != NULL) +00507 { +00508 <span class="keyword">delete</span> []<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00509 <span class="preprocessor">#if DEBUG_FIFO</span> +00510 <span class="preprocessor"></span> <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"delete"</span>, <span class="keyword">this</span>); +00511 <span class="preprocessor">#endif</span> +00512 <span class="preprocessor"></span> } +00513 +00514 <span class="comment">// affect new buffer</span> +00515 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a> = NewBuffer; +00516 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a> = <a class="code" href="a04223.html#a626">s</a>; +00517 +00518 <span class="preprocessor">#if STAT_FIFO</span> +00519 <span class="preprocessor"></span> <a class="code" href="a05378.html#a243">TTicks</a> after = CTime::getPerformanceTime(); +00520 <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr11">_ResizedTime</a> += after - before; +00521 <span class="preprocessor">#endif</span> +00522 <span class="preprocessor"></span> +00523 <span class="preprocessor">#if DEBUG_FIFO</span> +00524 <span class="preprocessor"></span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa2">display</a> (); +00525 <span class="preprocessor">#endif</span> +00526 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOa15" doxytag="NLMISC::CBufFIFO::size" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CBufFIFO::size </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the size of the FIFO. +<p> + +<p> +Definition at line <a class="el" href="a05508.html#l00410">410</a> of file <a class="el" href="a05508.html">buf_fifo.cpp</a>. +<p> +References <a class="el" href="a05509.html#l00122">_BufferSize</a>, <a class="el" href="a05509.html#l00128">_Head</a>, <a class="el" href="a05509.html#l00132">_Rewinder</a>, <a class="el" href="a05509.html#l00130">_Tail</a>, <a class="el" href="a05509.html#l00100">empty()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00416">nlstop</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00528">displayStats()</a>, <a class="el" href="a05512.html#l00660">NLNET::CBufServer::getSendQueueSize()</a>, <a class="el" href="a05507.html#l00135">NLNET::CBufClient::getSendQueueSize()</a>, <a class="el" href="a05508.html#l00113">push()</a>, and <a class="el" href="a05514.html#l00247">NLNET::CBufSock::update()</a>. +<p> +<div class="fragment"><pre>00411 { +00412 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOa4">empty</a> ()) +00413 { +00414 <span class="keywordflow">return</span> 0; +00415 } +00416 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> == <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>) +00417 { +00418 <span class="comment">// buffer is full</span> +00419 <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> == NULL) +00420 <span class="keywordflow">return</span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr3">_BufferSize</a>; +00421 <span class="keywordflow">else</span> +00422 <span class="keywordflow">return</span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>; +00423 } +00424 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> > <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>) +00425 { +00426 <span class="keywordflow">return</span> <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>; +00427 } +00428 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> < <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>) +00429 { +00430 <a class="code" href="a04199.html#a6">nlassert</a> (_Rewinder != NULL); +00431 <span class="keywordflow">return</span> (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr12">_Rewinder</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr15">_Tail</a>) + (<a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr7">_Head</a> - <a class="code" href="a02301.html#NLMISC_1_1CBufFIFOr2">_Buffer</a>); +00432 } +00433 <a class="code" href="a04199.html#a12">nlstop</a>; +00434 <span class="keywordflow">return</span> 0; +00435 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBufFIFOr0" doxytag="NLMISC::CBufFIFO::_BiggestBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr0">NLMISC::CBufFIFO::_BiggestBlock</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00140">140</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00068">push()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr1" doxytag="NLMISC::CBufFIFO::_BiggestBuffer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr1">NLMISC::CBufFIFO::_BiggestBuffer</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00142">142</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00437">resize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr2" doxytag="NLMISC::CBufFIFO::_Buffer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a>* <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr2">NLMISC::CBufFIFO::_Buffer</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00120">120</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr3" doxytag="NLMISC::CBufFIFO::_BufferSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr3">NLMISC::CBufFIFO::_BufferSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00122">122</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00606">canFit()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, <a class="el" href="a05508.html#l00068">push()</a>, <a class="el" href="a05508.html#l00437">resize()</a>, and <a class="el" href="a05508.html#l00410">size()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr4" doxytag="NLMISC::CBufFIFO::_Empty" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr4">NLMISC::CBufFIFO::_Empty</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00125">125</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr5" doxytag="NLMISC::CBufFIFO::_Fronted" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr5">NLMISC::CBufFIFO::_Fronted</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00145">145</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00354">front()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr6" doxytag="NLMISC::CBufFIFO::_FrontedTime" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a243">TTicks</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr6">NLMISC::CBufFIFO::_FrontedTime</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00148">148</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00354">front()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr7" doxytag="NLMISC::CBufFIFO::_Head" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a>* <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr7">NLMISC::CBufFIFO::_Head</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00128">128</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00606">canFit()</a>, <a class="el" href="a05508.html#l00403">clear()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, <a class="el" href="a05508.html#l00068">push()</a>, <a class="el" href="a05508.html#l00437">resize()</a>, and <a class="el" href="a05508.html#l00410">size()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr8" doxytag="NLMISC::CBufFIFO::_Pushed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr8">NLMISC::CBufFIFO::_Pushed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00144">144</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00068">push()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr9" doxytag="NLMISC::CBufFIFO::_PushedTime" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a243">TTicks</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr9">NLMISC::CBufFIFO::_PushedTime</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00147">147</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00068">push()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr10" doxytag="NLMISC::CBufFIFO::_Resized" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr10">NLMISC::CBufFIFO::_Resized</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00146">146</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00437">resize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr11" doxytag="NLMISC::CBufFIFO::_ResizedTime" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a243">TTicks</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr11">NLMISC::CBufFIFO::_ResizedTime</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00149">149</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00437">resize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr12" doxytag="NLMISC::CBufFIFO::_Rewinder" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a>* <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr12">NLMISC::CBufFIFO::_Rewinder</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00132">132</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00403">clear()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05508.html#l00354">front()</a>, <a class="el" href="a05508.html#l00207">frontLast()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, <a class="el" href="a05508.html#l00437">resize()</a>, and <a class="el" href="a05508.html#l00410">size()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr13" doxytag="NLMISC::CBufFIFO::_SmallestBlock" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr13">NLMISC::CBufFIFO::_SmallestBlock</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00141">141</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00068">push()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr14" doxytag="NLMISC::CBufFIFO::_SmallestBuffer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr14">NLMISC::CBufFIFO::_SmallestBuffer</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00143">143</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00042">CBufFIFO()</a>, <a class="el" href="a05508.html#l00528">displayStats()</a>, and <a class="el" href="a05508.html#l00437">resize()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBufFIFOr15" doxytag="NLMISC::CBufFIFO::_Tail" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a>* <a class="el" href="a02301.html#NLMISC_1_1CBufFIFOr15">NLMISC::CBufFIFO::_Tail</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05509.html#l00130">130</a> of file <a class="el" href="a05509.html">buf_fifo.h</a>. +<p> +Referenced by <a class="el" href="a05508.html#l00606">canFit()</a>, <a class="el" href="a05508.html#l00403">clear()</a>, <a class="el" href="a05508.html#l00540">display()</a>, <a class="el" href="a05508.html#l00354">front()</a>, <a class="el" href="a05508.html#l00207">frontLast()</a>, <a class="el" href="a05508.html#l00168">pop()</a>, <a class="el" href="a05508.html#l00437">resize()</a>, and <a class="el" href="a05508.html#l00410">size()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05509.html">buf_fifo.h</a><li><a class="el" href="a05508.html">buf_fifo.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:06:00 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |