15 #include "../OSSupport/IsThread.h" 16 #include "../OSSupport/Queue.h" 32 class cWSSchema
abstract 35 cWSSchema(
cWorld * a_World) : m_World(a_World) {}
36 virtual ~cWSSchema() {}
38 virtual bool LoadChunk(
const cChunkCoords & a_Chunk) = 0;
39 virtual bool SaveChunk(
const cChunkCoords & a_Chunk) = 0;
40 virtual const AString GetName(
void)
const = 0;
66 void QueueLoadChunk(
int a_ChunkX,
int a_ChunkZ,
cChunkCoordCallback * a_Callback =
nullptr);
70 void QueueSaveChunk(
int a_ChunkX,
int a_ChunkZ,
cChunkCoordCallback * a_Callback =
nullptr);
73 void Initialize(
cWorld & a_World,
const AString & a_StorageSchemaName,
int a_StorageCompressionFactor);
75 void WaitForFinish(
void);
76 void WaitForLoadQueueEmpty(
void);
77 void WaitForSaveQueueEmpty(
void);
79 size_t GetLoadQueueLength(
void);
80 size_t GetSaveQueueLength(
void);
101 bool LoadChunk(
int a_ChunkX,
int a_ChunkZ);
103 void InitSchemas(
int a_StorageCompressionFactor);
105 virtual void Execute(
void)
override;
108 bool LoadOneChunk(
void);
111 bool SaveOneChunk(
void);
cWSSchema * m_SaveSchema
The one storage schema used for saving.
cWSSchemaList m_Schemas
All the storage schemas (all used for loading)
cChunkCoordsQueue m_LoadQueue
cChunkCoordsQueue m_SaveQueue
cQueue< cChunkCoordsWithCallback > cChunkCoordsQueue
cEvent m_Event
Set when there's any addition to the queues.
Interface class used as a callback for operations that involve chunk coords.
std::list< cWSSchema * > cWSSchemaList
AString m_StorageSchemaName
The actual world storage class.