diff options
author | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
---|---|---|
committer | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
commit | fb1044c4e55c726753d094b66756a1cb3bc60ee8 (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /Tools/AnvilStats/Processor.h | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
parent | Changed everyting to Unix line endings. (diff) | |
download | cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.gz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.bz2 cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.lz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.xz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.zst cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.zip |
Diffstat (limited to 'Tools/AnvilStats/Processor.h')
-rw-r--r-- | Tools/AnvilStats/Processor.h | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/Tools/AnvilStats/Processor.h b/Tools/AnvilStats/Processor.h index b7d3f392e..72fea3081 100644 --- a/Tools/AnvilStats/Processor.h +++ b/Tools/AnvilStats/Processor.h @@ -1,77 +1,77 @@ -
-// Processor.h
-
-// Interfaces to the cProcessor class representing the overall processor engine that manages threads, calls callbacks etc.
-
-
-
-
-#pragma once
-
-
-
-
-
-// fwd:
-class cCallback;
-class cCallbackFactory;
-class cParsedNBT;
-
-
-
-
-
-class cProcessor
-{
- class cThread :
- public cIsThread
- {
- typedef cIsThread super;
-
- cCallback & m_Callback;
- cProcessor & m_ParentProcessor;
-
- // cIsThread override:
- virtual void Execute(void) override;
-
- void ProcessFile(const AString & a_FileName);
- void ProcessFileData(const char * a_FileData, size_t a_Size, int a_ChunkBaseX, int a_ChunkBaseZ);
- void ProcessChunk(const char * a_FileData, int a_ChunkX, int a_ChunkZ, unsigned a_SectorStart, unsigned a_SectorSize, unsigned a_TimeStamp);
- void ProcessCompressedChunkData(int a_ChunkX, int a_ChunkZ, const char * a_CompressedData, int a_CompressedSize);
- void ProcessParsedChunkData(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT);
-
- // The following processing parts return true if they were interrupted by the callback, causing the processing of current chunk to abort
- bool ProcessChunkSections(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
- bool ProcessChunkEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
- bool ProcessChunkTileEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
- bool ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag);
-
- public:
- cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor);
- } ;
-
- typedef std::vector<cThread *> cThreads;
-
-public:
- cProcessor(void);
- ~cProcessor();
-
- void ProcessWorld(const AString & a_WorldFolder, cCallbackFactory & a_CallbackFactory);
-
-protected:
- bool m_IsShuttingDown; // If true, the threads should stop ASAP
-
- cCriticalSection m_CS;
- AStringList m_FileQueue;
-
- cThreads m_Threads;
- cEvent m_ThreadsHaveStarted; // This is signalled by each thread to notify the parent thread that it can start waiting for those threads
-
- void PopulateFileQueue(const AString & a_WorldFolder);
-
- AString GetOneFileName(void);
-} ;
-
-
-
-
+ +// Processor.h + +// Interfaces to the cProcessor class representing the overall processor engine that manages threads, calls callbacks etc. + + + + +#pragma once + + + + + +// fwd: +class cCallback; +class cCallbackFactory; +class cParsedNBT; + + + + + +class cProcessor +{ + class cThread : + public cIsThread + { + typedef cIsThread super; + + cCallback & m_Callback; + cProcessor & m_ParentProcessor; + + // cIsThread override: + virtual void Execute(void) override; + + void ProcessFile(const AString & a_FileName); + void ProcessFileData(const char * a_FileData, size_t a_Size, int a_ChunkBaseX, int a_ChunkBaseZ); + void ProcessChunk(const char * a_FileData, int a_ChunkX, int a_ChunkZ, unsigned a_SectorStart, unsigned a_SectorSize, unsigned a_TimeStamp); + void ProcessCompressedChunkData(int a_ChunkX, int a_ChunkZ, const char * a_CompressedData, int a_CompressedSize); + void ProcessParsedChunkData(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT); + + // The following processing parts return true if they were interrupted by the callback, causing the processing of current chunk to abort + bool ProcessChunkSections(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag); + bool ProcessChunkEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag); + bool ProcessChunkTileEntities(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag); + bool ProcessChunkTileTicks(int a_ChunkX, int a_ChunkZ, cParsedNBT & a_NBT, int a_LevelTag); + + public: + cThread(cCallback & a_Callback, cProcessor & a_ParentProcessor); + } ; + + typedef std::vector<cThread *> cThreads; + +public: + cProcessor(void); + ~cProcessor(); + + void ProcessWorld(const AString & a_WorldFolder, cCallbackFactory & a_CallbackFactory); + +protected: + bool m_IsShuttingDown; // If true, the threads should stop ASAP + + cCriticalSection m_CS; + AStringList m_FileQueue; + + cThreads m_Threads; + cEvent m_ThreadsHaveStarted; // This is signalled by each thread to notify the parent thread that it can start waiting for those threads + + void PopulateFileQueue(const AString & a_WorldFolder); + + AString GetOneFileName(void); +} ; + + + + |