tools: split io interface out
Splits the io interface out into its own file to decouple the
internal/sys from it.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I65860e32152ef49cd987c11eb408516e13fadb29
diff --git a/tools/io.hpp b/tools/io.hpp
index b3b2c79..8925418 100644
--- a/tools/io.hpp
+++ b/tools/io.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "internal/sys.hpp"
+#include "io_interface.hpp"
#include <cstdint>
#include <string>
@@ -8,37 +9,6 @@
namespace host_tool
{
-class HostIoInterface
-{
- public:
- virtual ~HostIoInterface() = default;
-
- /**
- * Attempt to read bytes from offset to the destination from the host
- * memory device.
- *
- * @param[in] offset - offset into the host memory device.
- * @param[in] length - the number of bytes to copy from source.
- * @param[in] destination - where to write the bytes.
- * @return true on success, false on failure (such as unable to initialize
- * device).
- */
- virtual bool read(const std::size_t offset, const std::size_t length,
- void* const destination) = 0;
-
- /**
- * Attempt to write bytes from source to offset into the host memory device.
- *
- * @param[in] offset - offset into the host memory device.
- * @param[in] length - the number of bytes to copy from source.
- * @param[in] source - the souce of the bytes to copy to the memory device.
- * @return true on success, false on failure (such as unable to initialize
- * device).
- */
- virtual bool write(const std::size_t offset, const std::size_t length,
- const void* const source) = 0;
-};
-
class DevMemDevice : public HostIoInterface
{
public: