class BinaryItemStream
Declaration
template <typename T, typename Traits = BinaryItemTraits<T>>
class BinaryItemStream : public BinaryStream { /* full declaration omitted */ };
Description
BinaryItemStream represents a sequence of objects stored in some kind of external container but for which it is useful to view as a stream of contiguous bytes. An example of this might be if you have a collection of records and you serialize each one into a buffer, and store these serialized records in a container. The pointers themselves are not laid out contiguously in memory, but we may wish to read from or write to these records as if they were.
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:34
Inherits from: BinaryStream
Templates
- T
- Traits = BinaryItemTraits<T>
Method Overview
- public BinaryItemStream<T, Traits>(llvm::support::endianness Endian)
- public llvm::support::endianness getEndian() const
- public uint32_t getLength()
- public llvm::Error readBytes(uint32_t Offset, uint32_t Size, ArrayRef<uint8_t> & Buffer)
- public llvm::Error readLongestContiguousChunk(uint32_t Offset, ArrayRef<uint8_t> & Buffer)
- public void setItems(ArrayRef<T> ItemArray)
Inherited from BinaryStream:
- protected checkOffsetForRead
- public getEndian
- public getFlags
- public getLength
- public readBytes
- public readLongestContiguousChunk
Methods
¶BinaryItemStream<T, Traits>(
llvm::support::endianness Endian)
BinaryItemStream<T, Traits>(
llvm::support::endianness Endian)
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:36
Parameters
- llvm::support::endianness Endian
¶llvm::support::endianness getEndian() const
llvm::support::endianness getEndian() const
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:39
¶uint32_t getLength()
uint32_t getLength()
Description
Return the number of bytes of data in this stream.
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:69
¶llvm::Error readBytes(uint32_t Offset,
uint32_t Size,
ArrayRef<uint8_t>& Buffer)
llvm::Error readBytes(uint32_t Offset,
uint32_t Size,
ArrayRef<uint8_t>& Buffer)
Description
Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream.
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:41
Parameters
- uint32_t Offset
- uint32_t Size
- ArrayRef<uint8_t>& Buffer
¶llvm::Error readLongestContiguousChunk(
uint32_t Offset,
ArrayRef<uint8_t>& Buffer)
llvm::Error readLongestContiguousChunk(
uint32_t Offset,
ArrayRef<uint8_t>& Buffer)
Description
Given an offset into the stream, read as much as possible without copying any data.
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:55
Parameters
- uint32_t Offset
- ArrayRef<uint8_t>& Buffer
¶void setItems(ArrayRef<T> ItemArray)
void setItems(ArrayRef<T> ItemArray)
Declared at: llvm/include/llvm/Support/BinaryItemStream.h:64
Parameters
- ArrayRef<T> ItemArray