20 #ifndef GEODE_CACHEABLEKEY_H_
21 #define GEODE_CACHEABLEKEY_H_
24 #include <unordered_map>
25 #include <unordered_set>
27 #include "Serializable.hpp"
28 #include "internal/functional.hpp"
29 #include "internal/geode_globals.hpp"
47 virtual bool operator==(
const CacheableKey& other)
const = 0;
50 virtual int32_t hashcode()
const = 0;
59 static std::shared_ptr<CacheableKey> create(_T value);
62 inline static std::shared_ptr<CacheableKey> create(
63 const std::shared_ptr<_T>& value) {
68 inline std::size_t operator()(
const CacheableKey& s)
const {
72 inline std::size_t operator()(
const CacheableKey*& s)
const {
76 inline std::size_t operator()(
77 const std::shared_ptr<CacheableKey>& s)
const {
90 return (*lhs) == (*rhs);
93 inline bool operator()(
const std::shared_ptr<CacheableKey>& lhs,
94 const std::shared_ptr<CacheableKey>& rhs)
const {
95 return (*lhs) == (*rhs);
105 using apache::geode::client::internal::dereference_equal_to;
106 using apache::geode::client::internal::dereference_hash;
108 using HashMapOfCacheable =
109 std::unordered_map<std::shared_ptr<CacheableKey>,
110 std::shared_ptr<Cacheable>,
111 dereference_hash<std::shared_ptr<CacheableKey>>,
112 dereference_equal_to<std::shared_ptr<CacheableKey>>>;
114 using HashSetOfCacheableKey =
115 std::unordered_set<std::shared_ptr<CacheableKey>,
116 dereference_hash<std::shared_ptr<CacheableKey>>,
117 dereference_equal_to<std::shared_ptr<CacheableKey>>>;
126 struct hash<apache::geode::client::CacheableKey> {
128 typedef size_t result_type;
129 result_type operator()(
const argument_type& val)
const {
136 #endif // GEODE_CACHEABLEKEY_H_