Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Classes | Public Member Functions | Friends | List of all members
Pothos::ManagedBuffer Class Reference

#include <ManagedBuffer.hpp>

Classes

struct  Impl
 

Public Member Functions

 ManagedBuffer (void)
 
 ManagedBuffer (const SharedBuffer &buff)
 
 operator bool (void) const
 
void reset (void)
 
void reset (std::shared_ptr< BufferManager > manager, const SharedBuffer &buff, const size_t slabIndex=0)
 
const SharedBuffergetBuffer (void) const
 
size_t getSlabIndex (void) const
 
 ~ManagedBuffer (void)
 ManagedBuffer destructor. More...
 
 ManagedBuffer (const ManagedBuffer &obj)
 ManagedBuffer copy constructor. More...
 
 ManagedBuffer (ManagedBuffer &&obj) noexcept
 ManagedBuffer move constructor. More...
 
ManagedBufferoperator= (const ManagedBuffer &obj)
 ManagedBuffer copy assignment. More...
 
ManagedBufferoperator= (ManagedBuffer &&obj)
 ManagedBuffer move assignment. More...
 
std::shared_ptr< BufferManagergetBufferManager (void) const
 Get the associated buffer manager. More...
 
bool operator< (const ManagedBuffer &) const
 sortable operator for ManagedBuffer More...
 
bool unique (void) const
 
size_t useCount (void) const
 
void setNextBuffer (const ManagedBuffer &next)
 
ManagedBuffer getNextBuffer (void) const
 

Friends

POTHOS_API friend bool operator== (const ManagedBuffer &lhs, const ManagedBuffer &rhs)
 

Detailed Description

A ManagedBuffer is a buffer that interacts with a BufferManager. The ManagedBuffer maintains a reference count, and when no more copies are held by the user, the ManagedBuffer will be returned to the BufferManager; unless the BufferManager has been deleted.

Constructor & Destructor Documentation

◆ ManagedBuffer() [1/4]

Pothos::ManagedBuffer::ManagedBuffer ( void  )
inline

Create a null buffer. All fields are initialized to zero.

◆ ManagedBuffer() [2/4]

Pothos::ManagedBuffer::ManagedBuffer ( const SharedBuffer buff)

Create from a shared buffer with no manager.

◆ ~ManagedBuffer()

Pothos::ManagedBuffer::~ManagedBuffer ( void  )
inline

ManagedBuffer destructor.

◆ ManagedBuffer() [3/4]

Pothos::ManagedBuffer::ManagedBuffer ( const ManagedBuffer obj)
inline

ManagedBuffer copy constructor.

◆ ManagedBuffer() [4/4]

Pothos::ManagedBuffer::ManagedBuffer ( ManagedBuffer &&  obj)
inlinenoexcept

ManagedBuffer move constructor.

Member Function Documentation

◆ getBuffer()

const Pothos::SharedBuffer & Pothos::ManagedBuffer::getBuffer ( void  ) const
inline

Get the internal buffer as set by the manager and which cannot be changed by the caller.

Returns
a const reference to the buffer

◆ getBufferManager()

std::shared_ptr< Pothos::BufferManager > Pothos::ManagedBuffer::getBufferManager ( void  ) const
inline

Get the associated buffer manager.

◆ getNextBuffer()

Pothos::ManagedBuffer Pothos::ManagedBuffer::getNextBuffer ( void  ) const
inline

Get the next contiguous buffer in the chain. Or return a null managed buffer if there is none.

◆ getSlabIndex()

size_t Pothos::ManagedBuffer::getSlabIndex ( void  ) const
inline

Get the slab index associated with this buffer. The slab index related to implementation specifics. Typically, this index is only used when the underlying buffer is sourced from a continuous slab of memory.

◆ operator bool()

Pothos::ManagedBuffer::operator bool ( void  ) const
inlineexplicit

Is this managed buffer valid?

Returns
true if it holds an allocation.

◆ operator<()

bool Pothos::ManagedBuffer::operator< ( const ManagedBuffer rhs) const
inline

sortable operator for ManagedBuffer

◆ operator=() [1/2]

Pothos::ManagedBuffer & Pothos::ManagedBuffer::operator= ( const ManagedBuffer obj)
inline

ManagedBuffer copy assignment.

◆ operator=() [2/2]

Pothos::ManagedBuffer & Pothos::ManagedBuffer::operator= ( ManagedBuffer &&  obj)
inline

ManagedBuffer move assignment.

◆ reset() [1/2]

void Pothos::ManagedBuffer::reset ( void  )
inline

Reset any reference held by the managed buffer. This managed buffer will become a null buffer.

◆ reset() [2/2]

void Pothos::ManagedBuffer::reset ( std::shared_ptr< BufferManager manager,
const SharedBuffer buff,
const size_t  slabIndex = 0 
)

Reset the managed buffer for its next usage.

Parameters
managershared pointer to the buffer manager
buffthe shared buffer with memory and length
slabIndexan identifying index used with slabs

◆ setNextBuffer()

void Pothos::ManagedBuffer::setNextBuffer ( const ManagedBuffer next)
inline

Set the next contiguous buffer in the chain.

◆ unique()

bool Pothos::ManagedBuffer::unique ( void  ) const
inline

Is the reference to the managed buffer unique?

Returns
true if this is the only copy of the managed buffer

◆ useCount()

size_t Pothos::ManagedBuffer::useCount ( void  ) const
inline

The number of copies of the managed buffer.

Friends And Related Function Documentation

◆ operator==

POTHOS_API friend bool operator== ( const ManagedBuffer lhs,
const ManagedBuffer rhs 
)
friend

Equality operator for ManagedBuffer. True when the containers are identical.


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