litert::
BufferRef
#include <litert_buffer_ref.h>
An immutable and non-owning view of a buffer.
Summary
ByteT
Inheritance
Direct Known Subclasses: litert::MutableBufferRef< ByteT >Constructors and Destructors
BufferRef
(const ByteT *data, size_t end_offset, size_t start_offset)
BufferRef
(const void *data, size_t end_offset, size_t start_offset)
BufferRef
(absl::Span< const ByteT > data)
~BufferRef
()
Public types
std::tuple< const ByteT *const, const size_t, const size_t >
Protected attributes
data_
= nullptr
ByteT *
size_t
data_
.size_t
data_
.Public functions
Data
() const
const ByteT *
Dump
(std::ostream & out) const
void
Get
() const
TupleT
Size
() const
size_t
Span
() const
absl::Span< const ByteT >
StrData
() const
const char *
StrView
() const
absl::string_view
ToVec
() const
std::vector< ByteT >
WriteStr
(std::ostream & out) const
void
Protected functions
TypeName
() const
virtual absl::string_view
Public types
TupleT
std :: tuple < const ByteT * const , const size_t , const size_t > TupleT
Protected attributes
data_
ByteT * data_ = nullptr
The original pointer to the memory.
end_offset_
size_t end_offset_
The end offset of the actual data, relative to data_
.
start_offset_
size_t start_offset_
The start offset of the actual data, relative to data_
.
Public functions
BufferRef
BufferRef()
Constructs a null buffer.
BufferRef
BufferRef ( const ByteT * data , size_t end_offset , size_t start_offset )
Constructs from an already allocated buffer.
The view will only expose data[offset, offset + size]
.
data
|
A pointer to the start of the buffer.
|
end_offset
|
The end offset of the buffer view.
|
start_offset
|
The start offset of the buffer view.
|
BufferRef
BufferRef ( const void * data , size_t end_offset , size_t start_offset )
BufferRef
BufferRef ( absl :: Span < const ByteT > data )
BufferRef
BufferRef ( const BufferRef & other ) = default
Data
const ByteT * Data () const
Returns a pointer to the start of the actual data.
Dump
void Dump ( std :: ostream & out ) const
Prints information about this buffer.
Get
TupleT Get () const
Returns the buffer details as a tuple.
Size
size_t Size () const
Returns the size of the actual data.
Span
absl :: Span < const ByteT > Span () const
Returns a const span of the actual data.
StrData
const char * StrData () const
Returns a pointer to the start of the actual data as a signed char.
StrView
absl :: string_view StrView () const
Returns a string view of the actual data.
ToVec
std :: vector < ByteT > ToVec () const
Copies the buffer data to a vector.
WriteStr
void WriteStr ( std :: ostream & out ) const
Writes the string data to a stream.
~BufferRef
virtual ~BufferRef()=default
Protected functions
TypeName
virtual absl :: string_view TypeName () const
Returns the debug name of the class.

