| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
| <title>oscl_uuid.h Source File</title> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"> |
| </head><body> |
| <!-- Generated by Doxygen 1.2.18 --> |
| <center> |
| <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> |
| <hr><h1>oscl_uuid.h</h1><a href="oscl__uuid_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 |
| 00007 <span class="preprocessor">#ifndef OSCL_UUID_H_INCLUDED</span> |
| 00008 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_UUID_H_INCLUDED</span> |
| 00009 <span class="preprocessor"></span> |
| 00010 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> |
| 00011 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> |
| 00012 <span class="preprocessor">#endif</span> |
| 00013 <span class="preprocessor"></span> |
| 00014 <span class="preprocessor">#ifndef OSCL_MEM_BASIC_FUNCTIONS_H</span> |
| 00015 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__mem__basic__functions_8h.html">oscl_mem_basic_functions.h</a>"</span> |
| 00016 <span class="preprocessor">#endif</span> |
| 00017 <span class="preprocessor"></span> |
| 00018 <span class="preprocessor">#ifndef OSCL_STRING_UTILS_H</span> |
| 00019 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__string__utils_8h.html">oscl_string_utils.h</a>"</span> |
| 00020 <span class="preprocessor">#endif</span> |
| 00021 <span class="preprocessor"></span> |
| 00022 <span class="preprocessor">#ifndef OSCL_STDSTRING_H_INCLUDED</span> |
| 00023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__stdstring_8h.html">oscl_stdstring.h</a>"</span> |
| 00024 <span class="preprocessor">#endif</span> |
| 00025 <span class="preprocessor"></span><span class="comment">// __cplusplus</span> |
| 00026 |
| <a name="l00027"></a><a class="code" href="oscl__uuid_8h.html#a1">00027</a> <span class="keyword">typedef</span> uint32 <a class="code" href="oscl__uuid_8h.html#a1">OsclUid32</a>; |
| <a name="l00028"></a><a class="code" href="oscl__uuid_8h.html#a2">00028</a> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="oscl__uuid_8h.html#a2">PV_CHAR_CLOSE_BRACKET</a> = <span class="charliteral">')'</span>; |
| <a name="l00029"></a><a class="code" href="oscl__uuid_8h.html#a3">00029</a> <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="oscl__uuid_8h.html#a3">PV_CHAR_COMMA</a> = <span class="charliteral">','</span>; |
| <a name="l00033"></a><a class="code" href="structOsclUuid.html">00033</a> <span class="keyword">struct </span><a class="code" href="structOsclUuid.html">OsclUuid</a> |
| 00034 { |
| <a name="l00035"></a><a class="code" href="oscl__uuid_8h.html#a0">00035</a> <span class="preprocessor">#define BYTES_IN_UUID_ARRAY 8</span> |
| 00036 <span class="preprocessor"></span> |
| <a name="l00037"></a><a class="code" href="structOsclUuid.html#a0">00037</a> <a class="code" href="structOsclUuid.html#a0">OsclUuid</a>() |
| 00038 { |
| 00039 <a class="code" href="group__osclmemory.html#a14">oscl_memset</a>(<span class="keyword">this</span>, 0, <span class="keyword">sizeof</span>(<a class="code" href="structOsclUuid.html">OsclUuid</a>)); |
| 00040 } |
| 00041 |
| <a name="l00042"></a><a class="code" href="structOsclUuid.html#a1">00042</a> <a class="code" href="structOsclUuid.html#a0">OsclUuid</a>(uint32 l, uint16 w1, uint16 w2, uint8 b1, uint8 b2, uint8 b3, |
| 00043 uint8 b4, uint8 b5, uint8 b6, uint8 b7, uint8 b8) |
| 00044 { |
| 00045 <a class="code" href="structOsclUuid.html#m0">data1</a> = l; |
| 00046 <a class="code" href="structOsclUuid.html#m1">data2</a> = w1; |
| 00047 <a class="code" href="structOsclUuid.html#m2">data3</a> = w2; |
| 00048 <a class="code" href="structOsclUuid.html#m3">data4</a>[0] = b1; |
| 00049 <a class="code" href="structOsclUuid.html#m3">data4</a>[1] = b2; |
| 00050 <a class="code" href="structOsclUuid.html#m3">data4</a>[2] = b3; |
| 00051 <a class="code" href="structOsclUuid.html#m3">data4</a>[3] = b4; |
| 00052 <a class="code" href="structOsclUuid.html#m3">data4</a>[4] = b5; |
| 00053 <a class="code" href="structOsclUuid.html#m3">data4</a>[5] = b6; |
| 00054 <a class="code" href="structOsclUuid.html#m3">data4</a>[6] = b7; |
| 00055 <a class="code" href="structOsclUuid.html#m3">data4</a>[7] = b8; |
| 00056 } |
| 00057 |
| 00058 <span class="comment">//The OSCL UUID structure takes in a string parameter</span> |
| 00059 <span class="comment">//Expected string input for the OsclString should be like:</span> |
| 00060 <span class="comment">//(0xa054569c,0x24c5,0x452e,0x99,0x77,0x87,0x4b,0xca,0x79,0xd3,0xaf)</span> |
| 00061 |
| <a name="l00062"></a><a class="code" href="structOsclUuid.html#a2">00062</a> <a class="code" href="structOsclUuid.html#a0">OsclUuid</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* aUuidString) |
| 00063 { |
| 00064 <span class="comment">//Initialize all data members to 0 to begin with</span> |
| 00065 <a class="code" href="structOsclUuid.html#m0">data1</a> = <a class="code" href="structOsclUuid.html#m1">data2</a> = <a class="code" href="structOsclUuid.html#m2">data3</a> = 0; |
| 00066 |
| 00067 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ii = 0; ii < 8; ++ii) |
| 00068 { |
| 00069 <a class="code" href="structOsclUuid.html#m3">data4</a>[ii] = 0; |
| 00070 } |
| 00071 |
| 00072 <span class="keywordtype">int</span> uuidStrLen = <a class="code" href="group__osclbase.html#a43">oscl_strlen</a>(aUuidString); |
| 00073 |
| 00074 <span class="keywordflow">if</span> (uuidStrLen != 0) |
| 00075 { |
| 00076 <span class="keyword">const</span> <span class="keywordtype">char</span>* sptr = <a class="code" href="group__osclbase.html#a81">NULL</a>, *eptr = <a class="code" href="group__osclbase.html#a81">NULL</a>; |
| 00077 <span class="keywordtype">int</span> commaval = 0; |
| 00078 sptr = aUuidString; |
| 00079 ++sptr; <span class="comment">//Increment over the starting parantheses '('</span> |
| 00080 eptr = sptr; |
| 00081 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i < uuidStrLen - 1 ; ++i) |
| 00082 { |
| 00083 <span class="keywordflow">if</span> ((*eptr != <a class="code" href="oscl__uuid_8h.html#a3">PV_CHAR_COMMA</a>) && (*eptr != <a class="code" href="oscl__uuid_8h.html#a2">PV_CHAR_CLOSE_BRACKET</a>)) <span class="comment">//Increment the pointer unless you get to the ","</span> |
| 00084 { <span class="comment">//The comma signifies the beginning of the new OsclUuid parameter</span> |
| 00085 ++eptr; |
| 00086 } |
| 00087 <span class="keywordflow">else</span> |
| 00088 { |
| 00089 sptr = sptr + 2;<span class="comment">//Move over the 0x characters in the beginning of the hex value;</span> |
| 00090 ++commaval; |
| 00091 <span class="keywordflow">switch</span> (commaval) |
| 00092 { |
| 00093 <span class="keywordflow">case</span> 1: |
| 00094 { |
| 00095 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, eptr - sptr, <a class="code" href="structOsclUuid.html#m0">data1</a>); |
| 00096 <span class="keywordflow">break</span>; |
| 00097 } |
| 00098 <span class="keywordflow">case</span> 2: |
| 00099 { |
| 00100 uint32 tempdata2 = 0; |
| 00101 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata2); |
| 00102 <a class="code" href="structOsclUuid.html#m1">data2</a> = (uint16)tempdata2; |
| 00103 <span class="keywordflow">break</span>; |
| 00104 } |
| 00105 <span class="keywordflow">case</span> 3: |
| 00106 { |
| 00107 uint32 tempdata3 = 0; |
| 00108 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata3); |
| 00109 <a class="code" href="structOsclUuid.html#m2">data3</a> = (uint16)tempdata3; |
| 00110 <span class="keywordflow">break</span>; |
| 00111 } |
| 00112 <span class="keywordflow">case</span> 4: |
| 00113 { |
| 00114 uint32 tempdata4_0 = 0; |
| 00115 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_0); |
| 00116 <a class="code" href="structOsclUuid.html#m3">data4</a>[0] = (uint8)tempdata4_0; |
| 00117 <span class="keywordflow">break</span>; |
| 00118 } |
| 00119 <span class="keywordflow">case</span> 5: |
| 00120 { |
| 00121 uint32 tempdata4_1 = 0; |
| 00122 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_1); |
| 00123 <a class="code" href="structOsclUuid.html#m3">data4</a>[1] = (uint8)tempdata4_1; |
| 00124 <span class="keywordflow">break</span>; |
| 00125 } |
| 00126 <span class="keywordflow">case</span> 6: |
| 00127 { |
| 00128 uint32 tempdata4_2 = 0; |
| 00129 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_2); |
| 00130 <a class="code" href="structOsclUuid.html#m3">data4</a>[2] = (uint8)tempdata4_2; |
| 00131 <span class="keywordflow">break</span>; |
| 00132 } |
| 00133 <span class="keywordflow">case</span> 7: |
| 00134 { |
| 00135 uint32 tempdata4_3 = 0; |
| 00136 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_3); |
| 00137 <a class="code" href="structOsclUuid.html#m3">data4</a>[3] = (uint8)tempdata4_3; |
| 00138 <span class="keywordflow">break</span>; |
| 00139 } |
| 00140 <span class="keywordflow">case</span> 8: |
| 00141 { |
| 00142 uint32 tempdata4_4 = 0; |
| 00143 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_4); |
| 00144 <a class="code" href="structOsclUuid.html#m3">data4</a>[4] = (uint8)tempdata4_4; |
| 00145 <span class="keywordflow">break</span>; |
| 00146 } |
| 00147 <span class="keywordflow">case</span> 9: |
| 00148 { |
| 00149 uint32 tempdata4_5 = 0; |
| 00150 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_5); |
| 00151 <a class="code" href="structOsclUuid.html#m3">data4</a>[5] = (uint8)tempdata4_5; |
| 00152 <span class="keywordflow">break</span>; |
| 00153 } |
| 00154 <span class="keywordflow">case</span> 10: |
| 00155 { |
| 00156 uint32 tempdata4_6 = 0; |
| 00157 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_6); |
| 00158 <a class="code" href="structOsclUuid.html#m3">data4</a>[6] = (uint8)tempdata4_6; |
| 00159 <span class="keywordflow">break</span>; |
| 00160 } |
| 00161 <span class="keywordflow">case</span> 11: |
| 00162 { |
| 00163 uint32 tempdata4_7 = 0; |
| 00164 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr, <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_7); |
| 00165 <a class="code" href="structOsclUuid.html#m3">data4</a>[7] = (uint8)tempdata4_7; |
| 00166 <span class="keywordflow">break</span>; |
| 00167 } |
| 00168 } |
| 00169 <span class="keywordflow">if</span> (*eptr == <a class="code" href="oscl__uuid_8h.html#a2">PV_CHAR_CLOSE_BRACKET</a>) <span class="comment">//Break from the loop on finding</span> |
| 00170 { |
| 00171 <span class="keywordflow">break</span>; |
| 00172 } |
| 00173 ++eptr; |
| 00174 sptr = eptr; |
| 00175 } |
| 00176 } |
| 00177 } |
| 00178 } |
| 00179 |
| <a name="l00180"></a><a class="code" href="structOsclUuid.html#a3">00180</a> <a class="code" href="structOsclUuid.html#a0">OsclUuid</a>(<span class="keyword">const</span> <a class="code" href="structOsclUuid.html">OsclUuid</a> &uuid) |
| 00181 { |
| 00182 <a class="code" href="group__osclmemory.html#a11">oscl_memcpy</a>(<span class="keyword">this</span>, &uuid, <span class="keyword">sizeof</span>(<a class="code" href="structOsclUuid.html">OsclUuid</a>)); |
| 00183 } |
| 00184 |
| <a name="l00185"></a><a class="code" href="structOsclUuid.html#a4">00185</a> <a class="code" href="structOsclUuid.html">OsclUuid</a> &<a class="code" href="structOsclUuid.html#a4">operator=</a>(<span class="keyword">const</span> <a class="code" href="structOsclUuid.html">OsclUuid</a>& src) |
| 00186 { |
| 00187 <a class="code" href="group__osclmemory.html#a11">oscl_memcpy</a>(<span class="keyword">this</span>, &src, <span class="keyword">sizeof</span>(<a class="code" href="structOsclUuid.html">OsclUuid</a>)); |
| 00188 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
| 00189 } |
| 00190 |
| <a name="l00191"></a><a class="code" href="structOsclUuid.html#a5">00191</a> <span class="keywordtype">bool</span> <a class="code" href="structOsclUuid.html#a5">operator==</a>(<span class="keyword">const</span> <a class="code" href="structOsclUuid.html">OsclUuid</a>& src)<span class="keyword"> const</span> |
| 00192 <span class="keyword"> </span>{ |
| 00193 <span class="keywordflow">if</span> (<a class="code" href="structOsclUuid.html#m0">data1</a> != src.<a class="code" href="structOsclUuid.html#m0">data1</a> || <a class="code" href="structOsclUuid.html#m1">data2</a> != src.<a class="code" href="structOsclUuid.html#m1">data2</a> || <a class="code" href="structOsclUuid.html#m2">data3</a> != src.<a class="code" href="structOsclUuid.html#m2">data3</a>) |
| 00194 { |
| 00195 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
| 00196 } |
| 00197 |
| 00198 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ii = 0; ii < 8; ++ii) |
| 00199 { |
| 00200 <span class="keywordflow">if</span> (<a class="code" href="structOsclUuid.html#m3">data4</a>[ii] != src.<a class="code" href="structOsclUuid.html#m3">data4</a>[ii]) |
| 00201 { |
| 00202 <span class="keywordflow">return</span> <span class="keyword">false</span>; |
| 00203 } |
| 00204 } |
| 00205 |
| 00206 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| 00207 } |
| 00208 |
| <a name="l00209"></a><a class="code" href="structOsclUuid.html#a6">00209</a> <span class="keywordtype">bool</span> <a class="code" href="structOsclUuid.html#a6">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structOsclUuid.html">OsclUuid</a> &src)<span class="keyword"> const</span> |
| 00210 <span class="keyword"> </span>{ |
| 00211 <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == src); |
| 00212 } |
| 00213 |
| <a name="l00214"></a><a class="code" href="structOsclUuid.html#m0">00214</a> uint32 <a class="code" href="structOsclUuid.html#m0">data1</a>; |
| <a name="l00215"></a><a class="code" href="structOsclUuid.html#m1">00215</a> uint16 <a class="code" href="structOsclUuid.html#m1">data2</a>; |
| <a name="l00216"></a><a class="code" href="structOsclUuid.html#m2">00216</a> uint16 <a class="code" href="structOsclUuid.html#m2">data3</a>; |
| <a name="l00217"></a><a class="code" href="structOsclUuid.html#m3">00217</a> uint8 <a class="code" href="structOsclUuid.html#m3">data4</a>[<a class="code" href="oscl__uuid_8h.html#a0">BYTES_IN_UUID_ARRAY</a>]; |
| 00218 }; |
| 00219 |
| 00220 <span class="preprocessor">#endif</span> |
| 00221 <span class="preprocessor"></span> |
| </pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> |
| <address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> |
| </small></address> |
| </body> |
| </html> |