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: crc.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>crc.h</h1><a href="crc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
66 | <a name="l00029"></a>00029 <span class="preprocessor">#ifndef CRC_H</span> |
---|
67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define CRC_H</span> |
---|
68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
69 | <a name="l00032"></a>00032 <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="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>></span> |
---|
71 | <a name="l00034"></a>00034 |
---|
72 | <a name="l00035"></a>00035 |
---|
73 | <a name="l00036"></a>00036 <span class="keyword">namespace </span>itpp |
---|
74 | <a name="l00037"></a>00037 { |
---|
75 | <a name="l00038"></a>00038 |
---|
76 | <a name="l00064"></a><a class="code" href="classitpp_1_1CRC__Code.html">00064</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1CRC__Code.html" title="Cyclic Redundancy Check Codes.">CRC_Code</a> |
---|
77 | <a name="l00065"></a>00065 { |
---|
78 | <a name="l00066"></a>00066 <span class="keyword">public</span>: |
---|
79 | <a name="l00067"></a>00067 |
---|
80 | <a name="l00069"></a><a class="code" href="classitpp_1_1CRC__Code.html#b8ab94a8924f51b811f91bf235094c11">00069</a> <a class="code" href="classitpp_1_1CRC__Code.html#b8ab94a8924f51b811f91bf235094c11" title="Default Constructor.">CRC_Code</a>() { reverse_parity = <span class="keyword">false</span>; } |
---|
81 | <a name="l00070"></a>00070 |
---|
82 | <a name="l00078"></a><a class="code" href="classitpp_1_1CRC__Code.html#a8b00d83cea7637cdb0bd6e6904c5f0b">00078</a> <a class="code" href="classitpp_1_1CRC__Code.html#a8b00d83cea7637cdb0bd6e6904c5f0b" title="Set CRC code to one of the standardpolynomials using the string value.">CRC_Code</a>(<span class="keyword">const</span> std::string &code) { reverse_parity = <span class="keyword">false</span>; <a class="code" href="classitpp_1_1CRC__Code.html#3d469cf8dd26a70285db2be529ce8ae5" title="Set CRC code to one of the standardpolynomials using the string value.">set_code</a>(code); } |
---|
83 | <a name="l00079"></a>00079 |
---|
84 | <a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1CRC__Code.html#2ca03831f0031033537e2f5d0e1b6f0f" title="Set an arbitary polynomial in bvec form. Start with highest order terms.">set_generator</a>(<span class="keyword">const</span> bvec &poly); |
---|
85 | <a name="l00082"></a>00082 |
---|
86 | <a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1CRC__Code.html#3d469cf8dd26a70285db2be529ce8ae5" title="Set CRC code to one of the standardpolynomials using the string value.">set_code</a>(<span class="keyword">const</span> std::string &code); |
---|
87 | <a name="l00085"></a>00085 |
---|
88 | <a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1CRC__Code.html#d0e25bfbdf25f1f488c294c819e561c1" title="Calulate the parity bits.">parity</a>(<span class="keyword">const</span> bvec &in_bits, bvec &out) <span class="keyword">const</span>; |
---|
89 | <a name="l00088"></a>00088 |
---|
90 | <a name="l00090"></a>00090 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1CRC__Code.html#1a3c0ca155dc8b9f18e4fe22f95b3264" title="Return true if parity checks OK otherwise flase.">check_parity</a>(<span class="keyword">const</span> bvec &coded_bits) <span class="keyword">const</span>; |
---|
91 | <a name="l00091"></a>00091 |
---|
92 | <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1CRC__Code.html#e0724db13cfb7f8880299825fba59a25" title="Calculate and add parity to the in_bits.">encode</a>(<span class="keyword">const</span> bvec &in_bits, bvec &out) <span class="keyword">const</span>; |
---|
93 | <a name="l00094"></a>00094 |
---|
94 | <a name="l00096"></a>00096 bvec <a class="code" href="classitpp_1_1CRC__Code.html#e0724db13cfb7f8880299825fba59a25" title="Calculate and add parity to the in_bits.">encode</a>(<span class="keyword">const</span> bvec &in_bits) <span class="keyword">const</span>; |
---|
95 | <a name="l00097"></a>00097 |
---|
96 | <a name="l00099"></a>00099 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1CRC__Code.html#4d476aa00a59477941717ae4b37e4f84" title="Return true if parity checks OK otherwise flase. Also returns the message part in...">decode</a>(<span class="keyword">const</span> bvec &coded_bits, bvec &out) <span class="keyword">const</span>; |
---|
97 | <a name="l00100"></a>00100 |
---|
98 | <a name="l00102"></a>00102 <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1CRC__Code.html#4d476aa00a59477941717ae4b37e4f84" title="Return true if parity checks OK otherwise flase. Also returns the message part in...">decode</a>(bvec &bits) <span class="keyword">const</span>; |
---|
99 | <a name="l00103"></a>00103 |
---|
100 | <a name="l00104"></a>00104 <span class="keyword">private</span>: |
---|
101 | <a name="l00105"></a>00105 <span class="keywordtype">bool</span> reverse_parity; |
---|
102 | <a name="l00106"></a>00106 bvec polynomial; |
---|
103 | <a name="l00107"></a>00107 <span class="keywordtype">int</span> no_parity; |
---|
104 | <a name="l00108"></a>00108 }; |
---|
105 | <a name="l00109"></a>00109 |
---|
106 | <a name="l00110"></a>00110 } <span class="comment">// namespace itpp</span> |
---|
107 | <a name="l00111"></a>00111 |
---|
108 | <a name="l00112"></a>00112 <span class="preprocessor">#endif // #ifndef CRC_H</span> |
---|
109 | </pre></div></div> |
---|
110 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by |
---|
111 | <a href="http://www.doxygen.org/index.html"> |
---|
112 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
113 | </body> |
---|
114 | </html> |
---|