Cogs.Core
DiskCache.h
1#pragma once
2#include "Utilities/Strings.h"
3
4#include "BaseRasterSource.h"
5
6#include "Foundation/Memory/MemoryBuffer.h"
7#include "Foundation/Platform/Threads.h"
8
9namespace Cogs::Core::TerrainProvider {
10
11 struct TileId;
12
13 class DiskCache : public ICache
14 {
15 public:
16
17 virtual ~DiskCache() {}
18
19 bool init(Context* context, const BaseConfig* providerConf, StringView cachesPath);
20
21 bool getTile(Memory::MemoryBuffer& contents, MimeType& kind, const TileId& id) final;
22
23 bool storeTile(const Memory::MemoryBuffer& contents, MimeType kind, const TileId& id, StringView debugLog) final;
24
25 protected:
26 std::string rootPath;
27 MimeType mimeType = MimeType::None;
28 bool offline = true;
29 bool initialized = false;
30 };
31
32}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24