blob: a8d9f8325c82fb0f25595150e593a425f7dff63a [file] [log] [blame]
<!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_file_async_read.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> &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>
<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>
00002 <span class="comment">* ============================================================================</span>
00003 <span class="comment">* Name : oscl_async_file.h</span>
00004 <span class="comment">* Part of : osclio</span>
00005 <span class="comment">* Interface :</span>
00006 <span class="comment">* Description :</span>
00007 <span class="comment">* Version :</span>
00008 <span class="comment">* ==============================================================================</span>
00009 <span class="comment">*/</span>
00010
00011 <span class="preprocessor">#ifndef OSCL_FILE_ASYNC_READ_H_INCLUDED</span>
00012 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_ASYNC_READ_H_INCLUDED</span>
00013 <span class="preprocessor"></span>
00014
00015 <span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span>
00016 <span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span>
00017 <span class="preprocessor">#include "<a class="code" href="oscl__vector_8h.html">oscl_vector.h</a>"</span>
00018 <span class="preprocessor">#include "<a class="code" href="oscl__mem_8h.html">oscl_mem.h</a>"</span>
00019 <span class="preprocessor">#include "<a class="code" href="oscl__scheduler__ao_8h.html">oscl_scheduler_ao.h</a>"</span>
00020 <span class="preprocessor">#include "<a class="code" href="oscl__file__io_8h.html">oscl_file_io.h</a>"</span>
00021
00022 <span class="preprocessor">#ifndef OSCL_SEMAPHORE_H_INCLUDED</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__semaphore_8h.html">oscl_semaphore.h</a>"</span>
00024 <span class="preprocessor">#endif</span>
00025 <span class="preprocessor"></span>
00026 <span class="keyword">class </span><a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>;
00027
00028 <span class="comment">//non-modifiable buffer pointer container</span>
<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>
00030 {
00031 <span class="keyword">public</span>:
<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)
00033 {}
<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)
00035 {}
<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>()
00037 {
00038 <span class="keywordflow">return</span> iPtr;
00039 }
<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)
00041 {
00042 <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(l &lt;= iMaxLength);
00043 iLength = l;
00044 }
<a name="l00045"></a><a class="code" href="classOsclPtrC.html#a4">00045</a> int32 <a class="code" href="classOsclPtrC.html#a4">Length</a>()
00046 {
00047 <span class="keywordflow">return</span> iLength;
00048 }
<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>()
00050 {
00051 iLength = 0;
00052 }
<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)
00054 {
00055 iPtr = v-&gt;<a class="code" href="classOsclPtrC.html#o0">iPtr</a>;
00056 iMaxLength = v-&gt;<a class="code" href="classOsclPtrC.html#o1">iMaxLength</a>;
00057 iLength = v-&gt;<a class="code" href="classOsclPtrC.html#o2">iLength</a>;
00058 }
<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)
00060 {
00061 iPtr = ptr;
00062 iLength = len;
00063 iMaxLength = max;
00064 }
00065 <span class="comment">//extract the right-most data</span>
<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)
00067 {
00068 <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength &gt;= size);
00069 <a class="code" href="classOsclPtrC.html">OsclPtrC</a> des(iPtr + iLength - size, size, size);
00070 <span class="keywordflow">return</span> des;
00071 }
00072 <span class="comment">//extract the left-most data</span>
<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)
00074 {
00075 <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength &gt;= size);
00076 <a class="code" href="classOsclPtrC.html">OsclPtrC</a> des(iPtr, size, size);
00077 <span class="keywordflow">return</span> des;
00078 }
00079 <span class="keyword">private</span>:
00080 <span class="keyword">const</span> uint8* iPtr;
00081 int32 iMaxLength;
00082 int32 iLength;
00083 };
00084
00085 <span class="comment">//modifiable buffer pointer container</span>
<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>
00087 {
00088 <span class="keyword">public</span>:
<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)
00090 {}
<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)
00092 {}
<a name="l00093"></a><a class="code" href="classOsclPtr.html#a2">00093</a> uint8* <a class="code" href="classOsclPtr.html#a2">Ptr</a>()
00094 {
00095 <span class="keywordflow">return</span> iPtr;
00096 }
<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)
00098 {
00099 <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(l &lt;= iMaxLength);
00100 iLength = l;
00101 }
<a name="l00102"></a><a class="code" href="classOsclPtr.html#a4">00102</a> int32 <a class="code" href="classOsclPtr.html#a4">Length</a>()
00103 {
00104 <span class="keywordflow">return</span> iLength;
00105 }
<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>()
00107 {
00108 iLength = 0;
00109 }
<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)
00111 {
00112 iPtr = v.<a class="code" href="classOsclPtr.html#o0">iPtr</a>;
00113 iMaxLength = v.<a class="code" href="classOsclPtr.html#o1">iMaxLength</a>;
00114 iLength = v.<a class="code" href="classOsclPtr.html#o2">iLength</a>;
00115 }
<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)
00117 {
00118 iPtr = ptr;
00119 iLength = len;
00120 iMaxLength = max;
00121 }
<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)
00123 {
00124 <a class="code" href="group__osclbase.html#a78">OSCL_ASSERT</a>(iLength + v.<a class="code" href="classOsclPtrC.html#a4">Length</a>() &lt;= iMaxLength);
00125 <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>());
00126 iLength += v.<a class="code" href="classOsclPtrC.html#a4">Length</a>();
00127 }
00128 <span class="keyword">private</span>:
00129 uint8* iPtr;
00130 int32 iMaxLength;
00131 int32&amp; iLength;
00132 };
00133
00134 <span class="comment">//buffer container that allocates from the heap</span>
<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>
00136 {
00137 <span class="keyword">public</span>:
<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)
00139 {
00140 <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));
00141 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>);
00142 <span class="keywordflow">if</span> (!self-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>)
00143 {
00144 <a class="code" href="group__osclmemory.html#a57">OSCL_DELETE</a>(self);
00145 <a class="code" href="classOsclError.html#d7">OsclError::Leave</a>(<a class="code" href="group__osclerror.html#a13">OsclErrNoMemory</a>);
00146 }
00147 <span class="keywordflow">return</span> self;
00148 }
00149
<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)
00151 {
00152 <span class="keywordflow">if</span> (a)
00153 {
00154 <span class="keywordflow">if</span> (a-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>)
00155 <a class="code" href="group__osclmemory.html#a49">OSCL_FREE</a>(a-&gt;<a class="code" href="classOsclBuf.html#m0">iBuffer</a>);
00156 <a class="code" href="group__osclmemory.html#a57">OSCL_DELETE</a>(a);
00157 }
00158 }
00159
<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)
00161 {}
00162
<a name="l00163"></a><a class="code" href="classOsclBuf.html#a1">00163</a> int32 <a class="code" href="classOsclBuf.html#a1">Length</a>()
00164 {
00165 <span class="keywordflow">return</span> <a class="code" href="classOsclBuf.html#m2">iLength</a>;
00166 }
00167
<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>()
00169 {
00170 <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>);
00171 <span class="keywordflow">return</span> des;
00172 }
<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>()
00174 {
00175 <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>);
00176 <span class="keywordflow">return</span> des;
00177 }
00178
<a name="l00179"></a><a class="code" href="classOsclBuf.html#m0">00179</a> uint8* <a class="code" href="classOsclBuf.html#m0">iBuffer</a>;
<a name="l00180"></a><a class="code" href="classOsclBuf.html#m1">00180</a> int32 <a class="code" href="classOsclBuf.html#m1">iMaxLength</a>;
<a name="l00181"></a><a class="code" href="classOsclBuf.html#m2">00181</a> int32 <a class="code" href="classOsclBuf.html#m2">iLength</a>;
00182 };
00183
00184
<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>
00191 {
00192 <span class="keyword">public</span>:
00193 <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);
00194 <a class="code" href="classOsclAsyncFileBuffer.html#a0">~OsclAsyncFileBuffer</a>();
00195
00196 <span class="keyword">public</span>:
<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>()
00198 {
00199 iInUse = <span class="keyword">false</span>;
00200 }
<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>()
00202 {
00203 iInUse = <span class="keyword">true</span>;
00204 }
<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>()
00206 {
00207 <span class="keywordflow">return</span> iInUse;
00208 }
<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>()
00210 {
00211 <span class="keywordflow">return</span> iValid;
00212 }
<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>()
00214 {
00215 <span class="keywordflow">return</span> iOffset;
00216 }
<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)
00218 {
00219 iOffset = aOffset;
00220 }
<a name="l00221"></a><a class="code" href="classOsclAsyncFileBuffer.html#a7">00221</a> int32 <a class="code" href="classOsclAsyncFileBuffer.html#a7">Length</a>()
00222 {
00223 <span class="keywordflow">return</span> iLength;
00224 }
00225 <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);
<a name="l00226"></a><a class="code" href="classOsclAsyncFileBuffer.html#a9">00226</a> int32 <a class="code" href="classOsclAsyncFileBuffer.html#a9">Id</a>()
00227 {
00228 <span class="keywordflow">return</span> iId;
00229 }
00230 <a class="code" href="classOsclBuf.html">OsclBuf</a>* <a class="code" href="classOsclAsyncFileBuffer.html#a10">Buffer</a>();
00231 <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a11">UpdateData</a>();
00232 <span class="keywordtype">void</span> <a class="code" href="classOsclAsyncFileBuffer.html#a12">StartAsyncRead</a>(<span class="keywordtype">bool</span> aStartAsyncRead);
00233
00234 <span class="keyword">private</span>:
00235 <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>(int32 aBufferSize, int32 aId);
00236 <span class="keywordtype">void</span> ConstructL();
00237
00238 <span class="keyword">private</span>:
00239 <a class="code" href="classOsclBuf.html">OsclBuf</a>* iBuffer;
00240 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iOffset;
00241 <span class="keywordtype">bool</span> iInUse;
00242 int32 iLength;
00243 <span class="keywordtype">bool</span> iValid;
00244 int32 iBufferSize;
00245 int32 iId;
00246 };
00247
00248
<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>
00253 {
00254 <span class="keyword">public</span>:
00272 <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>*);
00273 <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>*);
00274
00278 <a class="code" href="classOsclAsyncFile.html#a0">~OsclAsyncFile</a>();
00279
00280 <span class="keyword">private</span>:
00281 <span class="comment">//From OsclActiveObject</span>
00282 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a4">Run</a>();
00283 <span class="keywordtype">void</span> <a class="code" href="classOsclActiveObject.html#b0">DoCancel</a>();
00284
00285 <span class="keyword">public</span>:
00287 <span class="comment">// File IO methods.</span>
00289 <span class="comment"></span>
00290 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
00291 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00292 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
00293 int32 <a class="code" href="classOsclAsyncFile.html#a1">Open</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, uint32 mode
00294 , <span class="keyword">const</span> <a class="code" href="classOsclNativeFileParams.html">OsclNativeFileParams</a>&amp; params
00295 , <a class="code" href="classOscl__FileServer.html">Oscl_FileServer</a>&amp; fileserv);
00296
00297 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);
00298 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclAsyncFile.html#a4">Tell</a>();
00299 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);
00300 int32 <a class="code" href="classOsclAsyncFile.html#a6">EndOfFile</a>();
00301 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclAsyncFile.html#a7">Size</a>();
00302 int32 <a class="code" href="classOsclAsyncFile.html#a8">Close</a>();
00303
<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)
00305 {
00306 <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aBuffer1);
00307 <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aDataSize);
00308 <a class="code" href="group__osclbase.html#a89">OSCL_UNUSED_ARG</a>(aNumElements);
00309 <span class="keywordflow">return</span> 0;<span class="comment">//not supported</span>
00310 }
<a name="l00311"></a><a class="code" href="classOsclAsyncFile.html#a10">00311</a> uint32 <a class="code" href="classOsclAsyncFile.html#a10">Flush</a>()
00312 {
00313 <span class="keywordflow">return</span> ((uint32) - 1);<span class="comment">//not supported</span>
00314 }
00315
00316 <span class="keyword">private</span>:
00317 <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>*);
00321 <span class="keywordtype">void</span> ConstructL();
00322
00323 <span class="keyword">private</span>:
00324 <span class="comment">// private utility methods</span>
00325 <span class="keywordtype">void</span> StartAsyncRead(<span class="keywordtype">bool</span> aStartAsyncRead);
00326 <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);
00327 <span class="keywordtype">void</span> UpdateReading();
00328 int32 BytesReadAhead();
00329 int32 SortDataBuffers();
00330 <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);
00331 <span class="keywordtype">void</span> StartNextRead(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aPosToReadFrom);
00332 <span class="keywordtype">void</span> ReOrderBuffersQueue(int32 aFirstBufferId);
00333 <span class="keywordtype">bool</span> IsLinkedDataBuffer(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* aDataBuffer);
00334 <span class="keywordtype">bool</span> CanBeLinked(<a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* aDataBuffer);
00335 uint32 doRead(uint8*&amp; aBuffer1, uint32 aDataSize, uint32 aNumElements, <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> aOffset);
00336
00337 <span class="keyword">private</span>:
00338 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iFileSize;
00339
00340 <span class="comment">// File object to do async read from</span>
00341 <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>&amp; iNativeFile;
00342
00343 <span class="comment">// File position for async reads.</span>
00344 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iAsyncFilePosition;
00345
00346 <span class="comment">// For verification</span>
00347 <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFileVerify;
00348 int32 iVerifyCount;
00349
00350 <span class="comment">// Duplicate file handle for sync read</span>
00351 <a class="code" href="classOsclNativeFile.html">OsclNativeFile</a>* iNativeFileDuplicate;
00352
00353 <span class="comment">// File position for sync reads.</span>
00354 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iSyncFilePosition;
00355
00356 <span class="comment">// Arrays of data buffers</span>
00357 <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iDataBufferArray;
00358 <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iSortedDataBufferArray;
00359 <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;OsclAsyncFileBuffer*, OsclMemAllocator&gt;</a> iLinkedDataBufferArray;
00360
00361 <span class="comment">// Local data buffer</span>
00362 <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* iDataBuffer;
00363 <a class="code" href="classOsclAsyncFileBuffer.html">OsclAsyncFileBuffer</a>* iDataBufferInUse;
00364
00365 <span class="comment">// Buffer for synchronous read</span>
00366 <a class="code" href="classOsclBuf.html">OsclBuf</a>* iSyncBuffer;
00367
00368 <span class="comment">// Initialized in constructor. Determines the size of each data buffer</span>
00369 uint32 iTotalCacheSize;
00370
00371 <span class="comment">// Logical File Position (as seen by the client of this class)</span>
00372 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iFilePosition;
00373
00374 <span class="comment">// Last offset after a user read operation</span>
00375 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> iLastUserFileRead;
00376
00377 <span class="comment">// Start async read enable flag</span>
00378 <span class="keywordtype">bool</span> iStartAsyncRead;
00379
00380 <span class="comment">// Pointer to buffer for asynchronous read</span>
00381 int32 iReadPtrDummyLen;
00382 <a class="code" href="classOsclPtr.html">OsclPtr</a> iReadPtr;
00383
00384 <span class="comment">// For profiling</span>
00385 <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger;
00386
00388 <span class="comment">// Configuration parameters.</span>
00390 <span class="comment"></span>
00391 <span class="comment">// Number of buffers in the linked list</span>
00392 int32 iKCacheBufferCount ;
00393
00394 <span class="comment">// This defines the limit on how much data we will</span>
00395 <span class="comment">// read ahead of the current position</span>
00396 int32 iKMinBytesReadAhead ;
00397
00398 <span class="comment">// This defines the size of the individual async read operations.</span>
00399 int32 iKAsyncReadBufferSize ;
00400
00402 <span class="comment">// The non-native async read implementation.</span>
00404 <span class="comment"></span>
00405 <span class="comment">// Keeps track of whether we have native async read or not</span>
00406 <span class="keywordtype">bool</span> iHasNativeAsyncRead;
00407
00408 <span class="comment">// Thread control sems</span>
00409 <a class="code" href="classOsclSemaphore.html">OsclSemaphore</a> iAsyncReadSem;
00410 <a class="code" href="classOsclSemaphore.html">OsclSemaphore</a> iAsyncReadExitSem;
00411
00412 <span class="comment">// To keep track of the tread state:</span>
00413 <span class="comment">// EAsyncReadNotActive - the thread is not created or the thread is stopped</span>
00414 <span class="comment">// EAsyncReadActive - the thread is running</span>
00415 <span class="keyword">enum</span> TAsyncReadThreadState {EAsyncReadNotActive, EAsyncReadActive};
00416 TAsyncReadThreadState iAsyncReadThreadState;
00417
00418 <span class="comment">// To signal the thread to exit</span>
00419 <span class="keywordtype">bool</span> iAsyncReadThreadExitFlag;
00420
00421 <span class="comment">// Number of bytes read in the last call</span>
00422 int32 iAsyncReadNumBytes;
00423
00424 <span class="comment">// Thread routine</span>
00425 <span class="keywordtype">void</span> InThread();
00426 <span class="keyword">static</span> TOsclThreadFuncRet OSCL_THREAD_DECL iAsyncReadThreadFunc(TOsclThreadFuncArg);
00427
00428 <span class="comment">// Thread start/stop.</span>
00429 <span class="keywordtype">void</span> LaunchAsyncReadThread();
00430 <span class="keywordtype">void</span> StopAsyncReadThread();
00431
00432 <span class="comment">// Request an async read.</span>
00433 <span class="keywordtype">void</span> StartNonNativeAsyncRead();
00434
00435 <span class="keyword">public</span>:
00436 <span class="comment">// for test&amp;stat</span>
<a name="l00437"></a><a class="code" href="classOsclAsyncFile.html#m0">00437</a> uint32 <a class="code" href="classOsclAsyncFile.html#m0">iNumOfRun</a>;
<a name="l00438"></a><a class="code" href="classOsclAsyncFile.html#m1">00438</a> uint32 <a class="code" href="classOsclAsyncFile.html#m1">iNumOfRunErr</a>;
00439 };
00440
00441 <span class="preprocessor">#endif</span>
00442 <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>