Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Pothos::BufferManager Class Referenceabstract

#include <BufferManager.hpp>

Public Types

typedef std::shared_ptr< BufferManagerSptr
 

Public Member Functions

virtual ~BufferManager (void)
 Virtual destructor for derived buffer managers. More...
 
virtual void init (const BufferManagerArgs &args)
 
virtual bool empty (void) const =0
 
const BufferChunkfront (void) const
 
virtual void pop (const size_t numBytes)=0
 
virtual void push (const ManagedBuffer &buff)=0
 
void pushExternal (const ManagedBuffer &buff)
 
void setCallback (const std::function< void(const ManagedBuffer &)> &callback)
 
bool isInitialized (void) const
 Has this buffer manager been initialized? More...
 

Static Public Member Functions

static Sptr make (const std::string &name)
 
static Sptr make (const std::string &name, const BufferManagerArgs &args)
 

Protected Member Functions

 BufferManager (void)
 Default constructor. More...
 
void setFrontBuffer (const BufferChunk &buff)
 Called by derived classes to set the buffer for front() More...
 

Detailed Description

A BufferManager has a queue-like interface to manage buffers. Since buffers can represent special DMA memory, the buffer manager is responsible for DMA hooks.

Member Typedef Documentation

◆ Sptr

typedef std::shared_ptr<BufferManager> Pothos::BufferManager::Sptr

Constructor & Destructor Documentation

◆ ~BufferManager()

virtual Pothos::BufferManager::~BufferManager ( void  )
virtual

Virtual destructor for derived buffer managers.

◆ BufferManager()

Pothos::BufferManager::BufferManager ( void  )
protected

Default constructor.

Member Function Documentation

◆ empty()

virtual bool Pothos::BufferManager::empty ( void  ) const
pure virtual

Is the manager empty?

Returns
true if no buffers are available

◆ front()

const Pothos::BufferChunk & Pothos::BufferManager::front ( void  ) const
inline

Get a reference to the front buffer. front().address will be the start of a valid buffer, front().length will be the number of bytes available. The caller sets length to indicate bytes used.

Returns
the buffer at the queue head

◆ init()

virtual void Pothos::BufferManager::init ( const BufferManagerArgs args)
virtual

Init is called once at factory time to initialize the buffers.

◆ isInitialized()

bool Pothos::BufferManager::isInitialized ( void  ) const
inline

Has this buffer manager been initialized?

◆ make() [1/2]

static Sptr Pothos::BufferManager::make ( const std::string &  name)
static

The BufferManager factory – makes a new BufferManager given the factory name. This factory call does not invoke init() on the buffer manager. Plugins for custom BufferManagers should be located in the plugin registry: /framework/buffer_manager/[name]

Exceptions
BufferManagerFactoryErrorif the factory function fails.
Parameters
namethe name of a BufferManager factory in the plugin tree
Returns
a new shared pointer to a buffer manager

◆ make() [2/2]

static Sptr Pothos::BufferManager::make ( const std::string &  name,
const BufferManagerArgs args 
)
static

The BufferManager factory – makes a new BufferManager given the factory name. Plugins for custom BufferManagers should be located in the plugin registry: /framework/buffer_manager/[name]

Exceptions
BufferManagerFactoryErrorif the factory function fails.
Parameters
namethe name of a BufferManager factory in the plugin tree
argsthe buffer manager init arguments
Returns
a new shared pointer to a buffer manager

◆ pop()

virtual void Pothos::BufferManager::pop ( const size_t  numBytes)
pure virtual

Pop bytes from the front buffer. This operation removes available bytes from the manager. Calling pop removes a managed buffer from an internal queue; the bytes removed are only restored to the manager via push.

If this manager is responsible for DMA writes, the pop operation should cause a write operation. If this manager is responsible for DMA reads, this pop operation should cause a read operation.

Parameters
numBytesthe number of bytes to remove

◆ push()

virtual void Pothos::BufferManager::push ( const ManagedBuffer buff)
pure virtual

Push returns a buffer to the manager. The buffer may be available via a call to front() depending upon the implementation of the manager.

Exceptions
BufferPushErrorif buffer does not belong to this manager.
Parameters
buffthe buffer to return

◆ pushExternal()

void Pothos::BufferManager::pushExternal ( const ManagedBuffer buff)
inline

Push external returns a buffer to the manager through a callback. This call is used to return a buffer from a different thread context. The callback implements the thread-safe delivery mechanism.

◆ setCallback()

void Pothos::BufferManager::setCallback ( const std::function< void(const ManagedBuffer &)> &  callback)

Set the callback for use with the pushExternal API call.

◆ setFrontBuffer()

void Pothos::BufferManager::setFrontBuffer ( const BufferChunk buff)
inlineprotected

Called by derived classes to set the buffer for front()


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