From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/big__file_8h-source.html | 204 ++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 docs/doxygen/nel/big__file_8h-source.html (limited to 'docs/doxygen/nel/big__file_8h-source.html') diff --git a/docs/doxygen/nel/big__file_8h-source.html b/docs/doxygen/nel/big__file_8h-source.html new file mode 100644 index 00000000..36c8c7d9 --- /dev/null +++ b/docs/doxygen/nel/big__file_8h-source.html @@ -0,0 +1,204 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

big_file.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000, 2002 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_BIG_FILE_H
+00027 #define NL_BIG_FILE_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/tds.h"
+00031 
+00032 
+00033 namespace NLMISC {
+00034 
+00042 const uint32 BF_ALWAYS_OPENED           =       0x00000001;
+00043 const uint32 BF_CACHE_FILE_ON_OPEN      =       0x00000002;
+00044 
+00045 // ***************************************************************************
+00046 class CBigFile
+00047 {
+00048 
+00049 public:
+00050 
+00051         // Retrieve the global instance
+00052         static CBigFile &getInstance ();
+00053 
+00054         // Add a big file to the manager
+00055         bool add (const std::string &sBigFileName, uint32 nOptions);
+00056 
+00057         // Remove a big file from the manager
+00058         void remove (const std::string &sBigFileName);
+00059 
+00060         // true if a bigFile is added
+00061         bool isBigFileAdded(const std::string &sBigFileName);
+00062 
+00063         // List all files in a bigfile
+00064         void list (const std::string &sBigFileName, std::vector<std::string> &vAllFiles);
+00065 
+00066         // Remove all big files added
+00067         void removeAll ();
+00068 
+00069         // Used by CIFile to get information about the files within the big file
+00070         FILE* getFile (const std::string &sFileName, uint32 &rFileSize, uint32 &rBigFileOffset, 
+00071                                         bool &rCacheFileOnOpen, bool &rAlwaysOpened);
+00072 
+00073 // ***************
+00074 private:
+00075         class   CThreadFileArray;
+00076         friend class    CThreadFileArray;
+00077 
+00078         // A ptr to a file.
+00079         struct  CHandleFile
+00080         {
+00081                 FILE            *File;
+00082                 CHandleFile()
+00083                 {
+00084                         File= NULL;
+00085                 }
+00086         };
+00087 
+00088         // A class which return a FILE * handle per Thread.
+00089         class   CThreadFileArray
+00090         {
+00091         public:
+00092                 CThreadFileArray();
+00093 
+00094                 // Allocate a FileId for a BNP.
+00095                 uint32                  allocate();
+00096                 // Given a BNP File Id, return its FILE* handle for the current thread.
+00097                 CHandleFile             &get(uint32 index);
+00098 
+00099         private:
+00100                 // Do it this way because a few limited TDS is possible (64 on NT4)
+00101                 CTDS            _TDS;
+00102                 // The array is grow only!!
+00103                 uint32          _CurrentId;
+00104         };
+00105 
+00106         // A BNPFile header
+00107         struct BNPFile
+00108         {
+00109                 uint32          Size;
+00110                 uint32          Pos;
+00111         };
+00112 
+00113         // A BNP structure
+00114         struct BNP
+00115         {
+00116                 // FileName of the BNP. important to open it in getFile() (for other threads or if not always opened).
+00117                 std::string                                             BigFileName;
+00118                 // map of files in the BNP.
+00119                 std::map<std::string, BNPFile>  Files;
+00120                 // Since many seek may be done on a FILE*, each thread should have its own FILE opened.
+00121                 uint32                                                  ThreadFileId;
+00122                 bool                                                    CacheFileOnOpen;
+00123                 bool                                                    AlwaysOpened;
+00124         };
+00125 private:
+00126 
+00127         CBigFile(); // Singleton mode -> access it with the getInstance function
+00128 
+00129         static CBigFile                         *_Singleton;
+00130 
+00131         // This is an array of CHandleFile, unique to each thread
+00132         CThreadFileArray                        _ThreadFileArray;
+00133 
+00134         std::map<std::string, BNP> _BNPs;
+00135 };
+00136 
+00137 } // NLMISC
+00138 
+00139 
+00140 #endif // NL_BIG_FILE_H
+00141 
+00142 /* End of big_file.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1