Imaging Control 4 C++ Library 1.2.0
|
The buffer pool allows allocating additional buffers for use by the program. More...
Classes | |
struct | AllocationOptions |
Contains options to configure the allocation when requesting an image buffer from a buffer pool. More... | |
struct | CacheConfig |
Configures the buffer pool's caching behavior. More... | |
Public Member Functions | |
std::shared_ptr< ImageBuffer > | getBuffer (const ImageType &image_type, const AllocationOptions &alloc_options, Error &err=Error::Default()) const |
Request a buffer from the buffer pool. | |
std::shared_ptr< ImageBuffer > | getBuffer (const ImageType &image_type, Error &err=Error::Default()) const |
Gets a buffer from the buffer pool. | |
Static Public Member Functions | |
static std::shared_ptr< BufferPool > | create (const CacheConfig &cache_config, BufferAllocator &alloc, Error &err=Error::Default()) |
Create a new buffer pool, specifying a caching behavior and a custom allocator. | |
static std::shared_ptr< BufferPool > | create (const CacheConfig &cache_config, const std::shared_ptr< BufferAllocator > &alloc, Error &err=Error::Default()) |
Create a new buffer pool, specifying a caching behavior and a custom allocator. | |
static std::shared_ptr< BufferPool > | create (BufferAllocator &alloc, Error &err=Error::Default()) |
Create a new buffer pool, specifying a custom allocator. | |
static std::shared_ptr< BufferPool > | create (const std::shared_ptr< BufferAllocator > &alloc, Error &err=Error::Default()) |
Create a new buffer pool, specifying a custom allocator. | |
static std::shared_ptr< BufferPool > | create (const CacheConfig &cache_config, Error &err=Error::Default()) |
Create a new buffer pool, specifying a caching behavior. | |
static std::shared_ptr< BufferPool > | create (Error &err=Error::Default()) |
Create a new buffer pool, using default caching behavior and the default allocator. | |
The buffer pool allows allocating additional buffers for use by the program.
Most programs will only use buffers provided by one of the sink types. However, some programs require additional buffers, for example to use as destination for image processing.
To create additional buffers, first create a buffer pool using BufferPool::create. Then, use BufferPool::getBuffer to create a new buffer with a specified image type. Allocation options can be specified to customize the image buffer's memory alignment, pitch and total buffer size.
Image buffers owned by the program are tracked by instances of std::shared_ptr<ImageBuffer>
. When the image buffer is no longer required, reset all pointers to it. The image buffer will then be returned to the buffer pool.
The buffer pool has configurable caching behavior. By default, the buffer pool will cache one image buffer and return it the next time a matching image buffer is requested.
Image buffers created by the buffer pool are still valid after the buffer pool itself has been destroyed.
Buffer pool objects are neither copyable nor movable, and are only handled via std::shared_ptr<BufferPool>
.
|
inlinestatic |
Create a new buffer pool, specifying a custom allocator.
[in] | alloc | The custom allocator to be used by the new buffer pool. The referenced object must be valid while the buffer pool exists. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inlinestatic |
Create a new buffer pool, specifying a caching behavior and a custom allocator.
[in] | cache_config | The caching behavior of the new buffer pool |
[in] | alloc | The custom allocator to be used by the new buffer pool. The referenced object must be valid while the buffer pool exists. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inlinestatic |
Create a new buffer pool, specifying a caching behavior and a custom allocator.
[in] | cache_config | The caching behavior of the new buffer pool |
[in] | alloc | The custom allocator to be used by the new buffer pool. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inlinestatic |
Create a new buffer pool, specifying a caching behavior.
[in] | cache_config | The caching behavior of the new buffer pool |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inlinestatic |
Create a new buffer pool, specifying a custom allocator.
[in] | alloc | The custom allocator to be used by the new buffer pool. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inlinestatic |
Create a new buffer pool, using default caching behavior and the default allocator.
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inline |
Request a buffer from the buffer pool.
The buffer is either newly allocated, or retrieved from the buffer pool's buffer cache.
[in] | image_type | Image type of the requested buffer. |
[in] | alloc_options | Structure containing advanced allocation options. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.
|
inline |
Gets a buffer from the buffer pool.
The buffer is either newly allocated, or retrieved from the buffer pool's buffer cache.
[in] | image_type | Image type of the requested buffer. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
if an error occurs.