litert::MutableBufferRef

#include <litert_buffer_ref.h>

A writable, non-owning version of BufferRef.

Summary

Details
Template Parameters
ByteT
The byte type of the buffer.

Inheritance

Inherits from: litert::BufferRef< ByteT >
Direct Known Subclasses:litert::OwningBufferRef< ByteT, Allocator >

Constructors and Destructors

MutableBufferRef()
Constructs a null buffer.
MutableBufferRef(ByteT *data, size_t size, size_t offset)
Creates a mutable view from a pre-allocated non-const buffer.
MutableBufferRef(void *data, size_t size, size_t offset)
MutableBufferRef(absl::Span< ByteT > data)
MutableBufferRef(absl::Span< const ByteT > data)
MutableBufferRef(const ByteT *, size_t, size_t)
MutableBufferRef(const void *, size_t, size_t)
MutableBufferRef(const MutableBufferRef & other)

Public types

TupleT using
std::tuple< ByteT *const, const size_t, const size_t >

Public functions

Data()
ByteT *
Returns a mutable pointer to the start of the actual data.
Get()
TupleT
Returns the buffer info as a tuple.
Span()
absl::Span< ByteT >
Returns a mutable span of the actual data.
StrData()
char *
Returns a mutable char pointer to the start of the actual data.
WriteInto(absl::string_view str, size_t offset)
bool
Writes a string into the buffer at a specified offset.
operator=(const MutableBufferRef & other)=default

Protected functions

TypeName() const override
virtual absl::string_view
Returns the debug name of the class.

Public types

TupleT

std::tuple< ByteT *const, const size_t, const size_t > TupleT

Public functions

Data

ByteT * Data()

Returns a mutable pointer to the start of the actual data.

Get

TupleT Get()

Returns the buffer info as a tuple.

MutableBufferRef

 MutableBufferRef()

Constructs a null buffer.

MutableBufferRef

 MutableBufferRef(
  ByteT *data,
  size_t size,
  size_t offset
)

Creates a mutable view from a pre-allocated non-const buffer.

MutableBufferRef

 MutableBufferRef(
  void *data,
  size_t size,
  size_t offset
)

MutableBufferRef

 MutableBufferRef(
  absl::Span< ByteT > data
)

MutableBufferRef

 MutableBufferRef(
  absl::Span< const ByteT > data
)=delete

MutableBufferRef

 MutableBufferRef(
  const ByteT *,
  size_t,
  size_t
)=delete

MutableBufferRef

 MutableBufferRef(
  const void *,
  size_t,
  size_t
)=delete

MutableBufferRef

 MutableBufferRef(
  const MutableBufferRef & other
)=default

Span

absl::Span< ByteT > Span()

Returns a mutable span of the actual data.

StrData

char * StrData()

Returns a mutable char pointer to the start of the actual data.

WriteInto

bool WriteInto(
  absl::string_view str,
  size_t offset
)

Writes a string into the buffer at a specified offset.

Details
Parameters
str
The string to write.
offset
The offset at which to start writing.
Returns
true if the entire string fits and is written, false otherwise.

operator=

MutableBufferRef & operator=(
  const MutableBufferRef & other
)=default

Protected functions

TypeName

virtual absl::string_view TypeName() const override

Returns the debug name of the class.