CARLA
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
carla::BufferPool Class Reference

A pool of Buffer. More...

#include <BufferPool.h>

+ Inheritance diagram for carla::BufferPool:
+ Collaboration 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. More...
 

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 30 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 35 of file BufferPool.h.

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 38 of file BufferPool.h.

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

◆ Push()

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

Definition at line 53 of file BufferPool.h.

References _queue.

Friends And Related Function Documentation

◆ Buffer

friend class Buffer
friend

Definition at line 51 of file BufferPool.h.

Member Data Documentation

◆ _queue

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

Definition at line 57 of file BufferPool.h.

Referenced by Pop(), and Push().


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