LLDB mainline
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
lldb_private::DataBuffer Class Referenceabstract

A pure virtual protocol class for abstracted read only data buffers. More...

#include "lldb/Core/DataBuffer.h"

Inheritance diagram for lldb_private::DataBuffer:
Inheritance graph
[legend]

Public Member Functions

virtual ~DataBuffer ()=default
 
virtual lldb::offset_t GetByteSize () const =0
 Get the number of bytes in the data buffer.
 
const uint8_t * GetBytes () const
 Get a const pointer to the data.
 
llvm::ArrayRef< uint8_t > GetData () const
 
virtual bool isA (const void *ClassID) const
 

Static Public Member Functions

static bool classof (const DataBuffer *data_buffer)
 

Static Public Attributes

static char ID
 LLVM RTTI support.
 

Protected Member Functions

virtual const uint8_t * GetBytesImpl () const =0
 }
 

Detailed Description

A pure virtual protocol class for abstracted read only data buffers.

A pure virtual protocol class for abstracted writable data buffers.

DataBuffer is an abstract class that gets packaged into a shared pointer that can use to implement various ways to store data (on the heap, memory mapped, cached inferior memory). It gets used by DataExtractor so many DataExtractor objects can share the same data and sub-ranges of that shared data, and the last object that contains a reference to the shared data will free it.

Subclasses can implement as many different constructors or member functions that allow data to be stored in the object's buffer prior to handing the shared data to clients that use these buffers.

All subclasses must override all of the pure virtual functions as they are used by clients to access the data. Having a common interface allows different ways of storing data, yet using it in one common way.

This class currently expects all data to be available without any extra calls being made, but we can modify it to optionally get data on demand with some extra function calls to load the data before it gets accessed.

DataBuffer is an abstract class that gets packaged into a shared pointer that can use to implement various ways to store data (on the heap, memory mapped, cached inferior memory). It gets used by DataExtractor so many DataExtractor objects can share the same data and sub-ranges of that shared data, and the last object that contains a reference to the shared data will free it.

Definition at line 42 of file DataBuffer.h.

Constructor & Destructor Documentation

◆ ~DataBuffer()

virtual lldb_private::DataBuffer::~DataBuffer ( )
virtualdefault

Member Function Documentation

◆ classof()

static bool lldb_private::DataBuffer::classof ( const DataBuffer data_buffer)
inlinestatic

Definition at line 67 of file DataBuffer.h.

References ID, and isA().

◆ GetBytes()

const uint8_t * lldb_private::DataBuffer::GetBytes ( ) const
inline

Get a const pointer to the data.

Returns
A const pointer to the bytes owned by this object, or NULL if the object contains no bytes.

Definition at line 57 of file DataBuffer.h.

References GetBytesImpl().

Referenced by lldb_private::DataBufferHeap::DataBufferHeap(), GetData(), and lldb_private::DataExtractor::GetSharedDataOffset().

◆ GetBytesImpl()

virtual const uint8_t * lldb_private::DataBuffer::GetBytesImpl ( ) const
protectedpure virtual

}

Get a const pointer to the data.

Returns
A const pointer to the bytes owned by this object, or NULL if the object contains no bytes.

Implemented in lldb_private::DataBufferUnowned, lldb_private::DataBufferHeap, lldb_private::DataBufferLLVM, and lldb_private::WritableDataBufferLLVM.

Referenced by lldb_private::WritableDataBuffer::GetBytes(), and GetBytes().

◆ GetByteSize()

virtual lldb::offset_t lldb_private::DataBuffer::GetByteSize ( ) const
pure virtual

Get the number of bytes in the data buffer.

Returns
The number of bytes this object currently contains.

Implemented in lldb_private::DataBufferUnowned, lldb_private::DataBufferHeap, lldb_private::DataBufferLLVM, and lldb_private::WritableDataBufferLLVM.

Referenced by lldb_private::DataBufferHeap::DataBufferHeap(), lldb_private::WritableDataBuffer::GetData(), and GetData().

◆ GetData()

llvm::ArrayRef< uint8_t > lldb_private::DataBuffer::GetData ( ) const
inline

Definition at line 59 of file DataBuffer.h.

References GetBytes(), and GetByteSize().

◆ isA()

virtual bool lldb_private::DataBuffer::isA ( const void *  ClassID) const
inlinevirtual

Member Data Documentation

◆ ID

char DataBuffer::ID
static

LLVM RTTI support.

{

Definition at line 65 of file DataBuffer.h.

Referenced by classof(), and isA().


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