| 96 | } |
| 97 | |
| 98 | static std::shared_ptr<nvcvpy::ICacheItem> fetch(std::vector<std::shared_ptr<nvcvpy::ICacheItem>> &cache) |
| 99 | { |
| 100 | std::shared_ptr<nvcvpy::ICacheItem> retItem = cache[0]; |
| 101 | |
| 102 | long long int maxPayloadSize = 0; |
| 103 | |
| 104 | for (const auto &item : cache) |
| 105 | { |
| 106 | const Key &key = static_cast<const Key &>(item.get()->key()); |
| 107 | |
| 108 | long long int keyPayloadSize = key.payloadSize(); |
| 109 | |
| 110 | if (keyPayloadSize > maxPayloadSize) |
| 111 | { |
| 112 | maxPayloadSize = keyPayloadSize; |
| 113 | retItem = item; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | cache.clear(); |
| 118 | |
| 119 | nvcvpy::Cache::removeAllNotInUseMatching(retItem.get()->key()); |
| 120 | |
| 121 | return retItem; |
| 122 | } |
| 123 | |
| 124 | private: |
| 125 | Key m_key; |
nothing calls this directly
no test coverage detected