diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-07-23 10:12:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-23 10:12:53 +0200 |
| commit | d8b85102bcd1bdd3a93e0bf240b164fddb89b3c5 (patch) | |
| tree | 5d94e3f7e1c5570466d88712bd8946570616785a /include | |
| parent | 3b4f53a409492ec414bab8e3dba073cd7bc7fcf3 (diff) | |
| parent | 80dddb675276ec1cb28525e481c0c6bedb886145 (diff) | |
| download | PROJ-d8b85102bcd1bdd3a93e0bf240b164fddb89b3c5.tar.gz PROJ-d8b85102bcd1bdd3a93e0bf240b164fddb89b3c5.zip | |
Merge pull request #2788 from OSGeo/backport-2787-to-8.1
[Backport 8.1] GeoTIFF grid reading: perf improvements (fixes #2785)
Diffstat (limited to 'include')
| -rw-r--r-- | include/proj/internal/lru_cache.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/proj/internal/lru_cache.hpp b/include/proj/internal/lru_cache.hpp index b7aff6b9..b2e997b3 100644 --- a/include/proj/internal/lru_cache.hpp +++ b/include/proj/internal/lru_cache.hpp @@ -160,6 +160,21 @@ class Cache { keys_.splice(keys_.begin(), keys_, iter->second); return iter->second->value; } + + /** + * The const reference returned here is only + * guaranteed to be valid till the next insert/delete + */ + const Value* getPtr(const Key& k) { + Guard g(lock_); + const auto iter = cache_.find(k); + if (iter == cache_.end()) { + return nullptr; + } + keys_.splice(keys_.begin(), keys_, iter->second); + return &(iter->second->value); + } + /** * returns a copy of the stored object (if found) */ |
