Grok  10.0.3
TileCache.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2022 Grok Image Compression Inc.
3  *
4  * This source code is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License, version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This source code is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #pragma once
18 
19 #include <map>
20 
21 namespace grk
22 {
23 struct TileProcessor;
24 class GrkImage;
25 
26 #include "GrkImage.h"
27 
29 {
30  explicit TileCacheEntry(TileProcessor* p);
33 
35 };
36 
37 class TileCache
38 {
39  public:
41  TileCache(void);
42  virtual ~TileCache();
43 
44  bool empty(void);
45  void setStrategy(GRK_TILE_CACHE_STRATEGY strategy);
47  TileCacheEntry* put(uint16_t tileIndex, TileProcessor* processor);
48  TileCacheEntry* get(uint16_t tileIndex);
49  GrkImage* getComposite(void);
50  std::vector<GrkImage*> getAllImages(void);
51  std::vector<GrkImage*> getTileImages(void);
52 
53  private:
54  // each component is sub-sampled and resolution-reduced
56  std::map<uint32_t, TileCacheEntry*> cache_;
58 };
59 
60 } // namespace grk
Definition: GrkImage.h:25
Definition: TileCache.h:38
std::vector< GrkImage * > getAllImages(void)
Definition: TileCache.cpp:78
GrkImage * tileComposite
Definition: TileCache.h:55
TileCache(void)
Definition: TileCache.cpp:31
std::vector< GrkImage * > getTileImages(void)
Definition: TileCache.cpp:85
TileCacheEntry * put(uint16_t tileIndex, TileProcessor *processor)
Definition: TileCache.cpp:43
virtual ~TileCache()
Definition: TileCache.cpp:32
std::map< uint32_t, TileCacheEntry * > cache_
Definition: TileCache.h:56
GRK_TILE_CACHE_STRATEGY strategy_
Definition: TileCache.h:57
void setStrategy(GRK_TILE_CACHE_STRATEGY strategy)
Definition: TileCache.cpp:66
TileCacheEntry * get(uint16_t tileIndex)
Definition: TileCache.cpp:59
GrkImage * getComposite(void)
Definition: TileCache.cpp:74
GRK_TILE_CACHE_STRATEGY getStrategy(void)
Definition: TileCache.cpp:70
bool empty(void)
Definition: TileCache.cpp:39
enum _GRK_TILE_CACHE_STRATEGY GRK_TILE_CACHE_STRATEGY
Copyright (C) 2016-2022 Grok Image Compression Inc.
Definition: ICacheable.h:20
Definition: TileCache.h:29
TileProcessor * processor
Definition: TileCache.h:34
~TileCacheEntry()
Definition: TileCache.cpp:23
TileCacheEntry()
Definition: TileCache.cpp:22
Definition: TileProcessor.h:78