| <!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_cache.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_file_cache.h</h1><a href="oscl__file__cache_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">// -*- c++ -*-</span> |
| 00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> |
| 00003 |
| 00004 <span class="comment">// O S C L _ F I L E _ C A C H E</span> |
| 00005 |
| 00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> |
| 00007 |
| 00019 <span class="preprocessor">#ifndef OSCL_FILE_CACHE_H_INCLUDED</span> |
| 00020 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_CACHE_H_INCLUDED</span> |
| 00021 <span class="preprocessor"></span> |
| 00022 <span class="preprocessor">#ifndef OSCLCONFIG_IO_H_INCLUDED</span> |
| 00023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span> |
| 00024 <span class="preprocessor">#endif</span> |
| 00025 <span class="preprocessor"></span> |
| 00026 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> |
| 00027 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> |
| 00028 <span class="preprocessor">#endif</span> |
| 00029 <span class="preprocessor"></span> |
| 00030 <span class="preprocessor">#include "<a class="code" href="oscl__file__io_8h.html">oscl_file_io.h</a>"</span> |
| 00031 |
| 00032 <span class="keyword">class </span><a class="code" href="classOscl__File.html">Oscl_File</a>; |
| 00033 |
| <a name="l00034"></a><a class="code" href="classOsclFileCache.html">00034</a> <span class="keyword">class </span><a class="code" href="classOsclFileCache.html">OsclFileCache</a> : <span class="keyword">public</span> <a class="code" href="classHeapBase.html">HeapBase</a> |
| 00035 { |
| 00036 <span class="keyword">public</span>: |
| 00037 <a class="code" href="classOsclFileCache.html#a0">OsclFileCache</a>(<a class="code" href="classOscl__File.html">Oscl_File</a>& aContainer); |
| 00038 <a class="code" href="classOsclFileCache.html#a1">~OsclFileCache</a>(); |
| 00039 |
| 00040 int32 <a class="code" href="classOsclFileCache.html#a2">Open</a>(uint32 mode, uint32 cache_size); |
| 00041 |
| 00042 <span class="keywordtype">void</span> <a class="code" href="classOsclFileCache.html#a3">Close</a>(); |
| 00043 |
| 00044 uint32 <a class="code" href="classOsclFileCache.html#a4">Read</a>(<span class="keywordtype">void</span>* outputBuffer, uint32 size, uint32 numelements); |
| 00045 |
| 00046 uint32 <a class="code" href="classOsclFileCache.html#a5">Write</a>(<span class="keyword">const</span> <span class="keywordtype">void</span>* inputBuffer, uint32 size, uint32 numelements); |
| 00047 |
| <a name="l00048"></a><a class="code" href="classOsclFileCache.html#a6">00048</a> <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclFileCache.html#a6">FileSize</a>() |
| 00049 { |
| 00050 <span class="keywordflow">return</span> _fileSize; |
| 00051 } |
| 00052 |
| 00053 int32 <a class="code" href="classOsclFileCache.html#a7">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); |
| 00054 |
| <a name="l00055"></a><a class="code" href="classOsclFileCache.html#a8">00055</a> <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> <a class="code" href="classOsclFileCache.html#a8">Tell</a>() |
| 00056 { |
| 00057 <span class="keywordflow">return</span> (_cacheFilePosition + _currentCachePos); |
| 00058 } |
| 00059 |
| 00060 int32 <a class="code" href="classOsclFileCache.html#a9">Flush</a>(); |
| 00061 |
| <a name="l00062"></a><a class="code" href="classOsclFileCache.html#a10">00062</a> int32 <a class="code" href="classOsclFileCache.html#a10">EndOfFile</a>() |
| 00063 { |
| 00064 <span class="keywordflow">return</span> (<a class="code" href="classOsclFileCache.html#a8">Tell</a>() == <a class="code" href="classOsclFileCache.html#a6">FileSize</a>()) ? 1 : 0; |
| 00065 } |
| 00066 |
| 00067 <span class="keyword">private</span>: |
| 00068 <a class="code" href="classOscl__File.html">Oscl_File</a>& iContainer; |
| 00069 |
| 00070 <span class="comment">//file mode from the Open call.</span> |
| 00071 uint32 _mode; |
| 00072 |
| 00073 <span class="comment">//Size of the cache buffer, set by the Open call.</span> |
| 00074 uint32 _cacheSize; |
| 00075 |
| 00076 <span class="comment">//constant pointer to cache buffer</span> |
| 00077 uint8* _pCacheBufferStart; |
| 00078 |
| 00079 <span class="comment">//the native file position corresponding to the start of the</span> |
| 00080 <span class="comment">//cache</span> |
| 00081 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _cacheFilePosition; |
| 00082 |
| 00083 <span class="comment">//current working position (virtual file pointer) in the cache.</span> |
| 00084 <span class="comment">//units: 0-based byte offset from beginning of cache</span> |
| 00085 uint32 _currentCachePos; |
| 00086 |
| 00087 <span class="comment">//end of valid data in the cache.</span> |
| 00088 <span class="comment">//units: 0-based byte offset from beginning of cache</span> |
| 00089 uint32 _endCachePos; |
| 00090 |
| 00091 <span class="comment">//variables to track the range of data in the cache that</span> |
| 00092 <span class="comment">//has been updated by write operations, but has not yet</span> |
| 00093 <span class="comment">//been written to disk.</span> |
| 00094 <span class="comment">//units: 0-based byte offset from beginning of cache</span> |
| 00095 uint32 _cacheUpdateStart; |
| 00096 uint32 _cacheUpdateEnd; |
| 00097 |
| 00098 <span class="comment">//Current file size. This is a virtual file size and</span> |
| 00099 <span class="comment">//may not match the native file size when there is</span> |
| 00100 <span class="comment">//cached data.</span> |
| 00101 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _fileSize; |
| 00102 |
| 00103 <span class="comment">//Current true native file position.</span> |
| 00104 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _nativePosition; |
| 00105 |
| 00106 int32 SetCachePosition(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> pos); |
| 00107 int32 FillCacheFromFile(); |
| 00108 int32 WriteCacheToFile(); |
| 00109 |
| 00110 <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger; |
| 00111 }; |
| 00112 |
| 00113 |
| 00114 <span class="preprocessor">#endif // OSCL_FILE_CACHE_H_INCLUDED</span> |
| 00115 <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> |