1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3 <title>oscl_uuid.h Source File</title> 4 <link href="doxygen.css" rel="stylesheet" type="text/css"> 5 </head><body> 6 <!-- Generated by Doxygen 1.2.18 --> 7 <center> 8 <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> 9 <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 10 00007 <span class="preprocessor">#ifndef OSCL_UUID_H_INCLUDED</span> 11 00008 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_UUID_H_INCLUDED</span> 12 00009 <span class="preprocessor"></span> 13 00010 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> 14 00011 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 15 00012 <span class="preprocessor">#endif</span> 16 00013 <span class="preprocessor"></span> 17 00014 <span class="preprocessor">#ifndef OSCL_MEM_BASIC_FUNCTIONS_H</span> 18 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> 19 00016 <span class="preprocessor">#endif</span> 20 00017 <span class="preprocessor"></span> 21 00018 <span class="preprocessor">#ifndef OSCL_STRING_UTILS_H</span> 22 00019 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__string__utils_8h.html">oscl_string_utils.h</a>"</span> 23 00020 <span class="preprocessor">#endif</span> 24 00021 <span class="preprocessor"></span> 25 00022 <span class="preprocessor">#ifndef OSCL_STDSTRING_H_INCLUDED</span> 26 00023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__stdstring_8h.html">oscl_stdstring.h</a>"</span> 27 00024 <span class="preprocessor">#endif</span> 28 00025 <span class="preprocessor"></span><span class="comment">// __cplusplus</span> 29 00026 30 <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>; 31 <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>; 32 <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>; 33 <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> 34 00034 { 35 <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> 36 00036 <span class="preprocessor"></span> 37 <a name="l00037"></a><a class="code" href="structOsclUuid.html#a0">00037</a> <a class="code" href="structOsclUuid.html#a0">OsclUuid</a>() 38 00038 { 39 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>)); 40 00040 } 41 00041 42 <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, 43 00043 uint8 b4, uint8 b5, uint8 b6, uint8 b7, uint8 b8) 44 00044 { 45 00045 <a class="code" href="structOsclUuid.html#m0">data1</a> = l; 46 00046 <a class="code" href="structOsclUuid.html#m1">data2</a> = w1; 47 00047 <a class="code" href="structOsclUuid.html#m2">data3</a> = w2; 48 00048 <a class="code" href="structOsclUuid.html#m3">data4</a>[0] = b1; 49 00049 <a class="code" href="structOsclUuid.html#m3">data4</a>[1] = b2; 50 00050 <a class="code" href="structOsclUuid.html#m3">data4</a>[2] = b3; 51 00051 <a class="code" href="structOsclUuid.html#m3">data4</a>[3] = b4; 52 00052 <a class="code" href="structOsclUuid.html#m3">data4</a>[4] = b5; 53 00053 <a class="code" href="structOsclUuid.html#m3">data4</a>[5] = b6; 54 00054 <a class="code" href="structOsclUuid.html#m3">data4</a>[6] = b7; 55 00055 <a class="code" href="structOsclUuid.html#m3">data4</a>[7] = b8; 56 00056 } 57 00057 58 00058 <span class="comment">//The OSCL UUID structure takes in a string parameter</span> 59 00059 <span class="comment">//Expected string input for the OsclString should be like:</span> 60 00060 <span class="comment">//(0xa054569c,0x24c5,0x452e,0x99,0x77,0x87,0x4b,0xca,0x79,0xd3,0xaf)</span> 61 00061 62 <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) 63 00063 { 64 00064 <span class="comment">//Initialize all data members to 0 to begin with</span> 65 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; 66 00066 67 00067 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ii = 0; ii < 8; ++ii) 68 00068 { 69 00069 <a class="code" href="structOsclUuid.html#m3">data4</a>[ii] = 0; 70 00070 } 71 00071 72 00072 <span class="keywordtype">int</span> uuidStrLen = <a class="code" href="group__osclbase.html#a43">oscl_strlen</a>(aUuidString); 73 00073 74 00074 <span class="keywordflow">if</span> (uuidStrLen != 0) 75 00075 { 76 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>; 77 00077 <span class="keywordtype">int</span> commaval = 0; 78 00078 sptr = aUuidString; 79 00079 ++sptr; <span class="comment">//Increment over the starting parantheses '('</span> 80 00080 eptr = sptr; 81 00081 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0;i < uuidStrLen - 1 ; ++i) 82 00082 { 83 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> 84 00084 { <span class="comment">//The comma signifies the beginning of the new OsclUuid parameter</span> 85 00085 ++eptr; 86 00086 } 87 00087 <span class="keywordflow">else</span> 88 00088 { 89 00089 sptr = sptr + 2;<span class="comment">//Move over the 0x characters in the beginning of the hex value;</span> 90 00090 ++commaval; 91 00091 <span class="keywordflow">switch</span> (commaval) 92 00092 { 93 00093 <span class="keywordflow">case</span> 1: 94 00094 { 95 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>); 96 00096 <span class="keywordflow">break</span>; 97 00097 } 98 00098 <span class="keywordflow">case</span> 2: 99 00099 { 100 00100 uint32 tempdata2 = 0; 101 00101 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata2); 102 00102 <a class="code" href="structOsclUuid.html#m1">data2</a> = (uint16)tempdata2; 103 00103 <span class="keywordflow">break</span>; 104 00104 } 105 00105 <span class="keywordflow">case</span> 3: 106 00106 { 107 00107 uint32 tempdata3 = 0; 108 00108 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata3); 109 00109 <a class="code" href="structOsclUuid.html#m2">data3</a> = (uint16)tempdata3; 110 00110 <span class="keywordflow">break</span>; 111 00111 } 112 00112 <span class="keywordflow">case</span> 4: 113 00113 { 114 00114 uint32 tempdata4_0 = 0; 115 00115 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_0); 116 00116 <a class="code" href="structOsclUuid.html#m3">data4</a>[0] = (uint8)tempdata4_0; 117 00117 <span class="keywordflow">break</span>; 118 00118 } 119 00119 <span class="keywordflow">case</span> 5: 120 00120 { 121 00121 uint32 tempdata4_1 = 0; 122 00122 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_1); 123 00123 <a class="code" href="structOsclUuid.html#m3">data4</a>[1] = (uint8)tempdata4_1; 124 00124 <span class="keywordflow">break</span>; 125 00125 } 126 00126 <span class="keywordflow">case</span> 6: 127 00127 { 128 00128 uint32 tempdata4_2 = 0; 129 00129 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_2); 130 00130 <a class="code" href="structOsclUuid.html#m3">data4</a>[2] = (uint8)tempdata4_2; 131 00131 <span class="keywordflow">break</span>; 132 00132 } 133 00133 <span class="keywordflow">case</span> 7: 134 00134 { 135 00135 uint32 tempdata4_3 = 0; 136 00136 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_3); 137 00137 <a class="code" href="structOsclUuid.html#m3">data4</a>[3] = (uint8)tempdata4_3; 138 00138 <span class="keywordflow">break</span>; 139 00139 } 140 00140 <span class="keywordflow">case</span> 8: 141 00141 { 142 00142 uint32 tempdata4_4 = 0; 143 00143 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_4); 144 00144 <a class="code" href="structOsclUuid.html#m3">data4</a>[4] = (uint8)tempdata4_4; 145 00145 <span class="keywordflow">break</span>; 146 00146 } 147 00147 <span class="keywordflow">case</span> 9: 148 00148 { 149 00149 uint32 tempdata4_5 = 0; 150 00150 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_5); 151 00151 <a class="code" href="structOsclUuid.html#m3">data4</a>[5] = (uint8)tempdata4_5; 152 00152 <span class="keywordflow">break</span>; 153 00153 } 154 00154 <span class="keywordflow">case</span> 10: 155 00155 { 156 00156 uint32 tempdata4_6 = 0; 157 00157 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr , <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_6); 158 00158 <a class="code" href="structOsclUuid.html#m3">data4</a>[6] = (uint8)tempdata4_6; 159 00159 <span class="keywordflow">break</span>; 160 00160 } 161 00161 <span class="keywordflow">case</span> 11: 162 00162 { 163 00163 uint32 tempdata4_7 = 0; 164 00164 <a class="code" href="group__osclutil.html#a19">PV_atoi</a>(sptr, <span class="charliteral">'x'</span>, (eptr - sptr), tempdata4_7); 165 00165 <a class="code" href="structOsclUuid.html#m3">data4</a>[7] = (uint8)tempdata4_7; 166 00166 <span class="keywordflow">break</span>; 167 00167 } 168 00168 } 169 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> 170 00170 { 171 00171 <span class="keywordflow">break</span>; 172 00172 } 173 00173 ++eptr; 174 00174 sptr = eptr; 175 00175 } 176 00176 } 177 00177 } 178 00178 } 179 00179 180 <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) 181 00181 { 182 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>)); 183 00183 } 184 00184 185 <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) 186 00186 { 187 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>)); 188 00188 <span class="keywordflow">return</span> *<span class="keyword">this</span>; 189 00189 } 190 00190 191 <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> 192 00192 <span class="keyword"> </span>{ 193 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>) 194 00194 { 195 00195 <span class="keywordflow">return</span> <span class="keyword">false</span>; 196 00196 } 197 00197 198 00198 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> ii = 0; ii < 8; ++ii) 199 00199 { 200 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]) 201 00201 { 202 00202 <span class="keywordflow">return</span> <span class="keyword">false</span>; 203 00203 } 204 00204 } 205 00205 206 00206 <span class="keywordflow">return</span> <span class="keyword">true</span>; 207 00207 } 208 00208 209 <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> 210 00210 <span class="keyword"> </span>{ 211 00211 <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == src); 212 00212 } 213 00213 214 <a name="l00214"></a><a class="code" href="structOsclUuid.html#m0">00214</a> uint32 <a class="code" href="structOsclUuid.html#m0">data1</a>; 215 <a name="l00215"></a><a class="code" href="structOsclUuid.html#m1">00215</a> uint16 <a class="code" href="structOsclUuid.html#m1">data2</a>; 216 <a name="l00216"></a><a class="code" href="structOsclUuid.html#m2">00216</a> uint16 <a class="code" href="structOsclUuid.html#m2">data3</a>; 217 <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>]; 218 00218 }; 219 00219 220 00220 <span class="preprocessor">#endif</span> 221 00221 <span class="preprocessor"></span> 222 </pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 223 <address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 224 </small></address> 225 </body> 226 </html> 227