Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "image_handler.hpp" |
| 4 | |
Patrick Venture | 400c636 | 2018-11-06 20:06:11 -0800 | [diff] [blame] | 5 | #include <cstdint> |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 6 | #include <memory> |
| 7 | #include <string> |
Patrick Venture | 400c636 | 2018-11-06 20:06:11 -0800 | [diff] [blame] | 8 | #include <vector> |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 9 | |
| 10 | namespace blobs |
| 11 | { |
| 12 | |
| 13 | class StaticLayoutHandler : public ImageHandlerInterface |
| 14 | { |
| 15 | public: |
| 16 | /** |
| 17 | * Create a StaticLayoutHandler. |
| 18 | */ |
Patrick Venture | a5c5906 | 2018-11-09 12:25:52 -0800 | [diff] [blame] | 19 | explicit StaticLayoutHandler(const std::string& temporaryName) : |
| 20 | stagedFilename(temporaryName){}; |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 21 | |
| 22 | bool open(const std::string& path) override; |
| 23 | |
Patrick Venture | 400c636 | 2018-11-06 20:06:11 -0800 | [diff] [blame] | 24 | bool write(std::uint32_t offset, |
| 25 | const std::vector<std::uint8_t>& data) override; |
| 26 | |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 27 | private: |
| 28 | std::string path; |
Patrick Venture | a5c5906 | 2018-11-09 12:25:52 -0800 | [diff] [blame] | 29 | |
| 30 | /** The file to use for staging the bytes. */ |
| 31 | std::string stagedFilename; |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | } // namespace blobs |