| 180 | } |
| 181 | |
| 182 | std::shared_ptr<Stream> Stream::Create() |
| 183 | { |
| 184 | std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Stream::Key{}); |
| 185 | |
| 186 | // None found? |
| 187 | if (vcont.empty()) |
| 188 | { |
| 189 | std::shared_ptr<Stream> stream(new Stream()); |
| 190 | Cache::Instance().add(*stream); |
| 191 | return stream; |
| 192 | } |
| 193 | else |
| 194 | { |
| 195 | // Get the first one |
| 196 | return std::static_pointer_cast<Stream>(vcont[0]); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | Stream::Stream() |
| 201 | : m_owns(true) |