Pothos  0.4.0-gd11861cd
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
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
< BufferManager
Sptr
 

Public Member Functions

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

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

Constructor & Destructor Documentation

Pothos::BufferManager::BufferManager ( void  )
protected

Default constructor.

Member Function Documentation

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

Is the manager empty?

Returns
true if no buffers are available
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
virtual void Pothos::BufferManager::init ( const BufferManagerArgs args)
virtual

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

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

Has this buffer manager been initialized?

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
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
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
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
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.

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

Set the callback for use with the pushExternal API call.

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: