| 162 | * held). This class handles that. */ |
| 163 | |
| 164 | class FluxSourceIteratorHolder |
| 165 | { |
| 166 | public: |
| 167 | FluxSourceIteratorHolder(FluxSource& fluxSource): _fluxSource(fluxSource) {} |
| 168 | |
| 169 | FluxSourceIterator& getIterator(unsigned physicalCylinder, unsigned head) |
| 170 | { |
| 171 | auto& it = _cache[std::make_pair(physicalCylinder, head)]; |
| 172 | if (!it) |
| 173 | it = _fluxSource.readFlux(physicalCylinder, head); |
| 174 | return *it; |
| 175 | } |
| 176 | |
| 177 | private: |
| 178 | FluxSource& _fluxSource; |
| 179 | std::map<std::pair<unsigned, unsigned>, std::unique_ptr<FluxSourceIterator>> |
| 180 | _cache; |
| 181 | }; |
| 182 | |
| 183 | static nanoseconds_t getRotationalPeriodFromConfig() |
| 184 | { |