LLVM  6.0.0svn
Public Member Functions | Protected Member Functions | List of all members
llvm::WritableBinaryStream Class Referenceabstract

A BinaryStream which can be read from as well as written to. More...

#include "llvm/Support/BinaryStream.h"

Inheritance diagram for llvm::WritableBinaryStream:
Inheritance graph
[legend]
Collaboration diagram for llvm::WritableBinaryStream:
Collaboration graph
[legend]

Public Member Functions

 ~WritableBinaryStream () override=default
 
virtual Error writeBytes (uint32_t Offset, ArrayRef< uint8_t > Data)=0
 Attempt to write the given bytes into the stream at the desired offset. More...
 
virtual Error commit ()=0
 For buffered streams, commits changes to the backing store. More...
 
BinaryStreamFlags getFlags () const override
 Return the properties of this stream. More...
 
- Public Member Functions inherited from llvm::BinaryStream
virtual ~BinaryStream ()=default
 
virtual llvm::support::endianness getEndian () const =0
 
virtual Error readBytes (uint32_t Offset, uint32_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 ArrayRef to point to data owned by the stream. More...
 
virtual Error readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer)=0
 Given an offset into the stream, read as much as possible without copying any data. More...
 
virtual uint32_t getLength ()=0
 Return the number of bytes of data in this stream. More...
 

Protected Member Functions

Error checkOffsetForWrite (uint32_t Offset, uint32_t DataSize)
 
- Protected Member Functions inherited from llvm::BinaryStream
Error checkOffsetForRead (uint32_t Offset, uint32_t DataSize)
 

Detailed Description

A BinaryStream which can be read from as well as written to.

Note that writing to a BinaryStream always necessitates copying from the input buffer to the stream's backing store. Streams are assumed to be buffered so that to be portable it is necessary to call commit() on the stream when all data has been written.

Definition at line 74 of file BinaryStream.h.

Constructor & Destructor Documentation

◆ ~WritableBinaryStream()

llvm::WritableBinaryStream::~WritableBinaryStream ( )
overridedefault

Member Function Documentation

◆ checkOffsetForWrite()

Error llvm::WritableBinaryStream::checkOffsetForWrite ( uint32_t  Offset,
uint32_t  DataSize 
)
inlineprotected

◆ commit()

virtual Error llvm::WritableBinaryStream::commit ( )
pure virtual

◆ getFlags()

BinaryStreamFlags llvm::WritableBinaryStream::getFlags ( ) const
inlineoverridevirtual

Return the properties of this stream.

Reimplemented from llvm::BinaryStream.

Definition at line 87 of file BinaryStream.h.

References llvm::BSF_Write.

◆ writeBytes()

virtual Error llvm::WritableBinaryStream::writeBytes ( uint32_t  Offset,
ArrayRef< uint8_t >  Data 
)
pure virtual

Attempt to write the given bytes into the stream at the desired offset.

This will always necessitate a copy. Cannot shrink or grow the stream, only writes into existing allocated space.

Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, and llvm::MutableBinaryByteStream.

Referenced by llvm::WritableBinaryStreamRef::writeBytes().


The documentation for this class was generated from the following file: