root/doc/html/classitpp_1_1CRC__Code.html @ 354

Revision 353, 11.5 kB (checked in by smidl, 16 years ago)

doc

Line 
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: itpp::CRC_Code Class Reference</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<!--
10function 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}
22function 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}
46window.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&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
62      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
63      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
64      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
65    </ul>
66  </div>
67  <div class="navpath"><b>itpp</b>::<a class="el" href="classitpp_1_1CRC__Code.html">CRC_Code</a>
68  </div>
69</div>
70<div class="contents">
71<h1>itpp::CRC_Code Class Reference<br>
72<small>
73[<a class="el" href="group__fec.html">Forward Error Correcting Codes</a>]</small>
74</h1><!-- doxytag: class="itpp::CRC_Code" -->Cyclic Redundancy Check Codes. 
75<a href="#_details">More...</a>
76<p>
77<code>#include &lt;<a class="el" href="crc_8h-source.html">crc.h</a>&gt;</code>
78<p>
79
80<p>
81<a href="classitpp_1_1CRC__Code-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
82<tr><td></td></tr>
83<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
84<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b8ab94a8924f51b811f91bf235094c11"></a><!-- doxytag: member="itpp::CRC_Code::CRC_Code" ref="b8ab94a8924f51b811f91bf235094c11" args="()" -->
85&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#b8ab94a8924f51b811f91bf235094c11">CRC_Code</a> ()</td></tr>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default Constructor. <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#a8b00d83cea7637cdb0bd6e6904c5f0b">CRC_Code</a> (const std::string &amp;code)</td></tr>
89
90<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set CRC code to one of the standardpolynomials using the string value.  <a href="#a8b00d83cea7637cdb0bd6e6904c5f0b"></a><br></td></tr>
91<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2ca03831f0031033537e2f5d0e1b6f0f"></a><!-- doxytag: member="itpp::CRC_Code::set_generator" ref="2ca03831f0031033537e2f5d0e1b6f0f" args="(const bvec &amp;poly)" -->
92void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#2ca03831f0031033537e2f5d0e1b6f0f">set_generator</a> (const bvec &amp;poly)</td></tr>
93
94<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set an arbitary polynomial in bvec form. Start with highest order terms. <br></td></tr>
95<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3d469cf8dd26a70285db2be529ce8ae5"></a><!-- doxytag: member="itpp::CRC_Code::set_code" ref="3d469cf8dd26a70285db2be529ce8ae5" args="(const std::string &amp;code)" -->
96void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#3d469cf8dd26a70285db2be529ce8ae5">set_code</a> (const std::string &amp;code)</td></tr>
97
98<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set CRC code to one of the standardpolynomials using the string value. <br></td></tr>
99<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d0e25bfbdf25f1f488c294c819e561c1"></a><!-- doxytag: member="itpp::CRC_Code::parity" ref="d0e25bfbdf25f1f488c294c819e561c1" args="(const bvec &amp;in_bits, bvec &amp;out) const " -->
100void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#d0e25bfbdf25f1f488c294c819e561c1">parity</a> (const bvec &amp;in_bits, bvec &amp;out) const </td></tr>
101
102<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calulate the parity bits. <br></td></tr>
103<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1a3c0ca155dc8b9f18e4fe22f95b3264"></a><!-- doxytag: member="itpp::CRC_Code::check_parity" ref="1a3c0ca155dc8b9f18e4fe22f95b3264" args="(const bvec &amp;coded_bits) const " -->
104bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#1a3c0ca155dc8b9f18e4fe22f95b3264">check_parity</a> (const bvec &amp;coded_bits) const </td></tr>
105
106<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return true if parity checks OK otherwise flase. <br></td></tr>
107<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e0724db13cfb7f8880299825fba59a25"></a><!-- doxytag: member="itpp::CRC_Code::encode" ref="e0724db13cfb7f8880299825fba59a25" args="(const bvec &amp;in_bits, bvec &amp;out) const " -->
108void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#e0724db13cfb7f8880299825fba59a25">encode</a> (const bvec &amp;in_bits, bvec &amp;out) const </td></tr>
109
110<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calculate and add parity to the in_bits. <br></td></tr>
111<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b48e447cf80a8d8d264c13a35136ba15"></a><!-- doxytag: member="itpp::CRC_Code::encode" ref="b48e447cf80a8d8d264c13a35136ba15" args="(const bvec &amp;in_bits) const " -->
112bvec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#b48e447cf80a8d8d264c13a35136ba15">encode</a> (const bvec &amp;in_bits) const </td></tr>
113
114<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the in_bits vector with parity added. <br></td></tr>
115<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4d476aa00a59477941717ae4b37e4f84"></a><!-- doxytag: member="itpp::CRC_Code::decode" ref="4d476aa00a59477941717ae4b37e4f84" args="(const bvec &amp;coded_bits, bvec &amp;out) const " -->
116bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#4d476aa00a59477941717ae4b37e4f84">decode</a> (const bvec &amp;coded_bits, bvec &amp;out) const </td></tr>
117
118<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return true if parity checks OK otherwise flase. Also returns the message part in out. <br></td></tr>
119<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ace112867fadf03fcf072a7f8ae30010"></a><!-- doxytag: member="itpp::CRC_Code::decode" ref="ace112867fadf03fcf072a7f8ae30010" args="(bvec &amp;bits) const " -->
120bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1CRC__Code.html#ace112867fadf03fcf072a7f8ae30010">decode</a> (bvec &amp;bits) const </td></tr>
121
122<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return true if parity checks OK otherwise flase. Also returns the message part in bits. <br></td></tr>
123</table>
124<hr><a name="_details"></a><h2>Detailed Description</h2>
125Cyclic Redundancy Check Codes.
126<p>
127This class will add the CRC bits after each input word. With b(i) denoting the i-th input bit and p(i) the i-th parity check bit, the order of the outbut bits will be: <div class="fragment"><pre class="fragment"> [b(1), b(2), ..., b(k), p(1), p(2), ..., p(n-k)]
128</pre></div><p>
129When the WCDMA CRC polynomials are used, this class will reverse the order of the parity check bits in order to comply to the WCDMA standard. Thus for the polynomials WCDMA-8, WCDMA-12, WCDMA-16, and WCDMA-24 the output will be: <div class="fragment"><pre class="fragment"> [b(1), b(2), ..., b(k), p(n-k), ..., p(2), p(1)]
130</pre></div><p>
131Usage: <div class="fragment"><pre class="fragment">  <a class="code" href="classitpp_1_1CRC__Code.html#b8ab94a8924f51b811f91bf235094c11" title="Default Constructor.">CRC_Code</a> crc(<span class="keywordtype">string</span>(<span class="stringliteral">"CRC-4"</span>));
132  bvec bits = <a class="code" href="group__randgen.html#g5aa06887cf1fd3301b040987924068f0" title="Generates a random bit (equally likely 0s and 1s).">randb</a>(10), coded_bits, decoded_bits;
133  <span class="keywordtype">bool</span> error;
134
135  coded_bits = crc.encode(bits);
136  error = crc.decode(rec_bits, decoded_bits);
137</pre></div> <hr><h2>Constructor &amp; Destructor Documentation</h2>
138<a class="anchor" name="a8b00d83cea7637cdb0bd6e6904c5f0b"></a><!-- doxytag: member="itpp::CRC_Code::CRC_Code" ref="a8b00d83cea7637cdb0bd6e6904c5f0b" args="(const std::string &amp;code)" -->
139<div class="memitem">
140<div class="memproto">
141      <table class="memname">
142        <tr>
143          <td class="memname">itpp::CRC_Code::CRC_Code           </td>
144          <td>(</td>
145          <td class="paramtype">const std::string &amp;&nbsp;</td>
146          <td class="paramname"> <em>code</em>          </td>
147          <td>&nbsp;)&nbsp;</td>
148          <td><code> [inline]</code></td>
149        </tr>
150      </table>
151</div>
152<div class="memdoc">
153
154<p>
155Set CRC code to one of the standardpolynomials using the string value.
156<p>
157<dl compact><dt><b>Parameters:</b></dt><dd>
158  <table border="0" cellspacing="2" cellpadding="0">
159    <tr><td valign="top"></td><td valign="top"><em>code</em>&nbsp;</td><td>Possible values: CRC-4, CRC-7, CRC-8, CRC-12, CRC-24, CRC-32, CCITT-4, CCITT-5, CCITT-6, CCITT-16, CCITT-32, WCDMA-8, WCDMA-12, WCDMA-16, WCDMA-24, ATM-8, ANSI-16, SDLC-16 </td></tr>
160  </table>
161</dl>
162
163<p>References <a class="el" href="crc_8cpp-source.html#l00070">set_code()</a>.</p>
164
165</div>
166</div><p>
167<hr>The documentation for this class was generated from the following files:<ul>
168<li><a class="el" href="crc_8h-source.html">crc.h</a><li><a class="el" href="crc_8cpp.html">crc.cpp</a></ul>
169</div>
170<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:19 2009 for mixpp by&nbsp;
171<a href="http://www.doxygen.org/index.html">
172<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
173</body>
174</html>
Note: See TracBrowser for help on using the browser.