blob: edb3df5b316f7c64e376eb84518c42c33471a322 [file] [log] [blame]
Patrick Venturea78e39f2018-11-06 18:37:06 -08001#pragma once
2
3#include "image_handler.hpp"
4
Patrick Venture400c6362018-11-06 20:06:11 -08005#include <cstdint>
Patrick Venturea78e39f2018-11-06 18:37:06 -08006#include <memory>
7#include <string>
Patrick Venture400c6362018-11-06 20:06:11 -08008#include <vector>
Patrick Venturea78e39f2018-11-06 18:37:06 -08009
10namespace blobs
11{
12
13class StaticLayoutHandler : public ImageHandlerInterface
14{
15 public:
16 /**
17 * Create a StaticLayoutHandler.
18 */
Patrick Venturea5c59062018-11-09 12:25:52 -080019 explicit StaticLayoutHandler(const std::string& temporaryName) :
20 stagedFilename(temporaryName){};
Patrick Venturea78e39f2018-11-06 18:37:06 -080021
22 bool open(const std::string& path) override;
23
Patrick Venture400c6362018-11-06 20:06:11 -080024 bool write(std::uint32_t offset,
25 const std::vector<std::uint8_t>& data) override;
26
Patrick Venturea78e39f2018-11-06 18:37:06 -080027 private:
28 std::string path;
Patrick Venturea5c59062018-11-09 12:25:52 -080029
30 /** The file to use for staging the bytes. */
31 std::string stagedFilename;
Patrick Venturea78e39f2018-11-06 18:37:06 -080032};
33
34} // namespace blobs