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_cache.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_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> 1000002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1100003 1200004 <span class="comment">// O S C L _ F I L E _ C A C H E</span> 1300005 1400006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1500007 1600019 <span class="preprocessor">#ifndef OSCL_FILE_CACHE_H_INCLUDED</span> 1700020 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_FILE_CACHE_H_INCLUDED</span> 1800021 <span class="preprocessor"></span> 1900022 <span class="preprocessor">#ifndef OSCLCONFIG_IO_H_INCLUDED</span> 2000023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__io_8h.html">osclconfig_io.h</a>"</span> 2100024 <span class="preprocessor">#endif</span> 2200025 <span class="preprocessor"></span> 2300026 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span> 2400027 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 2500028 <span class="preprocessor">#endif</span> 2600029 <span class="preprocessor"></span> 2700030 <span class="preprocessor">#include "<a class="code" href="oscl__file__io_8h.html">oscl_file_io.h</a>"</span> 2800031 2900032 <span class="keyword">class </span><a class="code" href="classOscl__File.html">Oscl_File</a>; 3000033 31<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> 3200035 { 3300036 <span class="keyword">public</span>: 3400037 <a class="code" href="classOsclFileCache.html#a0">OsclFileCache</a>(<a class="code" href="classOscl__File.html">Oscl_File</a>& aContainer); 3500038 <a class="code" href="classOsclFileCache.html#a1">~OsclFileCache</a>(); 3600039 3700040 int32 <a class="code" href="classOsclFileCache.html#a2">Open</a>(uint32 mode, uint32 cache_size); 3800041 3900042 <span class="keywordtype">void</span> <a class="code" href="classOsclFileCache.html#a3">Close</a>(); 4000043 4100044 uint32 <a class="code" href="classOsclFileCache.html#a4">Read</a>(<span class="keywordtype">void</span>* outputBuffer, uint32 size, uint32 numelements); 4200045 4300046 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); 4400047 45<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>() 4600049 { 4700050 <span class="keywordflow">return</span> _fileSize; 4800051 } 4900052 5000053 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); 5100054 52<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>() 5300056 { 5400057 <span class="keywordflow">return</span> (_cacheFilePosition + _currentCachePos); 5500058 } 5600059 5700060 int32 <a class="code" href="classOsclFileCache.html#a9">Flush</a>(); 5800061 59<a name="l00062"></a><a class="code" href="classOsclFileCache.html#a10">00062</a> int32 <a class="code" href="classOsclFileCache.html#a10">EndOfFile</a>() 6000063 { 6100064 <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; 6200065 } 6300066 6400067 <span class="keyword">private</span>: 6500068 <a class="code" href="classOscl__File.html">Oscl_File</a>& iContainer; 6600069 6700070 <span class="comment">//file mode from the Open call.</span> 6800071 uint32 _mode; 6900072 7000073 <span class="comment">//Size of the cache buffer, set by the Open call.</span> 7100074 uint32 _cacheSize; 7200075 7300076 <span class="comment">//constant pointer to cache buffer</span> 7400077 uint8* _pCacheBufferStart; 7500078 7600079 <span class="comment">//the native file position corresponding to the start of the</span> 7700080 <span class="comment">//cache</span> 7800081 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _cacheFilePosition; 7900082 8000083 <span class="comment">//current working position (virtual file pointer) in the cache.</span> 8100084 <span class="comment">//units: 0-based byte offset from beginning of cache</span> 8200085 uint32 _currentCachePos; 8300086 8400087 <span class="comment">//end of valid data in the cache.</span> 8500088 <span class="comment">//units: 0-based byte offset from beginning of cache</span> 8600089 uint32 _endCachePos; 8700090 8800091 <span class="comment">//variables to track the range of data in the cache that</span> 8900092 <span class="comment">//has been updated by write operations, but has not yet</span> 9000093 <span class="comment">//been written to disk.</span> 9100094 <span class="comment">//units: 0-based byte offset from beginning of cache</span> 9200095 uint32 _cacheUpdateStart; 9300096 uint32 _cacheUpdateEnd; 9400097 9500098 <span class="comment">//Current file size. This is a virtual file size and</span> 9600099 <span class="comment">//may not match the native file size when there is</span> 9700100 <span class="comment">//cached data.</span> 9800101 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _fileSize; 9900102 10000103 <span class="comment">//Current true native file position.</span> 10100104 <a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> _nativePosition; 10200105 10300106 int32 SetCachePosition(<a class="code" href="osclconfig__io_8h.html#a48">TOsclFileOffset</a> pos); 10400107 int32 FillCacheFromFile(); 10500108 int32 WriteCacheToFile(); 10600109 10700110 <a class="code" href="classPVLogger.html">PVLogger</a>* iLogger; 10800111 }; 10900112 11000113 11100114 <span class="preprocessor">#endif // OSCL_FILE_CACHE_H_INCLUDED</span> 11200115 <span class="preprocessor"></span> 113</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 114<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 115</small></address> 116</body> 117</html> 118