Lines Matching refs:KEY
44 template<class KEY, class VALUE>
47 ClientDescriptor(const KEY& key, const VALUE& value, int32_t cost,
48 const std::set<KEY>& conflictingKeys, int32_t priority, int32_t ownerId);
49 ClientDescriptor(KEY&& key, VALUE&& value, int32_t cost, std::set<KEY>&& conflictingKeys,
57 const KEY& getKey() const;
82 bool isConflicting(const KEY& key) const;
87 std::set<KEY> getConflicting() const;
99 KEY mKey;
102 std::set<KEY> mConflicting;
112 template<class KEY, class VALUE>
113 ClientDescriptor<KEY, VALUE>::ClientDescriptor(const KEY& key, const VALUE& value, int32_t cost, in ClientDescriptor()
114 const std::set<KEY>& conflictingKeys, int32_t priority, int32_t ownerId) : mKey{key}, in ClientDescriptor()
118 template<class KEY, class VALUE>
119 ClientDescriptor<KEY, VALUE>::ClientDescriptor(KEY&& key, VALUE&& value, int32_t cost, in ClientDescriptor()
120 std::set<KEY>&& conflictingKeys, int32_t priority, int32_t ownerId) : in ClientDescriptor()
121 mKey{std::forward<KEY>(key)}, mValue{std::forward<VALUE>(value)}, mCost{cost}, in ClientDescriptor()
122 mConflicting{std::forward<std::set<KEY>>(conflictingKeys)}, mPriority{priority},
125 template<class KEY, class VALUE>
126 ClientDescriptor<KEY, VALUE>::~ClientDescriptor() {} in ~ClientDescriptor()
128 template<class KEY, class VALUE>
129 const KEY& ClientDescriptor<KEY, VALUE>::getKey() const { in getKey()
133 template<class KEY, class VALUE>
134 const VALUE& ClientDescriptor<KEY, VALUE>::getValue() const { in getValue()
138 template<class KEY, class VALUE>
139 int32_t ClientDescriptor<KEY, VALUE>::getCost() const { in getCost()
143 template<class KEY, class VALUE>
144 int32_t ClientDescriptor<KEY, VALUE>::getPriority() const { in getPriority()
148 template<class KEY, class VALUE>
149 int32_t ClientDescriptor<KEY, VALUE>::getOwnerId() const { in getOwnerId()
153 template<class KEY, class VALUE>
154 bool ClientDescriptor<KEY, VALUE>::isConflicting(const KEY& key) const { in isConflicting()
162 template<class KEY, class VALUE>
163 std::set<KEY> ClientDescriptor<KEY, VALUE>::getConflicting() const { in getConflicting()
167 template<class KEY, class VALUE>
168 void ClientDescriptor<KEY, VALUE>::setPriority(int32_t priority) { in setPriority()
177 template<class KEY, class VALUE>
180 void onClientAdded(const ClientDescriptor<KEY, VALUE>& descriptor);
181 void onClientRemoved(const ClientDescriptor<KEY, VALUE>& descriptor);
184 template<class KEY, class VALUE>
185 void DefaultEventListener<KEY, VALUE>::onClientAdded( in onClientAdded()
186 const ClientDescriptor<KEY, VALUE>& /*descriptor*/) {} in onClientAdded() argument
188 template<class KEY, class VALUE>
189 void DefaultEventListener<KEY, VALUE>::onClientRemoved( in onClientRemoved()
190 const ClientDescriptor<KEY, VALUE>& /*descriptor*/) {} in onClientRemoved() argument
212 template<class KEY, class VALUE, class LISTENER=DefaultEventListener<KEY, VALUE>>
227 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> addAndEvict(
228 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client);
244 std::shared_ptr<ClientDescriptor<KEY, VALUE>> remove(const KEY& key);
249 void remove(const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& value);
257 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> wouldEvict(
258 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client) const;
263 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> getIncompatibleClients(
264 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client) const;
269 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> getAll() const;
274 std::vector<KEY> getAllKeys() const;
286 std::shared_ptr<ClientDescriptor<KEY, VALUE>> get(const KEY& key) const;
295 status_t waitUntilRemoved(const std::shared_ptr<ClientDescriptor<KEY, VALUE>> client,
330 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> wouldEvictLocked(
331 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client,
340 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> mClients;
344 template<class KEY, class VALUE, class LISTENER>
345 ClientManager<KEY, VALUE, LISTENER>::ClientManager() : in ClientManager()
348 template<class KEY, class VALUE, class LISTENER>
349 ClientManager<KEY, VALUE, LISTENER>::ClientManager(int32_t totalCost) : mMaxCost(totalCost) {} in ClientManager()
351 template<class KEY, class VALUE, class LISTENER>
352 ClientManager<KEY, VALUE, LISTENER>::~ClientManager() {} in ~ClientManager()
354 template<class KEY, class VALUE, class LISTENER>
355 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>>
356 ClientManager<KEY, VALUE, LISTENER>::wouldEvict( in wouldEvict()
357 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client) const { in wouldEvict() argument
362 template<class KEY, class VALUE, class LISTENER>
363 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>>
364 ClientManager<KEY, VALUE, LISTENER>::getIncompatibleClients( in getIncompatibleClients()
365 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client) const { in getIncompatibleClients() argument
370 template<class KEY, class VALUE, class LISTENER>
371 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>>
372 ClientManager<KEY, VALUE, LISTENER>::wouldEvictLocked( in wouldEvictLocked()
373 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client, in wouldEvictLocked() argument
376 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> evictList; in wouldEvictLocked()
384 const KEY& key = client->getKey(); in wouldEvictLocked()
409 const KEY& curKey = i->getKey(); in wouldEvictLocked()
463 template<class KEY, class VALUE, class LISTENER>
464 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>>
465 ClientManager<KEY, VALUE, LISTENER>::addAndEvict( in addAndEvict()
466 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& client) { in addAndEvict() argument
482 [&iter] (std::shared_ptr<ClientDescriptor<KEY, VALUE>>& curClientPtr) { in addAndEvict()
498 template<class KEY, class VALUE, class LISTENER>
499 std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>>
500 ClientManager<KEY, VALUE, LISTENER>::getAll() const { in getAll()
505 template<class KEY, class VALUE, class LISTENER>
506 std::vector<KEY> ClientManager<KEY, VALUE, LISTENER>::getAllKeys() const { in getAllKeys()
508 std::vector<KEY> keys(mClients.size()); in getAllKeys()
515 template<class KEY, class VALUE, class LISTENER>
516 std::vector<int32_t> ClientManager<KEY, VALUE, LISTENER>::getAllOwners() const { in getAllOwners()
525 template<class KEY, class VALUE, class LISTENER>
526 void ClientManager<KEY, VALUE, LISTENER>::updatePriorities( in updatePriorities()
537 template<class KEY, class VALUE, class LISTENER>
538 std::shared_ptr<ClientDescriptor<KEY, VALUE>> ClientManager<KEY, VALUE, LISTENER>::get( in get()
539 const KEY& key) const { in get()
544 return std::shared_ptr<ClientDescriptor<KEY, VALUE>>(nullptr); in get()
547 template<class KEY, class VALUE, class LISTENER>
548 void ClientManager<KEY, VALUE, LISTENER>::removeAll() { in removeAll()
559 template<class KEY, class VALUE, class LISTENER>
560 std::shared_ptr<ClientDescriptor<KEY, VALUE>> ClientManager<KEY, VALUE, LISTENER>::remove( in remove()
561 const KEY& key) { in remove()
564 std::shared_ptr<ClientDescriptor<KEY, VALUE>> ret; in remove()
568 [this, &key, &ret] (std::shared_ptr<ClientDescriptor<KEY, VALUE>>& curClientPtr) { in remove()
581 template<class KEY, class VALUE, class LISTENER>
582 status_t ClientManager<KEY, VALUE, LISTENER>::waitUntilRemoved( in waitUntilRemoved()
583 const std::shared_ptr<ClientDescriptor<KEY, VALUE>> client, in waitUntilRemoved() argument
613 template<class KEY, class VALUE, class LISTENER>
614 void ClientManager<KEY, VALUE, LISTENER>::setListener(const std::shared_ptr<LISTENER>& listener) { in setListener()
619 template<class KEY, class VALUE, class LISTENER>
620 void ClientManager<KEY, VALUE, LISTENER>::remove( in remove()
621 const std::shared_ptr<ClientDescriptor<KEY, VALUE>>& value) { in remove() argument
625 [this, &value] (std::shared_ptr<ClientDescriptor<KEY, VALUE>>& curClientPtr) { in remove()
635 template<class KEY, class VALUE, class LISTENER>
636 int64_t ClientManager<KEY, VALUE, LISTENER>::getCurrentCostLocked() const { in getCurrentCostLocked()