29 #ifndef OGR_PROJ_P_H_INCLUDED
30 #define OGR_PROJ_P_H_INCLUDED
34 #include "cpl_mem_cache.h"
36 #include <unordered_map>
42 PJ_CONTEXT* OSRGetProjTLSContext();
43 void OSRCleanupTLSContext();
50 bool bUseNonDeprecated_;
53 EPSGCacheKey(
int nCode,
bool bUseNonDeprecated,
bool bAddTOWGS84):
54 nCode_(nCode), bUseNonDeprecated_(bUseNonDeprecated), bAddTOWGS84_(bAddTOWGS84) {}
56 bool operator==(
const EPSGCacheKey& other)
const
58 return nCode_ == other.nCode_ &&
59 bUseNonDeprecated_ == other.bUseNonDeprecated_ &&
60 bAddTOWGS84_ == other.bAddTOWGS84_;
63 struct EPSGCacheKeyHasher
65 std::size_t operator()(
const EPSGCacheKey& k)
const
68 ((k.bUseNonDeprecated_ ? 1 : 0) << 16) |
69 ((k.bAddTOWGS84_ ? 1 : 0) << 17);
73 lru11::Cache<EPSGCacheKey, std::shared_ptr<PJ>,
77 typename std::list<lru11::KeyValuePair<EPSGCacheKey,
78 std::shared_ptr<PJ>>>::iterator,
79 EPSGCacheKeyHasher>> m_oCacheEPSG{};
80 lru11::Cache<std::string, std::shared_ptr<PJ>> m_oCacheWKT{};
83 OSRProjTLSCache() =
default;
87 PJ* GetPJForEPSGCode(
int nCode,
bool bUseNonDeprecated,
bool bAddTOWGS84);
88 void CachePJForEPSGCode(
int nCode,
bool bUseNonDeprecated,
bool bAddTOWGS84, PJ* pj);
90 PJ* GetPJForWKT(
const std::string& wkt);
91 void CachePJForWKT(
const std::string& wkt, PJ* pj);
94 OSRProjTLSCache* OSRGetProjTLSCache();
96 void OGRCTDumpStatistics();
98 void OSRCTCleanCache();