Skip to content

Instantly share code, notes, and snippets.

@Izaron
Last active April 3, 2023 14:10
Show Gist options
  • Save Izaron/b08dbd3ce343275a027b1ef35491b02b to your computer and use it in GitHub Desktop.
Save Izaron/b08dbd3ce343275a027b1ef35491b02b to your computer and use it in GitHub Desktop.
#pragma once
#include <optional>
#include <lib/error/error.h>
#include <thirdparty/include/tl/expected.hpp>
#include "types.h"
/*
using TByte = uint8_t;
using TWord = uint16_t;
using TLong = uint32_t;
using TAddressType = TLong;
using TDataView = std::span<const TByte>;
using TDataHolder = std::vector<TByte>;
*/
namespace NMemory {
class IDevice {
public:
virtual tl::expected<TDataHolder, TError> Read(TAddressType addr, TAddressType size) = 0;
[[nodiscard]] virtual std::optional<TError> Write(TAddressType addr, TDataView data) = 0;
};
} // namespace NMemory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment