| 86 | } |
| 87 | |
| 88 | static std::shared_ptr<nvcvpy::ICacheItem> fetch(std::vector<std::shared_ptr<nvcvpy::ICacheItem>> &cache) |
| 89 | { |
| 90 | assert(!cache.empty()); |
| 91 | |
| 92 | std::shared_ptr<nvcvpy::ICacheItem> retItem = cache[0]; |
| 93 | size_t maxPayloadSize = 0; |
| 94 | |
| 95 | for (const auto &item : cache) |
| 96 | { |
| 97 | const Key &key = static_cast<const Key &>(item.get()->key()); |
| 98 | size_t keyPayloadSize = key.payloadSize(); |
| 99 | |
| 100 | if (keyPayloadSize > maxPayloadSize) |
| 101 | { |
| 102 | maxPayloadSize = keyPayloadSize; |
| 103 | retItem = item; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | cache.clear(); |
| 108 | |
| 109 | nvcvpy::Cache::removeAllNotInUseMatching(retItem.get()->key()); |
| 110 | |
| 111 | return retItem; |
| 112 | } |
| 113 | |
| 114 | private: |
| 115 | Key m_key; |
nothing calls this directly
no test coverage detected