#include <BufferGroup.h>
BufferDescriptor
s.
Upstream (producer) nodes can acquire buffers from the pool, read and write to the buffers' data area, and send buffers to downstream (consumer) nodes. Consumer nodes receiving buffers can read and write to the buffers' data area and either send the buffers to further consumer nodes or release buffers back to the pool for reuse.
A BufferGroup
containing buffers with 'large' data regions will use shared memory for the underlying data, while those containing buffers with 'small' data regions will not. For BufferGroup
s with 'large' data regions the shared memory will be used for BufferGroup
information such as the DataFormat
, a list of buffers, etc. 'Large' buffers are transmitted between Node
s by passing information needed to reference a particular buffer in the owning BufferGroup
's shared memory region. 'Small' buffers are transmitted between nodes by sending a copy of the entire buffer, including the data region.
BufferGroup
instances are created by the framework.
Public Member Functions | |
status_t | Map (uint32 mode) |
Map a BufferGroup 's buffer data region into the calling process' virtual address space. | |
virtual | ~BufferGroup () |
Class destructor. | |
BufferGroupID | GroupID () const |
Retrieve the BufferGroupID for a BufferGroup . | |
DataFormat const * | Format () const |
Retrieve the DataFormat for a BufferGroup . | |
BufferDescriptor * | AcquireBuffer () |
Acquire a buffer from thhis buffer group. | |
status_t | ReleaseBuffer (BufferDescriptor *buffer) |
Release a buffer to is owning buffer group. | |
Static Public Member Functions | |
BufferGroup * | Allocate (DataFormat *dataFormat, uint32 initialBuffers=8, uint32 maximumBuffers=24, uint32 lockFlags=AREA_NO_LOCK) |
Create a BufferGroup with the given parameters and any underlying resources needed such as shared memory. | |
BufferGroup * | Find (BufferGroupID id) |
Lookup a BufferGroup by ID. | |
status_t | Destroy (BufferGroupID id) |
Destroy a BufferGroup . | |
Private Member Functions | |
BufferGroup () | |
Default constructor that does nothing. |
|
Class destructor.
This will delete a particular |
|
Default constructor that does nothing.
Intentionally |
|
Acquire a buffer from thhis buffer group. If no buffers are immediately available and the current count is less than the maximum, a new buffer will be allocated, otherwise this will block until a buffer is released and becomes available. Ideally there should always be a free buffer available.
|
|
Create a
The
|
|
Destroy a
The
|
|
Lookup a
This consults the roster to lookup the ID and get the information needed to instantiate a local copy of the
|
|
Retrieve the
|
|
Retrieve the
|
|
Map a The read/write access for the new mapping can be specified to be read-only.
|
|
Release a buffer to is owning buffer group. After this the caller should not access the buffer or its data region.
|