Pool that is used by the memory manager.
More...
#include "pool.h"
|
| | Pool (size_t const &capacity) |
| | Pool constructor defining capacity. More...
|
| |
| std::deque< std::shared_ptr< ManagedData > > const & | queue () const |
| | Queue container accessor. More...
|
| |
| std::deque< std::shared_ptr< ManagedData > >::iterator | begin () |
| | Begin iterator accessor for the queue's container. More...
|
| |
| std::deque< std::shared_ptr< ManagedData > >::iterator | end () |
| | End iterator accessor for the queue's container. More...
|
| |
| size_t | size () |
| | Queue size accessor. More...
|
| |
| bool | empty () |
| | Emptiness queue accessor. More...
|
| |
| size_t | capacity () const |
| | Capacity accessor. More...
|
| |
| void | push_back (std::shared_ptr< ManagedData > const &data) |
| | Push back data into the pool. More...
|
| |
| std::shared_ptr< ManagedData > | pop_front () |
| | Return and pop the fist element from the queue, it the queue is empty wait for an element to come back. More...
|
| |
|
|
size_t | capacity_ = 1 |
| | Pool capacity, maximum size.
|
| |
|
std::deque< std::shared_ptr< ManagedData > > | queue_ = {} |
| | Container used to store pool's data.
|
| |
|
std::mutex | mutex_ = {} |
| | Pool mutex to protect pool access.
|
| |
|
std::unique_ptr< std::condition_variable > | conditionVariable_ = std::make_unique<std::condition_variable>() |
| | Condition variable to wait on data for empty queue.
|
| |
template<class ManagedData>
class hh::behavior::Pool< ManagedData >
Pool that is used by the memory manager.
- Template Parameters
-
| ManagedData | Type stored in the pool |
Definition at line 36 of file pool.h.
◆ Pool()
template<class ManagedData>
Pool constructor defining capacity.
If the capacity given is 0, it set to 1
- Parameters
-
Definition at line 49 of file pool.h.
◆ begin()
template<class ManagedData>
| std::deque<std::shared_ptr<ManagedData> >::iterator hh::behavior::Pool< ManagedData >::begin |
( |
| ) |
|
|
inline |
Begin iterator accessor for the queue's container.
- Attention
- Not protected with mutex
- Returns
- Begin iterator for the queue's container
Definition at line 62 of file pool.h.
◆ capacity()
template<class ManagedData>
Capacity accessor.
- Attention
- Not protected with mutex
- Returns
- Queue accessor
Definition at line 85 of file pool.h.
◆ empty()
template<class ManagedData>
Emptiness queue accessor.
- Attention
- Not protected with mutex
- Returns
- True if queue empty, else False
Definition at line 80 of file pool.h.
◆ end()
template<class ManagedData>
| std::deque<std::shared_ptr<ManagedData> >::iterator hh::behavior::Pool< ManagedData >::end |
( |
| ) |
|
|
inline |
End iterator accessor for the queue's container.
- Attention
- Not protected with mutex
- Returns
- End iterator for the queue's container
Definition at line 67 of file pool.h.
◆ pop_front()
template<class ManagedData>
Return and pop the fist element from the queue, it the queue is empty wait for an element to come back.
- Returns
- The queue front element
Definition at line 106 of file pool.h.
◆ push_back()
template<class ManagedData>
| void hh::behavior::Pool< ManagedData >::push_back |
( |
std::shared_ptr< ManagedData > const & |
data | ) |
|
|
inline |
Push back data into the pool.
- Exceptions
-
| std::runtime_error | Queue overflow, too much push_back |
- Parameters
-
Definition at line 90 of file pool.h.
◆ queue()
template<class ManagedData>
| std::deque<std::shared_ptr<ManagedData> > const& hh::behavior::Pool< ManagedData >::queue |
( |
| ) |
const |
|
inline |
Queue container accessor.
- Attention
- Not protected with mutex
- Returns
- Queue container
Definition at line 57 of file pool.h.
◆ size()
template<class ManagedData>
Queue size accessor.
- Attention
- Protected with mutex
- Returns
- Queue size
Definition at line 72 of file pool.h.
The documentation for this class was generated from the following file:
- /home/tjb3/work/hedgehog-nist/hedgehog/behavior/memory_manager/pool.h