• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_file_async_read.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> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
9<hr><h1>oscl_file_async_read.h</h1><a href="oscl__file__async__read_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
1000002 <span class="comment">* ============================================================================</span>
1100003 <span class="comment">*  Name        : oscl_async_file.h</span>
1200004 <span class="comment">*  Part of     : osclio</span>
1300005 <span class="comment">*  Interface   :</span>
1400006 <span class="comment">*  Description :</span>
1500007 <span class="comment">*  Version     :</span>
1600008 <span class="comment">* ==============================================================================</span>
1700009 <span class="comment">*/</span>
1800010
1900011 <span class="preprocessor">#ifndef OSCL_FILE_ASYNC_READ_H_INCLUDED</span>
2000012 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_ASYNC_READ_H_INCLUDED</span>
2100013 <span class="preprocessor"></span>
2200014
2300015 <span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span>
2400016 <span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span>
2500017 <span class="preprocessor">#include "<a class="code" href="oscl__vector_8h.html">oscl_vector.h</a>"</span>
2600018 <span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span>
2700019 <span class="preprocessor">#include "<a class="code" href="oscl__scheduler__ao_8h.html">oscl_scheduler_ao.h</a>"</span>
2800020 <span class="preprocessor">#include "<a class="code" href="oscl__file__io_8h.html">oscl_file_io.h</a>"</span>
2900021
3000022 <span class="preprocessor">#ifndef OSCL_SEMAPHORE_H_INCLUDED</span>
3100023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__semaphore_8h.html">oscl_semaphore.h</a>"</span>
3200024 <span class="preprocessor">#endif</span>
3300025 <span class="preprocessor"></span>
3400026 <span class="keyword">class </span><a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>;
3500027
3600028 <span class="comment">//non-modifiable buffer pointer container</span>
37<a name="l00029"></a><a class="code" href="classOsclPtrC.html">00029</a> <span class="keyword">class </span><a class="code" href="classOsclPtrC.html">OsclPtrC</a>: <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a>
3800030 {
3900031     <span class="keyword">public</span>:
40<a name="l00032"></a><a class="code" href="classOsclPtrC.html#a0">00032</a>         <a class="code" href="classOsclPtrC.html#a0">OsclPtrC</a>(<span class="keyword">const</span> uint8* ptr, int32 len, int32 max): iPtr(ptr), iMaxLength(max), iLength(len)
4100033         {}
42<a name="l00034"></a><a class="code" href="classOsclPtrC.html#a1">00034</a>         <a class="code" href="classOsclPtrC.html#a0">OsclPtrC</a>(<span class="keyword">const</span> <a class="code" href="classOsclPtrC.html">OsclPtrC</a>&amp; d): <a class="code" href="classHeapBase.html">HeapBase</a>(d), iPtr(d.iPtr), iMaxLength(d.iMaxLength), iLength(d.iLength)
4300035         {}
44<a name="l00036"></a><a class="code" href="classOsclPtrC.html#a2">00036</a>         <span class="keyword">const</span> uint8* <a class="code" href="classOsclPtrC.html#a2">Ptr</a>()
4500037         {
4600038             <span class="keywordflow">return</span> iPtr;
4700039         }
48<a name="l00040"></a><a class="code" href="classOsclPtrC.html#a3">00040</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtrC.html#a3">SetLength</a>(int32 l)
4900041         {
5000042             <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(l &lt;= iMaxLength);
5100043             iLength = l;
5200044         }
53<a name="l00045"></a><a class="code" href="classOsclPtrC.html#a4">00045</a>         int32 <a class="code" href="classOsclPtrC.html#a4">Length</a>()
5400046         {
5500047             <span class="keywordflow">return</span> iLength;
5600048         }
57<a name="l00049"></a><a class="code" href="classOsclPtrC.html#a5">00049</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtrC.html#a5">Zero</a>()
5800050         {
5900051             iLength = 0;
6000052         }
61<a name="l00053"></a><a class="code" href="classOsclPtrC.html#a6">00053</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtrC.html#a6">Set</a>(<a class="code" href="classOsclPtrC.html">OsclPtrC</a>* v)
6200054         {
6300055             iPtr = v-&gt;<a class="code" href="classOsclPtrC.html#o0">iPtr</a>;
6400056             iMaxLength = v-&gt;<a class="code" href="classOsclPtrC.html#o1">iMaxLength</a>;
6500057             iLength = v-&gt;<a class="code" href="classOsclPtrC.html#o2">iLength</a>;
6600058         }
67<a name="l00059"></a><a class="code" href="classOsclPtrC.html#a7">00059</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtrC.html#a6">Set</a>(uint8* ptr, int32 len, int32 max)
6800060         {
6900061             iPtr = ptr;
7000062             iLength = len;
7100063             iMaxLength = max;
7200064         }
7300065         <span class="comment">//extract the right-most data</span>
74<a name="l00066"></a><a class="code" href="classOsclPtrC.html#a8">00066</a>         <a class="code" href="classOsclPtrC.html">OsclPtrC</a> <a class="code" href="classOsclPtrC.html#a8">Right</a>(int32 size)
7500067         {
7600068             <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength &gt;= size);
7700069             <a class="code" href="classOsclPtrC.html">OsclPtrC</a> des(iPtr + iLength - size, size, size);
7800070             <span class="keywordflow">return</span> des;
7900071         }
8000072         <span class="comment">//extract the left-most data</span>
81<a name="l00073"></a><a class="code" href="classOsclPtrC.html#a9">00073</a>         <a class="code" href="classOsclPtrC.html">OsclPtrC</a> <a class="code" href="classOsclPtrC.html#a9">Left</a>(int32 size)
8200074         {
8300075             <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength &gt;= size);
8400076             <a class="code" href="classOsclPtrC.html">OsclPtrC</a> des(iPtr, size, size);
8500077             <span class="keywordflow">return</span> des;
8600078         }
8700079     <span class="keyword">private</span>:
8800080         <span class="keyword">const</span> uint8* iPtr;
8900081         int32 iMaxLength;
9000082         int32 iLength;
9100083 };
9200084
9300085 <span class="comment">//modifiable buffer pointer container</span>
94<a name="l00086"></a><a class="code" href="classOsclPtr.html">00086</a> <span class="keyword">class </span><a class="code" href="classOsclPtr.html">OsclPtr</a>: <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a>
9500087 {
9600088     <span class="keyword">public</span>:
97<a name="l00089"></a><a class="code" href="classOsclPtr.html#a0">00089</a>         <a class="code" href="classOsclPtr.html#a0">OsclPtr</a>(uint8* ptr, int32&amp; len, int32 max): iPtr(ptr), iMaxLength(max), iLength(len)
9800090         {}
99<a name="l00091"></a><a class="code" href="classOsclPtr.html#a1">00091</a>         <a class="code" href="classOsclPtr.html#a0">OsclPtr</a>(<span class="keyword">const</span> <a class="code" href="classOsclPtr.html">OsclPtr</a>&amp; d): <a class="code" href="classHeapBase.html">HeapBase</a>(d), iPtr(d.iPtr), iMaxLength(d.iMaxLength), iLength(d.iLength)
10000092         {}
101<a name="l00093"></a><a class="code" href="classOsclPtr.html#a2">00093</a>         uint8* <a class="code" href="classOsclPtr.html#a2">Ptr</a>()
10200094         {
10300095             <span class="keywordflow">return</span> iPtr;
10400096         }
105<a name="l00097"></a><a class="code" href="classOsclPtr.html#a3">00097</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtr.html#a3">SetLength</a>(int32 l)
10600098         {
10700099             <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(l &lt;= iMaxLength);
10800100             iLength = l;
10900101         }
110<a name="l00102"></a><a class="code" href="classOsclPtr.html#a4">00102</a>         int32 <a class="code" href="classOsclPtr.html#a4">Length</a>()
11100103         {
11200104             <span class="keywordflow">return</span> iLength;
11300105         }
114<a name="l00106"></a><a class="code" href="classOsclPtr.html#a5">00106</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtr.html#a5">Zero</a>()
11500107         {
11600108             iLength = 0;
11700109         }
118<a name="l00110"></a><a class="code" href="classOsclPtr.html#a6">00110</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtr.html#a6">Set</a>(<a class="code" href="classOsclPtr.html">OsclPtr</a> &amp;v)
11900111         {
12000112             iPtr = v.<a class="code" href="classOsclPtr.html#o0">iPtr</a>;
12100113             iMaxLength = v.<a class="code" href="classOsclPtr.html#o1">iMaxLength</a>;
12200114             iLength = v.<a class="code" href="classOsclPtr.html#o2">iLength</a>;
12300115         }
124<a name="l00116"></a><a class="code" href="classOsclPtr.html#a7">00116</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtr.html#a6">Set</a>(uint8* ptr, int32 len, int32 max)
12500117         {
12600118             iPtr = ptr;
12700119             iLength = len;
12800120             iMaxLength = max;
12900121         }
130<a name="l00122"></a><a class="code" href="classOsclPtr.html#a8">00122</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclPtr.html#a8">Append</a>(<a class="code" href="classOsclPtrC.html">OsclPtrC</a> &amp;v)
13100123         {
13200124             <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength + v.<a class="code" href="classOsclPtrC.html#a4">Length</a>() &lt;= iMaxLength);
13300125             <a class="code" href="group__osclmemory.html#a12">oscl_memmove</a>(iPtr + iLength, v.<a class="code" href="classOsclPtrC.html#a2">Ptr</a>(), v.<a class="code" href="classOsclPtrC.html#a4">Length</a>());
13400126             iLength += v.<a class="code" href="classOsclPtrC.html#a4">Length</a>();
13500127         }
13600128     <span class="keyword">private</span>:
13700129         uint8* iPtr;
13800130         int32 iMaxLength;
13900131         int32&amp; iLength;
14000132 };
14100133
14200134 <span class="comment">//buffer container that allocates from the heap</span>
143<a name="l00135"></a><a class="code" href="classOsclBuf.html">00135</a> <span class="keyword">class </span><a class="code" href="classOsclBuf.html">OsclBuf</a>: <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a>
14400136 {
14500137     <span class="keyword">public</span>:
146<a name="l00138"></a><a class="code" href="classOsclBuf.html#d0">00138</a>         <span class="keyword">static</span> <a class="code" href="classOsclBuf.html">OsclBuf</a>* <a class="code" href="classOsclBuf.html#d0">NewL</a>(int32 size)
14700139         {
14800140             <a class="code" href="classOsclBuf.html">OsclBuf</a>* self = <a class="code" href="group__osclmemory.html#a52">OSCL_NEW</a>(<a class="code" href="classOsclBuf.html">OsclBuf</a>, (size));
14900141             self-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a> = (uint8*)<a class="code" href="group__osclmemory.html#a39">OSCL_MALLOC</a>(self-&gt;<a class="code" href="classOsclBuf.html#m1">iMaxLength</a>);
15000142             <span class="keywordflow">if</span> (!self-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>)
15100143             {
15200144                 <a class="code" href="group__osclmemory.html#a57">OSCL_DELETE</a>(self);
15300145                 <a class="code" href="classOsclError.html#d7">OsclError::Leave</a>(<a class="code" href="group__osclerror.html#a13">OsclErrNoMemory</a>);
15400146             }
15500147             <span class="keywordflow">return</span> self;
15600148         }
15700149
158<a name="l00150"></a><a class="code" href="classOsclBuf.html#d1">00150</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclBuf.html#d1">Delete</a>(<a class="code" href="classOsclBuf.html">OsclBuf</a>* a)
15900151         {
16000152             <span class="keywordflow">if</span> (a)
16100153             {
16200154                 <span class="keywordflow">if</span> (a-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>)
16300155                     <a class="code" href="group__osclmemory.html#a49">OSCL_FREE</a>(a-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>);
16400156                 <a class="code" href="group__osclmemory.html#a57">OSCL_DELETE</a>(a);
16500157             }
16600158         }
16700159
168<a name="l00160"></a><a class="code" href="classOsclBuf.html#a0">00160</a>         <a class="code" href="classOsclBuf.html#a0">OsclBuf</a>(int32 size): <a class="code" href="classOsclBuf.html#m0">iBuffer</a>(<a class="code" href="group__osclbase.html#a81">NULL</a>), <a class="code" href="classOsclBuf.html#m1">iMaxLength</a>(size), <a class="code" href="classOsclBuf.html#m2">iLength</a>(0)
16900161         {}
17000162
171<a name="l00163"></a><a class="code" href="classOsclBuf.html#a1">00163</a>         int32 <a class="code" href="classOsclBuf.html#a1">Length</a>()
17200164         {
17300165             <span class="keywordflow">return</span> <a class="code" href="classOsclBuf.html#m2">iLength</a>;
17400166         }
17500167
176<a name="l00168"></a><a class="code" href="classOsclBuf.html#a2">00168</a>         <a class="code" href="classOsclPtr.html">OsclPtr</a> <a class="code" href="classOsclBuf.html#a2">Des</a>()
17700169         {
17800170             <a class="code" href="classOsclPtr.html">OsclPtr</a> des(<a class="code" href="classOsclBuf.html#m0">iBuffer</a>, <a class="code" href="classOsclBuf.html#m2">iLength</a>, <a class="code" href="classOsclBuf.html#m1">iMaxLength</a>);
17900171             <span class="keywordflow">return</span> des;
18000172         }
181<a name="l00173"></a><a class="code" href="classOsclBuf.html#a3">00173</a>         <a class="code" href="classOsclPtrC.html">OsclPtrC</a> <a class="code" href="classOsclBuf.html#a3">DesC</a>()
18200174         {
18300175             <a class="code" href="classOsclPtrC.html">OsclPtrC</a> des(<a class="code" href="classOsclBuf.html#m0">iBuffer</a>, <a class="code" href="classOsclBuf.html#m2">iLength</a>, <a class="code" href="classOsclBuf.html#m1">iMaxLength</a>);
18400176             <span class="keywordflow">return</span> des;
18500177         }
18600178
187<a name="l00179"></a><a class="code" href="classOsclBuf.html#m0">00179</a>         uint8* <a class="code" href="classOsclBuf.html#m0">iBuffer</a>;
188<a name="l00180"></a><a class="code" href="classOsclBuf.html#m1">00180</a>         int32 <a class="code" href="classOsclBuf.html#m1">iMaxLength</a>;
189<a name="l00181"></a><a class="code" href="classOsclBuf.html#m2">00181</a>         int32 <a class="code" href="classOsclBuf.html#m2">iLength</a>;
19000182 };
19100183
19200184
193<a name="l00190"></a><a class="code" href="classOsclAsyncFileBuffer.html">00190</a> <span class="keyword">class </span><a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>: <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a>
19400191 {
19500192     <span class="keyword">public</span>:
19600193         <span class="keyword">static</span> <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* <a class="code" href="classOsclAsyncFileBuffer.html#d0">NewL</a>(int32 aBufferSize, int32 aId);
19700194         <a class="code" href="classOsclAsyncFileBuffer.html#a0">~OsclAsyncFileBuffer</a>();
19800195
19900196     <span class="keyword">public</span>:
200<a name="l00197"></a><a class="code" href="classOsclAsyncFileBuffer.html#a1">00197</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a1">CleanInUse</a>()
20100198         {
20200199             iInUse = <span class="keyword">false</span>;
20300200         }
204<a name="l00201"></a><a class="code" href="classOsclAsyncFileBuffer.html#a2">00201</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a2">SetInUse</a>()
20500202         {
20600203             iInUse = <span class="keyword">true</span>;
20700204         }
208<a name="l00205"></a><a class="code" href="classOsclAsyncFileBuffer.html#a3">00205</a>         <span class="keywordtype">bool</span> <a class="code" href="classOsclAsyncFileBuffer.html#a3">IsInUse</a>()
20900206         {
21000207             <span class="keywordflow">return</span> iInUse;
21100208         }
212<a name="l00209"></a><a class="code" href="classOsclAsyncFileBuffer.html#a4">00209</a>         <span class="keywordtype">bool</span> <a class="code" href="classOsclAsyncFileBuffer.html#a4">IsValid</a>()
21300210         {
21400211             <span class="keywordflow">return</span> iValid;
21500212         }
216<a name="l00213"></a><a class="code" href="classOsclAsyncFileBuffer.html#a5">00213</a>         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclAsyncFileBuffer.html#a5">Offset</a>()
21700214         {
21800215             <span class="keywordflow">return</span> iOffset;
21900216         }
220<a name="l00217"></a><a class="code" href="classOsclAsyncFileBuffer.html#a6">00217</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a6">SetOffset</a>(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aOffset)
22100218         {
22200219             iOffset = aOffset;
22300220         }
224<a name="l00221"></a><a class="code" href="classOsclAsyncFileBuffer.html#a7">00221</a>         int32 <a class="code" href="classOsclAsyncFileBuffer.html#a7">Length</a>()
22500222         {
22600223             <span class="keywordflow">return</span> iLength;
22700224         }
22800225         <span class="keywordtype">bool</span> <a class="code" href="classOsclAsyncFileBuffer.html#a8">HasThisOffset</a>(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aOffset);
229<a name="l00226"></a><a class="code" href="classOsclAsyncFileBuffer.html#a9">00226</a>         int32 <a class="code" href="classOsclAsyncFileBuffer.html#a9">Id</a>()
23000227         {
23100228             <span class="keywordflow">return</span> iId;
23200229         }
23300230         <a class="code" href="classOsclBuf.html">OsclBuf</a>* <a class="code" href="classOsclAsyncFileBuffer.html#a10">Buffer</a>();
23400231         <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a11">UpdateData</a>();
23500232         <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a12">StartAsyncRead</a>(<span class="keywordtype">bool</span> aStartAsyncRead);
23600233
23700234     <span class="keyword">private</span>:
23800235         <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>(int32 aBufferSize, int32 aId);
23900236         <span class="keywordtype">void</span> ConstructL();
24000237
24100238     <span class="keyword">private</span>:
24200239         <a class="code" href="classOsclBuf.html">OsclBuf</a>* iBuffer;
24300240         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iOffset;
24400241         <span class="keywordtype">bool</span> iInUse;
24500242         int32 iLength;
24600243         <span class="keywordtype">bool</span> iValid;
24700244         int32 iBufferSize;
24800245         int32 iId;
24900246 };
25000247
25100248
252<a name="l00252"></a><a class="code" href="classOsclAsyncFile.html">00252</a> <span class="keyword">class </span><a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a> : <span class="keyword">public</span> <a class="code" href="classOsclActiveObject.html">OsclActiveObject</a>
25300253 {
25400254     <span class="keyword">public</span>:
25500272         <span class="keyword">static</span> <a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>* <a class="code" href="classOsclAsyncFile.html#d0">NewL</a>(<a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>&amp; aAsyncFile, int32 aCacheSize, <a class="code" href="classPVLogger.html">PVLogger</a>*);
25600273         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFile.html#d1">Delete</a>(<a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>*);
25700274
25800278         <a class="code" href="classOsclAsyncFile.html#a0">~OsclAsyncFile</a>();
25900279
26000280     <span class="keyword">private</span>:
26100281         <span class="comment">//From OsclActiveObject</span>
26200282         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a4">Run</a>();
26300283         <span class="keywordtype">void</span> <a class="code" href="classOsclActiveObject.html#b0">DoCancel</a>();
26400284
26500285     <span class="keyword">public</span>:
26600287         <span class="comment">// File IO methods.</span>
26700289 <span class="comment"></span>
26800290         int32  <a class="code" href="classOsclAsyncFile.html#a1">Open</a>(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a32">oscl_wchar</a> *filename, uint32 mode
26900291                     , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
27000292                     , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
27100293         int32  <a class="code" href="classOsclAsyncFile.html#a1">Open</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, uint32 mode
27200294                     , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
27300295                     , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
27400296
27500297         int32 <a class="code" href="classOsclAsyncFile.html#a3">Seek</a>(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> offset, <a class="code" href="classOscl__File.html#s11">Oscl_File::seek_type</a> origin);
27600298         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclAsyncFile.html#a4">Tell</a>();
27700299         uint32 <a class="code" href="classOsclAsyncFile.html#a5">Read</a>(<a class="code" href="group__osclbase.html#a25">OsclAny</a>* aBuffer1, uint32 aDataSize, uint32 aNumElements);
27800300         int32 <a class="code" href="classOsclAsyncFile.html#a6">EndOfFile</a>();
27900301         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclAsyncFile.html#a7">Size</a>();
28000302         int32 <a class="code" href="classOsclAsyncFile.html#a8">Close</a>();
28100303
282<a name="l00304"></a><a class="code" href="classOsclAsyncFile.html#a9">00304</a>         uint32 <a class="code" href="classOsclAsyncFile.html#a9">Write</a>(<span class="keyword">const</span> <a class="code" href="group__osclbase.html#a25">OsclAny</a>* aBuffer1, uint32 aDataSize, uint32 aNumElements)
28300305         {
28400306             <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aBuffer1);
28500307             <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aDataSize);
28600308             <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aNumElements);
28700309             <span class="keywordflow">return</span> 0;<span class="comment">//not supported</span>
28800310         }
289<a name="l00311"></a><a class="code" href="classOsclAsyncFile.html#a10">00311</a>         uint32 <a class="code" href="classOsclAsyncFile.html#a10">Flush</a>()
29000312         {
29100313             <span class="keywordflow">return</span> ((uint32) - 1);<span class="comment">//not supported</span>
29200314         }
29300315
29400316     <span class="keyword">private</span>:
29500317         <a class="code" href="classOsclAsyncFile.html">OsclAsyncFile</a>(<a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>&amp; aAsyncFile, int32 aCacheSize, <a class="code" href="classPVLogger.html">PVLogger</a>*);
29600321         <span class="keywordtype">void</span> ConstructL();
29700322
29800323     <span class="keyword">private</span>:
29900324         <span class="comment">// private utility methods</span>
30000325         <span class="keywordtype">void</span> StartAsyncRead(<span class="keywordtype">bool</span> aStartAsyncRead);
30100326         <span class="keywordtype">bool</span> FindDataBuffer(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>*&amp; aDataBuffer, int32&amp; aBufferId, <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aOffset, int32 aSize);
30200327         <span class="keywordtype">void</span> UpdateReading();
30300328         int32 BytesReadAhead();
30400329         int32 SortDataBuffers();
30500330         <span class="keywordtype">bool</span> GetNextDataBuffer(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>*&amp; aDataBuffer, <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aFilePointerToReadFrom);
30600331         <span class="keywordtype">void</span> StartNextRead(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aPosToReadFrom);
30700332         <span class="keywordtype">void</span> ReOrderBuffersQueue(int32 aFirstBufferId);
30800333         <span class="keywordtype">bool</span> IsLinkedDataBuffer(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* aDataBuffer);
30900334         <span class="keywordtype">bool</span> CanBeLinked(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* aDataBuffer);
31000335         uint32 doRead(uint8*&amp; aBuffer1, uint32 aDataSize, uint32 aNumElements, <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aOffset);
31100336
31200337     <span class="keyword">private</span>:
31300338         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iFileSize;
31400339
31500340         <span class="comment">// File object to do async read from</span>
31600341         <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>&amp; iNativeFile;
31700342
31800343         <span class="comment">// File position for async reads.</span>
31900344         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iAsyncFilePosition;
32000345
32100346         <span class="comment">// For verification</span>
32200347         <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFileVerify;
32300348         int32 iVerifyCount;
32400349
32500350         <span class="comment">// Duplicate file handle for sync read</span>
32600351         <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFileDuplicate;
32700352
32800353         <span class="comment">// File position for sync reads.</span>
32900354         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iSyncFilePosition;
33000355
33100356         <span class="comment">// Arrays of data buffers</span>
33200357         <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iDataBufferArray;
33300358         <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iSortedDataBufferArray;
33400359         <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iLinkedDataBufferArray;
33500360
33600361         <span class="comment">// Local data buffer</span>
33700362         <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* iDataBuffer;
33800363         <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* iDataBufferInUse;
33900364
34000365         <span class="comment">// Buffer for synchronous read</span>
34100366         <a class="code" href="classOsclBuf.html">OsclBuf</a>* iSyncBuffer;
34200367
34300368         <span class="comment">// Initialized in constructor. Determines the size of each data buffer</span>
34400369         uint32 iTotalCacheSize;
34500370
34600371         <span class="comment">// Logical File Position (as seen by the client of this class)</span>
34700372         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iFilePosition;
34800373
34900374         <span class="comment">// Last offset after a user read operation</span>
35000375         <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iLastUserFileRead;
35100376
35200377         <span class="comment">// Start async read enable flag</span>
35300378         <span class="keywordtype">bool</span> iStartAsyncRead;
35400379
35500380         <span class="comment">// Pointer to buffer for asynchronous read</span>
35600381         int32 iReadPtrDummyLen;
35700382         <a class="code" href="classOsclPtr.html">OsclPtr</a> iReadPtr;
35800383
35900384         <span class="comment">// For profiling</span>
36000385         <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger;
36100386
36200388         <span class="comment">// Configuration parameters.</span>
36300390 <span class="comment"></span>
36400391         <span class="comment">//   Number of buffers in the linked list</span>
36500392         int32 iKCacheBufferCount ;
36600393
36700394         <span class="comment">//   This defines the limit on how much data we will</span>
36800395         <span class="comment">//   read ahead of the current position</span>
36900396         int32 iKMinBytesReadAhead ;
37000397
37100398         <span class="comment">//   This defines the size of the individual async read operations.</span>
37200399         int32 iKAsyncReadBufferSize ;
37300400
37400402         <span class="comment">// The non-native async read implementation.</span>
37500404 <span class="comment"></span>
37600405         <span class="comment">// Keeps track of whether we have native async read or not</span>
37700406         <span class="keywordtype">bool</span> iHasNativeAsyncRead;
37800407
37900408         <span class="comment">// Thread control sems</span>
38000409         <a class="code" href="classOsclSemaphore.html">OsclSemaphore</a> iAsyncReadSem;
38100410         <a class="code" href="classOsclSemaphore.html">OsclSemaphore</a> iAsyncReadExitSem;
38200411
38300412         <span class="comment">// To keep track of the tread state:</span>
38400413         <span class="comment">// EAsyncReadNotActive - the thread is not created or the thread is stopped</span>
38500414         <span class="comment">// EAsyncReadActive    - the thread is running</span>
38600415         <span class="keyword">enum</span> TAsyncReadThreadState {EAsyncReadNotActive, EAsyncReadActive};
38700416         TAsyncReadThreadState iAsyncReadThreadState;
38800417
38900418         <span class="comment">// To signal the thread to exit</span>
39000419         <span class="keywordtype">bool</span> iAsyncReadThreadExitFlag;
39100420
39200421         <span class="comment">// Number of bytes read in the last call</span>
39300422         int32 iAsyncReadNumBytes;
39400423
39500424         <span class="comment">// Thread routine</span>
39600425         <span class="keywordtype">void</span> InThread();
39700426         <span class="keyword">static</span> TOsclThreadFuncRet OSCL_THREAD_DECL iAsyncReadThreadFunc(TOsclThreadFuncArg);
39800427
39900428         <span class="comment">// Thread start/stop.</span>
40000429         <span class="keywordtype">void</span> LaunchAsyncReadThread();
40100430         <span class="keywordtype">void</span> StopAsyncReadThread();
40200431
40300432         <span class="comment">// Request an async read.</span>
40400433         <span class="keywordtype">void</span> StartNonNativeAsyncRead();
40500434
40600435     <span class="keyword">public</span>:
40700436         <span class="comment">// for test&amp;stat</span>
408<a name="l00437"></a><a class="code" href="classOsclAsyncFile.html#m0">00437</a>         uint32 <a class="code" href="classOsclAsyncFile.html#m0">iNumOfRun</a>;
409<a name="l00438"></a><a class="code" href="classOsclAsyncFile.html#m1">00438</a>         uint32 <a class="code" href="classOsclAsyncFile.html#m1">iNumOfRunErr</a>;
41000439 };
41100440
41200441 <span class="preprocessor">#endif</span>
41300442 <span class="preprocessor"></span>
414</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
415<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
416</small></address>
417</body>
418</html>
419