Cogs.Core
StashService.h
1#pragma once
2#include "ImageDecoder.h"
3
4#include "Foundation/Reflection/TypeDatabase.h"
5#include "Foundation/Platform/Threads.h"
6#include "Foundation/Memory/MemoryBuffer.h"
7
8#include <unordered_map>
9
10namespace Cogs::Core
11{
12 class Context;
13}
14
15namespace Cogs::Core::TerrainProvider
16{
17
18 struct Stash
19 {
21 ImageDecoder decoder;
22 void* context;
23 };
24
26 {
27 public:
28 StashService(Context* context);
30
31 Stash* getStash();
32
33 private:
34 Context* context = nullptr;
35 Cogs::Mutex mutex;
36 std::unordered_map<std::thread::id, std::unique_ptr<Stash>> stashes;
37
38 };
39
40
41}
42
43template<> inline Cogs::StringView getName<Cogs::Core::TerrainProvider::StashService>() { return "TerrainProvider::StashService"; }
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
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....