summaryrefslogtreecommitdiffstats
path: root/Tools/AnvilStats/Callback.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-30 19:38:21 +0200
committermadmaxoft <github@xoft.cz>2013-08-30 19:38:21 +0200
commit32bc9693390c7a2b662ec55a17b338fe68a720eb (patch)
tree7e60a380acb5cdeb1201c3f9e05e169d75b24ade /Tools/AnvilStats/Callback.h
parentAnvilStats: Ignoring the build folders (diff)
downloadcuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar.gz
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar.bz2
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar.lz
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar.xz
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.tar.zst
cuberite-32bc9693390c7a2b662ec55a17b338fe68a720eb.zip
Diffstat (limited to 'Tools/AnvilStats/Callback.h')
-rw-r--r--Tools/AnvilStats/Callback.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/Tools/AnvilStats/Callback.h b/Tools/AnvilStats/Callback.h
index 83b330651..eed51a41c 100644
--- a/Tools/AnvilStats/Callback.h
+++ b/Tools/AnvilStats/Callback.h
@@ -22,17 +22,20 @@ class cParsedNBT;
/** The base class for all chunk-processor callbacks, declares the interface.
The processor calls each virtual function in the order they are declared here with the specified args.
-If the function returns true, the processor moves on to next chunk and starts calling the callbacks again from start with
-the new chunk data.
+If the function returns true, the processor doesn't process the data item, moves on to the next chunk
+and starts calling the callbacks again from start with the new chunk data.
So if a statistics collector doesn't need data decompression at all, it can stop the processor from doing so early-enough
and still get meaningful data.
-A callback is guaranteed to run in a single thread and always the same thread.
+A callback is guaranteed to run in a single thread and always the same thread for the same chunk.
A callback is guaranteed to run on all chunks in a region and one region is guaranteed to be handled by only callback.
*/
class cCallback abstract
{
public:
virtual ~cCallback() {} // Force a virtual destructor in each descendant
+
+ /// Called when a new region file is about to be opened; by default allow the region
+ virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) { return false; }
/// Called to inform the stats module of the chunk coords for newly processing chunk
virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) = 0;
@@ -118,6 +121,9 @@ public:
int a_TicksLeft,
int a_PosX, int a_PosY, int a_PosZ
) { return true; }
+
+ /// Called after the entire region file has been processed. No more callbacks for this region will be called. No processing by default
+ virtual void OnRegionFinished(int a_RegionX, int a_RegionZ) {}
} ;
typedef std::vector<cCallback *> cCallbacks;