[353] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
| 3 | <title>mixpp: error_counters.h Source File</title> |
---|
| 4 | <link href="tabs.css" rel="stylesheet" type="text/css"> |
---|
| 5 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
| 6 | </head><body> |
---|
| 7 | <!-- Generated by Doxygen 1.5.8 --> |
---|
| 8 | <script type="text/javascript"> |
---|
| 9 | <!-- |
---|
| 10 | function changeDisplayState (e){ |
---|
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
---|
| 12 | var button=this.firstChild; |
---|
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
---|
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
---|
| 15 | sectionDiv.style.display='block'; |
---|
| 16 | button.src='open.gif'; |
---|
| 17 | }else{ |
---|
| 18 | sectionDiv.style.display='none'; |
---|
| 19 | button.src='closed.gif'; |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | function initDynSections(){ |
---|
| 23 | var divs=document.getElementsByTagName('div'); |
---|
| 24 | var sectionCounter=1; |
---|
| 25 | for(var i=0;i<divs.length-1;i++){ |
---|
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
---|
| 27 | var header=divs[i]; |
---|
| 28 | var section=divs[i+1]; |
---|
| 29 | var button=header.firstChild; |
---|
| 30 | if (button!='IMG'){ |
---|
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
---|
| 32 | button=document.createElement('img'); |
---|
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
---|
| 34 | } |
---|
| 35 | header.style.cursor='pointer'; |
---|
| 36 | header.onclick=changeDisplayState; |
---|
| 37 | header.id='dynheader'+sectionCounter; |
---|
| 38 | button.src='closed.gif'; |
---|
| 39 | section.id='dynsection'+sectionCounter; |
---|
| 40 | section.style.display='none'; |
---|
| 41 | section.style.marginLeft='14px'; |
---|
| 42 | sectionCounter++; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | window.onload = initDynSections; |
---|
| 47 | --> |
---|
| 48 | </script> |
---|
| 49 | <div class="navigation" id="top"> |
---|
| 50 | <div class="tabs"> |
---|
| 51 | <ul> |
---|
| 52 | <li><a href="main.html"><span>Main Page</span></a></li> |
---|
| 53 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
| 54 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
| 55 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
| 56 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
| 57 | </ul> |
---|
| 58 | </div> |
---|
| 59 | <div class="tabs"> |
---|
| 60 | <ul> |
---|
| 61 | <li><a href="files.html"><span>File List</span></a></li> |
---|
| 62 | <li><a href="globals.html"><span>File Members</span></a></li> |
---|
| 63 | </ul> |
---|
| 64 | </div> |
---|
| 65 | <h1>error_counters.h</h1><a href="error__counters_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
| 66 | <a name="l00030"></a>00030 <span class="preprocessor">#ifndef ERROR_COUNTERS_H</span> |
---|
| 67 | <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define ERROR_COUNTERS_H</span> |
---|
| 68 | <a name="l00032"></a>00032 <span class="preprocessor"></span> |
---|
| 69 | <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="vec_8h.html" title="Templated Vector Class Definitions.">itpp/base/vec.h</a>></span> |
---|
| 70 | <a name="l00034"></a>00034 |
---|
| 71 | <a name="l00035"></a>00035 |
---|
| 72 | <a name="l00036"></a>00036 <span class="keyword">namespace </span>itpp |
---|
| 73 | <a name="l00037"></a>00037 { |
---|
| 74 | <a name="l00038"></a>00038 |
---|
| 75 | <a name="l00066"></a><a class="code" href="classitpp_1_1BERC.html">00066</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1BERC.html" title="Bit Error Rate Counter (BERC) Class.">BERC</a> |
---|
| 76 | <a name="l00067"></a>00067 { |
---|
| 77 | <a name="l00068"></a>00068 <span class="keyword">public</span>: |
---|
| 78 | <a name="l00079"></a>00079 <a class="code" href="classitpp_1_1BERC.html#8e5d3f3d0041687d419c4a30af086e0d" title="Constructor for the berc class.">BERC</a>(<span class="keywordtype">int</span> indelay = 0, <span class="keywordtype">int</span> inignorefirst = 0, <span class="keywordtype">int</span> inignorelast = 0); |
---|
| 79 | <a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BERC.html#539b0c989badff3027d97e4693fc9cd7" title="Cumulative error counter.">count</a>(<span class="keyword">const</span> bvec &in1, <span class="keyword">const</span> bvec &in2); |
---|
| 80 | <a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BERC.html#7ccf4100e2b7b26ed8fac21fcf4aa8d6">estimate_delay</a>(<span class="keyword">const</span> bvec &in1, <span class="keyword">const</span> bvec &in2, <span class="keywordtype">int</span> mindelay = -100, |
---|
| 81 | <a name="l00085"></a>00085 <span class="keywordtype">int</span> maxdelay = 100); |
---|
| 82 | <a name="l00087"></a><a class="code" href="classitpp_1_1BERC.html#3b575cfbe8dd194c2cd51a6aa52651e5">00087</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BERC.html#3b575cfbe8dd194c2cd51a6aa52651e5" title="Clears the bit error counter.">clear</a>() { errors = 0; corrects = 0; } |
---|
| 83 | <a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BERC.html#e997bb87b1ee5eaf3eb892e7ee416a08" title="Writes an error report.">report</a>() <span class="keyword">const</span>; |
---|
| 84 | <a name="l00091"></a><a class="code" href="classitpp_1_1BERC.html#4d8d81ba3fd9ebdbd4f85ed29ab4079f">00091</a> <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1BERC.html#4d8d81ba3fd9ebdbd4f85ed29ab4079f" title="Return the delay, assumed or estimated, between in1 and in2.">get_delay</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay; } |
---|
| 85 | <a name="l00093"></a><a class="code" href="classitpp_1_1BERC.html#02e757f28e87003404ad0d4aec1e44a6">00093</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BERC.html#02e757f28e87003404ad0d4aec1e44a6" title="Returns the counted number of bit errors.">get_errors</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> errors; } |
---|
| 86 | <a name="l00095"></a><a class="code" href="classitpp_1_1BERC.html#0d1b89503b1c260b37171a07ae77c7f4">00095</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BERC.html#0d1b89503b1c260b37171a07ae77c7f4" title="Returns the counted number of corectly received bits.">get_corrects</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> corrects; } |
---|
| 87 | <a name="l00097"></a><a class="code" href="classitpp_1_1BERC.html#d1c36b23b03c2659179255f5c565a5d0">00097</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BERC.html#d1c36b23b03c2659179255f5c565a5d0" title="Returns the total number of bits processed.">get_total_bits</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (errors + corrects); } |
---|
| 88 | <a name="l00099"></a><a class="code" href="classitpp_1_1BERC.html#f17d5f534ba34558d3632a98f29f0519">00099</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BERC.html#f17d5f534ba34558d3632a98f29f0519" title="Returns the estimated bit error rate.">get_errorrate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (errors / (corrects + errors)); } |
---|
| 89 | <a name="l00110"></a>00110 <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BERC.html#8a1a20c186d02af63a30b41660fe480e" title="static function to allow simple and fast count of bit-errors">count_errors</a>(<span class="keyword">const</span> bvec &in1, <span class="keyword">const</span> bvec &in2, |
---|
| 90 | <a name="l00111"></a>00111 <span class="keywordtype">int</span> indelay = 0, <span class="keywordtype">int</span> inignorefirst = 0, |
---|
| 91 | <a name="l00112"></a>00112 <span class="keywordtype">int</span> inignorelast = 0); |
---|
| 92 | <a name="l00113"></a>00113 |
---|
| 93 | <a name="l00114"></a>00114 <span class="keyword">private</span>: |
---|
| 94 | <a name="l00115"></a>00115 <span class="keywordtype">int</span> delay; |
---|
| 95 | <a name="l00116"></a>00116 <span class="keywordtype">int</span> ignorefirst; |
---|
| 96 | <a name="l00117"></a>00117 <span class="keywordtype">int</span> ignorelast; |
---|
| 97 | <a name="l00118"></a>00118 <span class="keywordtype">double</span> errors; |
---|
| 98 | <a name="l00119"></a>00119 <span class="keywordtype">double</span> corrects; |
---|
| 99 | <a name="l00120"></a>00120 }; |
---|
| 100 | <a name="l00121"></a>00121 |
---|
| 101 | <a name="l00127"></a><a class="code" href="classitpp_1_1BLERC.html">00127</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1BLERC.html" title="Class for counting block error rates.">BLERC</a> |
---|
| 102 | <a name="l00128"></a>00128 { |
---|
| 103 | <a name="l00129"></a>00129 <span class="keyword">public</span>: |
---|
| 104 | <a name="l00131"></a>00131 <a class="code" href="classitpp_1_1BLERC.html#ae8e8046a54bf84744752d4ca323fa39" title="Class constructor.">BLERC</a>(<span class="keywordtype">void</span>); |
---|
| 105 | <a name="l00133"></a>00133 <a class="code" href="classitpp_1_1BLERC.html#ae8e8046a54bf84744752d4ca323fa39" title="Class constructor.">BLERC</a>(<span class="keywordtype">int</span> blocksize); |
---|
| 106 | <a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BLERC.html#43db2b81f9aada3bb4b0d644fa188f5e" title="Set the block size.">set_blocksize</a>(<span class="keywordtype">int</span> inblocksize, <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1BLERC.html#764cc0d98a05349b8d2451be40fa3656" title="Clear the block error counter.">clear</a> = <span class="keyword">true</span>); |
---|
| 107 | <a name="l00137"></a>00137 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BLERC.html#be58d4abce92b4b53ad614a28aac20e7" title="Calculate the number of block errors between in1 and in2.">count</a>(<span class="keyword">const</span> bvec &in1, <span class="keyword">const</span> bvec &in2); |
---|
| 108 | <a name="l00139"></a><a class="code" href="classitpp_1_1BLERC.html#764cc0d98a05349b8d2451be40fa3656">00139</a> <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1BLERC.html#764cc0d98a05349b8d2451be40fa3656" title="Clear the block error counter.">clear</a>() { errors = 0; corrects = 0; } |
---|
| 109 | <a name="l00141"></a><a class="code" href="classitpp_1_1BLERC.html#be4f66d6b704069019220229a04cf776">00141</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BLERC.html#be4f66d6b704069019220229a04cf776" title="Returns the number of block errors.">get_errors</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> errors; } |
---|
| 110 | <a name="l00143"></a><a class="code" href="classitpp_1_1BLERC.html#43c524f8ba837346f91e1903be5bf5a8">00143</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BLERC.html#43c524f8ba837346f91e1903be5bf5a8" title="Returns the number of correct blocks.">get_corrects</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> corrects; } |
---|
| 111 | <a name="l00145"></a><a class="code" href="classitpp_1_1BLERC.html#425cf6d769cec33cd27c9bc135888585">00145</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BLERC.html#425cf6d769cec33cd27c9bc135888585" title="Returns the total number of block processed.">get_total_blocks</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (errors + corrects); } |
---|
| 112 | <a name="l00147"></a><a class="code" href="classitpp_1_1BLERC.html#724ae26011a5389735bf7974775ff3ad">00147</a> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1BLERC.html#724ae26011a5389735bf7974775ff3ad" title="Returns the block error rate.">get_errorrate</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (errors / (corrects + errors)); } |
---|
| 113 | <a name="l00148"></a>00148 |
---|
| 114 | <a name="l00149"></a>00149 <span class="comment">//protected:</span> |
---|
| 115 | <a name="l00150"></a>00150 <span class="keyword">private</span>: |
---|
| 116 | <a name="l00151"></a>00151 <span class="keywordtype">bool</span> setup_done; |
---|
| 117 | <a name="l00152"></a>00152 <span class="keywordtype">int</span> blocksize; |
---|
| 118 | <a name="l00153"></a>00153 <span class="keywordtype">double</span> errors; |
---|
| 119 | <a name="l00154"></a>00154 <span class="keywordtype">double</span> corrects; |
---|
| 120 | <a name="l00155"></a>00155 <span class="keywordtype">bool</span> CORR; |
---|
| 121 | <a name="l00156"></a>00156 }; |
---|
| 122 | <a name="l00157"></a>00157 |
---|
| 123 | <a name="l00158"></a>00158 } <span class="comment">// namespace itpp</span> |
---|
| 124 | <a name="l00159"></a>00159 |
---|
| 125 | <a name="l00160"></a>00160 <span class="preprocessor">#endif // #ifndef ERROR_COUNTERS_H</span> |
---|
| 126 | </pre></div></div> |
---|
| 127 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by |
---|
| 128 | <a href="http://www.doxygen.org/index.html"> |
---|
| 129 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 130 | </body> |
---|
| 131 | </html> |
---|