9#ifndef LLVM_SUPPORT_BINARYSTREAM_H
10#define LLVM_SUPPORT_BINARYSTREAM_H
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An interface for accessing data in a stream-like format, but which discourages copying.
virtual llvm::endianness getEndian() const =0
virtual uint64_t getLength()=0
Return the number of bytes of data in this stream.
virtual ~BinaryStream()=default
virtual Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer)=0
Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output A...
virtual Error readLongestContiguousChunk(uint64_t Offset, ArrayRef< uint8_t > &Buffer)=0
Given an offset into the stream, read as much as possible without copying any data.
virtual BinaryStreamFlags getFlags() const
Return the properties of this stream.
Error checkOffsetForRead(uint64_t Offset, uint64_t DataSize)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
A BinaryStream which can be read from as well as written to.
Error checkOffsetForWrite(uint64_t Offset, uint64_t DataSize)
~WritableBinaryStream() override=default
virtual Error writeBytes(uint64_t Offset, ArrayRef< uint8_t > Data)=0
Attempt to write the given bytes into the stream at the desired offset.
BinaryStreamFlags getFlags() const override
Return the properties of this stream.
virtual Error commit()=0
For buffered streams, commits changes to the backing store.
This is an optimization pass for GlobalISel generic memory operations.
@ LLVM_MARK_AS_BITMASK_ENUM