Set the cache object used by this reader
| 1186 | |
| 1187 | // Set the cache object used by this reader |
| 1188 | void Timeline::SetCache(CacheBase* new_cache) { |
| 1189 | // Get lock (prevent getting frames while this happens) |
| 1190 | const std::lock_guard<std::recursive_mutex> lock(getFrameMutex); |
| 1191 | |
| 1192 | // Destroy previous cache (if managed by timeline) |
| 1193 | if (managed_cache && final_cache) { |
| 1194 | delete final_cache; |
| 1195 | final_cache = NULL; |
| 1196 | managed_cache = false; |
| 1197 | } |
| 1198 | |
| 1199 | // Set new cache |
| 1200 | final_cache = new_cache; |
| 1201 | } |
| 1202 | |
| 1203 | // Generate JSON string of this object |
| 1204 | std::string Timeline::Json() const { |