diff options
Diffstat (limited to 'docs/doxygen/nel/a02261.html')
-rw-r--r-- | docs/doxygen/nel/a02261.html | 791 |
1 files changed, 791 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02261.html b/docs/doxygen/nel/a02261.html new file mode 100644 index 00000000..c09dd0e9 --- /dev/null +++ b/docs/doxygen/nel/a02261.html @@ -0,0 +1,791 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CBigFile class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CBigFile Class Reference</h1><code>#include <<a class="el" href="a05481.html">big_file.h</a>></code> +<p> +<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea0">add</a> (const std::string &sBigFileName, <a class="el" href="a04558.html#a11">uint32</a> nOptions)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>FILE * </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea1">getFile</a> (const std::string &sFileName, <a class="el" href="a04558.html#a11">uint32</a> &rFileSize, <a class="el" href="a04558.html#a11">uint32</a> &rBigFileOffset, bool &rCacheFileOnOpen, bool &rAlwaysOpened)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea2">getFileNamePtr</a> (const std::string &sFileName, const std::string &sBigFileName)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea3">isBigFileAdded</a> (const std::string &sBigFileName)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea4">list</a> (const std::string &sBigFileName, std::vector< std::string > &vAllFiles)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea5">remove</a> (const std::string &sBigFileName)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilea6">removeAll</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02261.html">CBigFile</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilee0">getInstance</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFiled0">CBigFile</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::map< std::string, <a class="el" href="a02262.html">BNP</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02266.html">CThreadFileArray</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFiler1">_ThreadFileArray</a></td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02261.html">CBigFile</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilev0">_Singleton</a> = NULL</td></tr> + +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>class </td><td class="memItemRight" valign=bottom><a class="el" href="a02261.html#NLMISC_1_1CBigFilen0">CThreadFileArray</a></td></tr> + +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBigFiled0" doxytag="NLMISC::CBigFile::CBigFile" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBigFile::CBigFile </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00071">71</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +Referenced by <a class="el" href="a05480.html#l00076">getInstance()</a>. +<p> +<div class="fragment"><pre>00072 { +00073 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBigFilea0" doxytag="NLMISC::CBigFile::add" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBigFile::add </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>sBigFileName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname" nowrap> <em>nOptions</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00086">86</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, <a class="el" href="a05481.html#l00151">_ThreadFileArray</a>, <a class="el" href="a05480.html#l00045">NLMISC::CBigFile::CThreadFileArray::allocate()</a>, <a class="el" href="a05481.html#l00137">NLMISC::CBigFile::BNP::AlwaysOpened</a>, <a class="el" href="a05481.html#l00042">NLMISC::BF_ALWAYS_OPENED</a>, <a class="el" href="a05481.html#l00043">NLMISC::BF_CACHE_FILE_ON_OPEN</a>, <a class="el" href="a05481.html#l00130">NLMISC::CBigFile::BNP::BigFileName</a>, <a class="el" href="a05481.html#l00136">NLMISC::CBigFile::BNP::CacheFileOnOpen</a>, <a class="el" href="a05481.html#l00084">NLMISC::CBigFile::CHandleFile::File</a>, <a class="el" href="a05481.html#l00132">NLMISC::CBigFile::BNP::FileNames</a>, <a class="el" href="a05481.html#l00133">NLMISC::CBigFile::BNP::Files</a>, <a class="el" href="a05480.html#l00050">NLMISC::CBigFile::CThreadFileArray::get()</a>, <a class="el" href="a05586.html#l00903">NLMISC::nlfseek64()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05481.html#l00114">NLMISC::CBigFile::BNPFile::Pos</a>, <a class="el" href="a05481.html#l00113">NLMISC::CBigFile::BNPFile::Size</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05481.html#l00135">NLMISC::CBigFile::BNP::ThreadFileId</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00087 { +00088 BNP bnpTmp; +00089 +00090 bnpTmp.BigFileName= sBigFileName; +00091 +00092 <span class="comment">// Is already the same bigfile name ?</span> +00093 string bigfilenamealone = CFile::getFilename (sBigFileName); +00094 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find(bigfilenamealone) != <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00095 { +00096 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"CBigFile::add : bigfile %s already added."</span>, bigfilenamealone.c_str()); +00097 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00098 } +00099 +00100 <span class="comment">// Allocate a new ThreadSafe FileId for this bnp.</span> +00101 bnpTmp.ThreadFileId= <a class="code" href="a02261.html#NLMISC_1_1CBigFiler1">_ThreadFileArray</a>.<a class="code" href="a02266.html#NLMISC_1_1CBigFile_1_1CThreadFileArraya0">allocate</a>(); +00102 +00103 <span class="comment">// Get a ThreadSafe handle on the file</span> +00104 CHandleFile &handle= <a class="code" href="a02261.html#NLMISC_1_1CBigFiler1">_ThreadFileArray</a>.<a class="code" href="a02266.html#NLMISC_1_1CBigFile_1_1CThreadFileArraya2">get</a>(bnpTmp.ThreadFileId); +00105 <span class="comment">// Open the big file.</span> +00106 handle.File = fopen (sBigFileName.c_str(), <span class="stringliteral">"rb"</span>); +00107 <span class="keywordflow">if</span> (handle.File == NULL) +00108 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00109 <a class="code" href="a04558.html#a11">uint32</a> nFileSize=CFile::getFileSize (handle.File); +00110 <span class="comment">//nlfseek64 (handle.File, 0, SEEK_END);</span> +00111 <span class="comment">//uint32 nFileSize = ftell (handle.File);</span> +00112 +00113 <span class="comment">// Result</span> +00114 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a284">nlfseek64</a> (handle.File, nFileSize-4, SEEK_SET) != 0) +00115 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00116 +00117 <a class="code" href="a04558.html#a11">uint32</a> nOffsetFromBegining; +00118 <span class="keywordflow">if</span> (fread (&nOffsetFromBegining, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a11">uint32</a>), 1, handle.File) != 1) +00119 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00120 +00121 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a284">nlfseek64</a> (handle.File, nOffsetFromBegining, SEEK_SET) != 0) +00122 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00123 +00124 <span class="comment">// Read the file count</span> +00125 <a class="code" href="a04558.html#a11">uint32</a> nNbFile; +00126 <span class="keywordflow">if</span> (fread (&nNbFile, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a11">uint32</a>), 1, handle.File) != 1) +00127 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00128 map<string,BNPFile> tempMap; +00129 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < nNbFile; ++i) +00130 { +00131 <span class="keywordtype">char</span> FileName[256]; +00132 <a class="code" href="a04558.html#a7">uint8</a> nStringSize; +00133 <span class="keywordflow">if</span> (fread (&nStringSize, 1, 1, handle.File) != 1) +00134 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00135 +00136 <span class="keywordflow">if</span> (fread (FileName, 1, nStringSize, handle.File) != nStringSize) +00137 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00138 +00139 FileName[nStringSize] = 0; +00140 <a class="code" href="a04558.html#a11">uint32</a> nFileSize2; +00141 <span class="keywordflow">if</span> (fread (&nFileSize2, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a11">uint32</a>), 1, handle.File) != 1) +00142 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00143 +00144 <a class="code" href="a04558.html#a11">uint32</a> nFilePos; +00145 <span class="keywordflow">if</span> (fread (&nFilePos, <span class="keyword">sizeof</span>(<a class="code" href="a04558.html#a11">uint32</a>), 1, handle.File) != 1) +00146 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00147 +00148 BNPFile bnpfTmp; +00149 bnpfTmp.Pos = nFilePos; +00150 bnpfTmp.Size = nFileSize2; +00151 tempMap.insert (make_pair(<a class="code" href="a05378.html#a273">strlwr</a>(string(FileName)), bnpfTmp)); +00152 } +00153 +00154 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a284">nlfseek64</a> (handle.File, 0, SEEK_SET) != 0) +00155 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00156 +00157 <span class="comment">// Convert temp map</span> +00158 <span class="keywordflow">if</span> (nNbFile > 0) +00159 { +00160 <a class="code" href="a04558.html#a15">uint</a> nSize = 0, nNb = 0; +00161 map<string,BNPFile>::iterator it = tempMap.begin(); +00162 <span class="keywordflow">while</span> (it != tempMap.end()) +00163 { +00164 nSize += it->first.size() + 1; +00165 nNb++; +00166 it++; +00167 } +00168 +00169 bnpTmp.FileNames = <span class="keyword">new</span> <span class="keywordtype">char</span>[nSize]; +00170 memset(bnpTmp.FileNames, 0, nSize); +00171 bnpTmp.Files.resize(nNb); +00172 +00173 it = tempMap.begin(); +00174 nSize = 0; +00175 nNb = 0; +00176 <span class="keywordflow">while</span> (it != tempMap.end()) +00177 { +00178 strcpy(bnpTmp.FileNames+nSize, it->first.c_str()); +00179 +00180 bnpTmp.Files[nNb].Name = bnpTmp.FileNames+nSize; +00181 bnpTmp.Files[nNb].Size = it->second.Size; +00182 bnpTmp.Files[nNb].Pos = it->second.Pos; +00183 +00184 nSize += it->first.size() + 1; +00185 nNb++; +00186 it++; +00187 } +00188 } +00189 <span class="comment">// End of temp map conversion</span> +00190 +00191 <span class="keywordflow">if</span> (nOptions&<a class="code" href="a05378.html#a39">BF_CACHE_FILE_ON_OPEN</a>) +00192 bnpTmp.CacheFileOnOpen = <span class="keyword">true</span>; +00193 <span class="keywordflow">else</span> +00194 bnpTmp.CacheFileOnOpen = <span class="keyword">false</span>; +00195 +00196 <span class="keywordflow">if</span> (!(nOptions&<a class="code" href="a05378.html#a38">BF_ALWAYS_OPENED</a>)) +00197 { +00198 fclose (handle.File); +00199 handle.File = NULL; +00200 bnpTmp.AlwaysOpened = <span class="keyword">false</span>; +00201 } +00202 <span class="keywordflow">else</span> +00203 { +00204 bnpTmp.AlwaysOpened = <span class="keyword">true</span>; +00205 } +00206 +00207 <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.insert (make_pair(<a class="code" href="a05378.html#a273">strlwr</a>(bigfilenamealone), bnpTmp)); +00208 +00209 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00210 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea1" doxytag="NLMISC::CBigFile::getFile" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> FILE * NLMISC::CBigFile::getFile </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>sFileName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>rFileSize</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a> & </td> + <td class="mdname" nowrap> <em>rBigFileOffset</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>rCacheFileOnOpen</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>rAlwaysOpened</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00273">273</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, <a class="el" href="a05481.html#l00151">_ThreadFileArray</a>, <a class="el" href="a05481.html#l00137">NLMISC::CBigFile::BNP::AlwaysOpened</a>, <a class="el" href="a05481.html#l00130">NLMISC::CBigFile::BNP::BigFileName</a>, <a class="el" href="a05481.html#l00136">NLMISC::CBigFile::BNP::CacheFileOnOpen</a>, <a class="el" href="a05481.html#l00084">NLMISC::CBigFile::CHandleFile::File</a>, <a class="el" href="a05481.html#l00133">NLMISC::CBigFile::BNP::Files</a>, <a class="el" href="a05480.html#l00050">NLMISC::CBigFile::CThreadFileArray::get()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05481.html#l00114">NLMISC::CBigFile::BNPFile::Pos</a>, <a class="el" href="a05481.html#l00113">NLMISC::CBigFile::BNPFile::Size</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05481.html#l00135">NLMISC::CBigFile::BNP::ThreadFileId</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00275 { +00276 string zeFileName, zeBigFileName, lwrFileName = <a class="code" href="a05378.html#a273">strlwr</a> (sFileName); +00277 <a class="code" href="a04558.html#a11">uint32</a> i, nPos = sFileName.find (<span class="charliteral">'@'</span>); +00278 <span class="keywordflow">if</span> (nPos == string::npos) +00279 { +00280 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"BF: Couldn't load '%s'"</span>, sFileName.c_str()); +00281 <span class="keywordflow">return</span> NULL; +00282 } +00283 +00284 <span class="keywordflow">for</span> (i = 0; i < nPos; ++i) +00285 zeBigFileName += lwrFileName[i]; +00286 ++i; <span class="comment">// Skip @</span> +00287 <span class="keywordflow">for</span> (; i < lwrFileName.size(); ++i) +00288 zeFileName += lwrFileName[i]; +00289 +00290 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (zeBigFileName) == <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00291 { +00292 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"BF: Couldn't load '%s'"</span>, sFileName.c_str()); +00293 <span class="keywordflow">return</span> NULL; +00294 } +00295 +00296 BNP &rbnp = <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (zeBigFileName)->second; +00297 <span class="keywordflow">if</span> (rbnp.Files.size() == 0) +00298 { +00299 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"BF: Couldn't load '%s'"</span>, sFileName.c_str()); +00300 <span class="keywordflow">return</span> NULL; +00301 } +00302 +00303 vector<BNPFile>::iterator itNBPFile; +00304 itNBPFile = lower_bound(rbnp.Files.begin(), rbnp.Files.end(), zeFileName.c_str(), CBNPFileComp()); +00305 <span class="keywordflow">if</span> (itNBPFile != rbnp.Files.end()) +00306 { +00307 <span class="keywordflow">if</span> (strcmp(itNBPFile->Name, zeFileName.c_str()) != 0) +00308 { +00309 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"BF: Couldn't load '%s'"</span>, sFileName.c_str()); +00310 <span class="keywordflow">return</span> NULL; +00311 } +00312 } +00313 <span class="keywordflow">else</span> +00314 { +00315 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"BF: Couldn't load '%s'"</span>, sFileName.c_str()); +00316 <span class="keywordflow">return</span> NULL; +00317 } +00318 +00319 BNPFile &rbnpfile = *itNBPFile; +00320 +00321 <span class="comment">// Get a ThreadSafe handle on the file</span> +00322 CHandleFile &handle= <a class="code" href="a02261.html#NLMISC_1_1CBigFiler1">_ThreadFileArray</a>.<a class="code" href="a02266.html#NLMISC_1_1CBigFile_1_1CThreadFileArraya2">get</a>(rbnp.ThreadFileId); +00323 <span class="comment">/* If not opened, open it now. There is 2 reason for it to be not opened: </span> +00324 <span class="comment"> rbnp.AlwaysOpened==false, or it is a new thread which use it for the first time.</span> +00325 <span class="comment"> */</span> +00326 <span class="keywordflow">if</span>(handle.File== NULL) +00327 { +00328 handle.File = fopen (rbnp.BigFileName.c_str(), <span class="stringliteral">"rb"</span>); +00329 <span class="keywordflow">if</span> (handle.File == NULL) +00330 <span class="keywordflow">return</span> NULL; +00331 } +00332 +00333 rCacheFileOnOpen = rbnp.CacheFileOnOpen; +00334 rAlwaysOpened = rbnp.AlwaysOpened; +00335 rBigFileOffset = rbnpfile.Pos; +00336 rFileSize = rbnpfile.Size; +00337 <span class="keywordflow">return</span> handle.File; +00338 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea2" doxytag="NLMISC::CBigFile::getFileNamePtr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> char * NLMISC::CBigFile::getFileNamePtr </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>sFileName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::string & </td> + <td class="mdname" nowrap> <em>sBigFileName</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00341">341</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, <a class="el" href="a05481.html#l00133">NLMISC::CBigFile::BNP::Files</a>, and <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>. +<p> +<div class="fragment"><pre>00342 { +00343 string bigfilenamealone = CFile::getFilename (sBigFileName); +00344 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find(bigfilenamealone) != <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00345 { +00346 BNP &rbnp = <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (bigfilenamealone)->second; +00347 vector<BNPFile>::iterator itNBPFile; +00348 <span class="keywordflow">if</span> (rbnp.Files.size() == 0) +00349 <span class="keywordflow">return</span> NULL; +00350 string lwrFileName = <a class="code" href="a05378.html#a273">strlwr</a> (sFileName); +00351 itNBPFile = lower_bound(rbnp.Files.begin(), rbnp.Files.end(), lwrFileName.c_str(), CBNPFileComp()); +00352 <span class="keywordflow">if</span> (itNBPFile != rbnp.Files.end()) +00353 { +00354 <span class="keywordflow">if</span> (strcmp(itNBPFile->Name, lwrFileName.c_str()) == 0) +00355 { +00356 <span class="keywordflow">return</span> itNBPFile->Name; +00357 } +00358 } +00359 } +00360 +00361 <span class="keywordflow">return</span> NULL; +00362 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilee0" doxytag="NLMISC::CBigFile::getInstance" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02261.html">CBigFile</a> & NLMISC::CBigFile::getInstance </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00076">76</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05480.html#l00071">CBigFile()</a>. +<p> +<div class="fragment"><pre>00077 { +00078 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFilev0">_Singleton</a> == NULL) +00079 { +00080 <a class="code" href="a02261.html#NLMISC_1_1CBigFilev0">_Singleton</a> = <span class="keyword">new</span> <a class="code" href="a02261.html#NLMISC_1_1CBigFiled0">CBigFile</a>(); +00081 } +00082 <span class="keywordflow">return</span> *<a class="code" href="a02261.html#NLMISC_1_1CBigFilev0">_Singleton</a>; +00083 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea3" doxytag="NLMISC::CBigFile::isBigFileAdded" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBigFile::isBigFileAdded </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>sBigFileName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00240">240</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>. +<p> +<div class="fragment"><pre>00241 { +00242 <span class="comment">// Is already the same bigfile name ?</span> +00243 string bigfilenamealone = CFile::getFilename (sBigFileName); +00244 <span class="keywordflow">return</span> <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find(bigfilenamealone) != <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end(); +00245 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea4" doxytag="NLMISC::CBigFile::list" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBigFile::list </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>sBigFileName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< std::string > & </td> + <td class="mdname" nowrap> <em>vAllFiles</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00248">248</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, <a class="el" href="a05481.html#l00133">NLMISC::CBigFile::BNP::Files</a>, and <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>. +<p> +<div class="fragment"><pre>00249 { +00250 string lwrFileName = <a class="code" href="a05378.html#a273">strlwr</a> (sBigFileName); +00251 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (lwrFileName) == <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00252 <span class="keywordflow">return</span>; +00253 vAllFiles.clear (); +00254 BNP &rbnp = <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (lwrFileName)->second; +00255 vector<BNPFile>::iterator it = rbnp.Files.begin(); +00256 <span class="keywordflow">while</span> (it != rbnp.Files.end()) +00257 { +00258 vAllFiles.push_back (string(it->Name)); <span class="comment">// Add the name of the file to the return vector</span> +00259 ++it; +00260 } +00261 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea5" doxytag="NLMISC::CBigFile::remove" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBigFile::remove </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>sBigFileName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00213">213</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, <a class="el" href="a05481.html#l00151">_ThreadFileArray</a>, <a class="el" href="a05481.html#l00084">NLMISC::CBigFile::CHandleFile::File</a>, <a class="el" href="a05481.html#l00132">NLMISC::CBigFile::BNP::FileNames</a>, <a class="el" href="a05480.html#l00050">NLMISC::CBigFile::CThreadFileArray::get()</a>, and <a class="el" href="a05481.html#l00135">NLMISC::CBigFile::BNP::ThreadFileId</a>. +<p> +Referenced by <a class="el" href="a05480.html#l00264">removeAll()</a>. +<p> +<div class="fragment"><pre>00214 { +00215 <span class="keywordflow">if</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (sBigFileName) != <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00216 { +00217 map<string, BNP>::iterator it = <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.find (sBigFileName); +00218 BNP &rbnp = it->second; +00219 <span class="comment">/* \todo yoyo: THERE is a MAJOR drawback here: Only the FILE * of the current (surely main) thread</span> +00220 <span class="comment"> is closed. other FILE* in other threads are still opened. This is not a big issue (system close the FILE* </span> +00221 <span class="comment"> at the end of the process) and this is important so AsyncLoading of a currentTask can end up correclty </span> +00222 <span class="comment"> (without an intermediate fclose()).</span> +00223 <span class="comment"> */</span> +00224 <span class="comment">// Get a ThreadSafe handle on the file</span> +00225 CHandleFile &handle= <a class="code" href="a02261.html#NLMISC_1_1CBigFiler1">_ThreadFileArray</a>.<a class="code" href="a02266.html#NLMISC_1_1CBigFile_1_1CThreadFileArraya2">get</a>(rbnp.ThreadFileId); +00226 <span class="comment">// close it if needed</span> +00227 <span class="keywordflow">if</span> (handle.File != NULL) +00228 { +00229 fclose (handle.File); +00230 handle.File= NULL; +00231 } +00232 <span class="comment">/* \todo trap : can make the CPath crash. CPath must be informed that the files in bigfiles have been removed</span> +00233 <span class="comment"> this is because CPath use memory of CBigFile if it runs in memoryCompressed mode */</span> +00234 <span class="keyword">delete</span> [] rbnp.FileNames; +00235 <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.erase (it); +00236 } +00237 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilea6" doxytag="NLMISC::CBigFile::removeAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBigFile::removeAll </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00264">264</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. +<p> +References <a class="el" href="a05481.html#l00153">_BNPs</a>, and <a class="el" href="a05480.html#l00213">remove()</a>. +<p> +<div class="fragment"><pre>00265 { +00266 <span class="keywordflow">while</span> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.begin() != <a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.end()) +00267 { +00268 <a class="code" href="a02261.html#NLMISC_1_1CBigFilea5">remove</a> (<a class="code" href="a02261.html#NLMISC_1_1CBigFiler0">_BNPs</a>.begin()->first); +00269 } +00270 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBigFilen0" doxytag="NLMISC::CBigFile::CThreadFileArray" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend class <a class="el" href="a02266.html">CThreadFileArray</a><code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05481.html#l00079">79</a> of file <a class="el" href="a05481.html">big_file.h</a>. </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBigFiler0" doxytag="NLMISC::CBigFile::_BNPs" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::map<std::string, <a class="el" href="a02262.html">BNP</a>> <a class="el" href="a02261.html#NLMISC_1_1CBigFiler0">NLMISC::CBigFile::_BNPs</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05481.html#l00153">153</a> of file <a class="el" href="a05481.html">big_file.h</a>. +<p> +Referenced by <a class="el" href="a05480.html#l00086">add()</a>, <a class="el" href="a05480.html#l00273">getFile()</a>, <a class="el" href="a05480.html#l00341">getFileNamePtr()</a>, <a class="el" href="a05480.html#l00240">isBigFileAdded()</a>, <a class="el" href="a05480.html#l00248">list()</a>, <a class="el" href="a05480.html#l00213">remove()</a>, and <a class="el" href="a05480.html#l00264">removeAll()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFilev0" doxytag="NLMISC::CBigFile::_Singleton" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02261.html">CBigFile</a> * <a class="el" href="a02261.html#NLMISC_1_1CBigFilev0">NLMISC::CBigFile::_Singleton</a> = NULL<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05480.html#l00036">36</a> of file <a class="el" href="a05480.html">big_file.cpp</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBigFiler1" doxytag="NLMISC::CBigFile::_ThreadFileArray" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02266.html">CThreadFileArray</a> <a class="el" href="a02261.html#NLMISC_1_1CBigFiler1">NLMISC::CBigFile::_ThreadFileArray</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05481.html#l00151">151</a> of file <a class="el" href="a05481.html">big_file.h</a>. +<p> +Referenced by <a class="el" href="a05480.html#l00086">add()</a>, <a class="el" href="a05480.html#l00273">getFile()</a>, and <a class="el" href="a05480.html#l00213">remove()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05481.html">big_file.h</a><li><a class="el" href="a05480.html">big_file.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:02:12 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |