All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ucxx::Buffer Class Referenceabstract

A simple object to simplify managing buffers. More...

#include <buffer.h>

Inheritance diagram for ucxx::Buffer:
ucxx::HostBuffer

Public Member Functions

 Buffer (const Buffer &)=delete
 
Bufferoperator= (Buffer const &)=delete
 
 Buffer (Buffer &&o)=delete
 
Bufferoperator= (Buffer &&o)=delete
 
virtual ~Buffer ()
 Virtual destructor. More...
 
BufferType getType () const noexcept
 Get the type of buffer the object holds. More...
 
size_t getSize () const noexcept
 Get the size of the contained buffer. More...
 
virtual void * data ()=0
 Abstract method returning void pointer to buffer. More...
 

Protected Member Functions

 Buffer (const BufferType bufferType, const size_t size)
 Protected constructor of abstract type Buffer. More...
 

Protected Attributes

BufferType _bufferType {BufferType::Invalid}
 Buffer type.
 
size_t _size
 Buffer size.
 

Detailed Description

A simple object to simplify managing buffers.

UCXX can work with raw pointers in most cases, but in some circumstances it's required to know more information about the buffer, such as with ucxx::RequestTagMulti. In such circumstances it may need to allocate buffers internally and UCXX can utilize objects of this type to describe the internally-allocated buffers.

Constructor & Destructor Documentation

◆ Buffer()

ucxx::Buffer::Buffer ( const BufferType  bufferType,
const size_t  size 
)
protected

Protected constructor of abstract type Buffer.

This is the constructor that should be called by derived classes to store general information about the buffer, such as its type and size.

Parameters
[in]bufferTypethe type of buffer the object holds.
[in]sizethe size of the contained buffer.

◆ ~Buffer()

virtual ucxx::Buffer::~Buffer ( )
virtual

Virtual destructor.

Virtual destructor with empty implementation.

Member Function Documentation

◆ data()

virtual void* ucxx::Buffer::data ( )
pure virtual

Abstract method returning void pointer to buffer.

Get the void pointer to the underlying buffer that holds the data. This is meant to return the actual allocation, and not a pointer to some container to the buffer it holds.

Returns
the void pointer to the buffer.

Implemented in ucxx::HostBuffer.

◆ getSize()

size_t ucxx::Buffer::getSize ( ) const
noexcept

Get the size of the contained buffer.

The size in bytes of the contained buffer.

Returns
the size of the contained buffer.

◆ getType()

BufferType ucxx::Buffer::getType ( ) const
noexcept

Get the type of buffer the object holds.

The type of buffer the object holds is important to ensure proper casting of the object into the correct derived type.

Returns
the type of buffer the object holds

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