diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-07-23 09:16:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-23 09:16:54 +0200 |
| commit | 2656c2980fbe6fd4775797f7ff7226cc320f6f59 (patch) | |
| tree | e04aab06f643cf1ecfb0bce64831f0e95936c8a1 /include | |
| parent | 15639d8f45a6a37783f18cc61cd719b059b99c8d (diff) | |
| parent | a871ada2a942624e95abc7622f9bc0d3af1f1305 (diff) | |
| download | PROJ-2656c2980fbe6fd4775797f7ff7226cc320f6f59.tar.gz PROJ-2656c2980fbe6fd4775797f7ff7226cc320f6f59.zip | |
Merge pull request #2787 from rouault/vgrid_perf_improvements
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) */ |
