| 50 | }; |
| 51 | |
| 52 | struct KeyCacheEntry { |
| 53 | LockZeroBuffer<BYTE>* pbuf; |
| 54 | bool valid; |
| 55 | bool accessed; |
| 56 | KeyCacheEntry() |
| 57 | { |
| 58 | pbuf = nullptr; |
| 59 | valid = false; |
| 60 | accessed = false; |
| 61 | } |
| 62 | void Clear() |
| 63 | { |
| 64 | pbuf->Clear(); |
| 65 | accessed = false; |
| 66 | valid = false; |
| 67 | } |
| 68 | ~KeyCacheEntry() |
| 69 | { |
| 70 | if (pbuf) |
| 71 | delete pbuf; |
| 72 | } |
| 73 | // disallow copying |
| 74 | KeyCacheEntry(KeyCacheEntry const&) = delete; |
| 75 | void operator=(KeyCacheEntry const&) = delete; |
| 76 | |
| 77 | // move constructor |
| 78 | KeyCacheEntry(KeyCacheEntry&& other) |
| 79 | : pbuf(nullptr) |
| 80 | , accessed(false), valid(false) |
| 81 | { |
| 82 | pbuf = other.pbuf; |
| 83 | valid = other.valid; |
| 84 | accessed = other.accessed; |
| 85 | |
| 86 | other.pbuf = nullptr; |
| 87 | other.accessed = false; |
| 88 | other.valid = false; |
| 89 | } |
| 90 | |
| 91 | // move assignment operator |
| 92 | KeyCacheEntry& operator=(KeyCacheEntry&& other) |
| 93 | { |
| 94 | if (this != &other) { |
| 95 | if (pbuf) |
| 96 | delete pbuf; |
| 97 | |
| 98 | pbuf = other.pbuf; |
| 99 | accessed = other.accessed; |
| 100 | valid = other.valid; |
| 101 | |
| 102 | other.pbuf = nullptr; |
| 103 | other.accessed = false; |
| 104 | other.valid = false; |
| 105 | } |
| 106 | |
| 107 | return *this; |
| 108 | } |
| 109 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected