CARLA
Loading...
Searching...
No Matches
carla::BufferPool Class Reference

A pool of Buffer. More...

#include <BufferPool.h>

Inheritance diagram for carla::BufferPool:

Public Member Functions

 BufferPool ()=default
 BufferPool (size_t estimated_size)
Buffer Pop ()
 Pop a Buffer from the queue, creates a new one if the queue is empty.

Private Member Functions

void Push (Buffer &&buffer)

Private Attributes

moodycamel::ConcurrentQueue< Buffer > _queue

Friends

class Buffer

Detailed Description

A pool of Buffer.

Buffers popped from this pool automatically return to the pool on destruction so the allocated memory can be reused.

Warning
Buffers adjust their size only by growing, they never shrink unless explicitly cleared. The allocated memory is only deleted when this pool is destroyed.

Definition at line 29 of file BufferPool.h.

Constructor & Destructor Documentation

◆ BufferPool() [1/2]

carla::BufferPool::BufferPool ( )
default

◆ BufferPool() [2/2]

carla::BufferPool::BufferPool ( size_t estimated_size)
inlineexplicit

Definition at line 34 of file BufferPool.h.

References _queue.

Member Function Documentation

◆ Pop()

Buffer carla::BufferPool::Pop ( )
inline

Pop a Buffer from the queue, creates a new one if the queue is empty.

Definition at line 37 of file BufferPool.h.

References carla::Buffer::_parent_pool, _queue, and Buffer.

◆ Push()

void carla::BufferPool::Push ( Buffer && buffer)
inlineprivate

Definition at line 52 of file BufferPool.h.

References _queue, and Buffer.

◆ Buffer

friend class Buffer
friend

Definition at line 50 of file BufferPool.h.

References Buffer.

Referenced by Buffer, Pop(), and Push().

Member Data Documentation

◆ _queue

moodycamel::ConcurrentQueue<Buffer> carla::BufferPool::_queue
private

Definition at line 56 of file BufferPool.h.

Referenced by BufferPool(), Pop(), and Push().


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