Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

pool< T, SIZE_ > Class Template Reference

pool< T, SIZE_ > Class Template Reference
[pool]

A templated pool implementation that uses a fixed size pool. More...

#include <pool.h>

Inherits etl::ipool.

Public Member Functions

 pool ()
 Constructor.
template<typename U >
U * allocate ()
 Allocate an object from the pool.
void release (const void *p_object)
 Release an object in the pool.
void release_all ()
 Release all objects in the pool.
bool is_in_pool (const void *p_object) const
 Check to see if the object belongs to the pool.
size_t max_size () const
 Returns the maximum number of items in the pool.
size_t available () const
 Returns the number of free items in the pool.
size_t size () const
 Returns the number of allocated items in the pool.
bool empty () const
 Checks to see if there are no allocated items in the pool.
bool full () const
 Checks to see if there are no free items in the pool.

Detailed Description

template<typename T, const size_t SIZE_>
class etl::pool< T, SIZE_ >

A templated pool implementation that uses a fixed size pool.

Definition at line 331 of file pool.h.


Constructor & Destructor Documentation

pool (  )

Constructor.

Definition at line 340 of file pool.h.


Member Function Documentation

U* allocate (  )

Allocate an object from the pool.

Uses the default constructor. If asserts or exceptions are enabled and there are no more free items an etl::pool_no_allocation if thrown, otherwise a nullptr is returned. Static asserts if the specified type is too large for the pool.

Definition at line 353 of file pool.h.

size_t available (  ) const [inherited]

Returns the number of free items in the pool.

Definition at line 179 of file pool.h.

bool empty (  ) const [inherited]

Checks to see if there are no allocated items in the pool.

Returns:
true if there are none allocated.

Definition at line 196 of file pool.h.

bool full (  ) const [inherited]

Checks to see if there are no free items in the pool.

Returns:
true if there are none free.

Definition at line 205 of file pool.h.

bool is_in_pool ( const void *  p_object ) const [inherited]

Check to see if the object belongs to the pool.

Parameters:
p_objectA pointer to the object to be checked.
Returns:
true< > if it does, otherwise false

Definition at line 163 of file pool.h.

size_t max_size (  ) const [inherited]

Returns the maximum number of items in the pool.

Definition at line 171 of file pool.h.

void release ( const void *  p_object ) [inherited]

Release an object in the pool.

If asserts or exceptions are enabled and the object does not belong to this pool then an etl::pool_object_not_in_pool is thrown.

Parameters:
p_objectA pointer to the object to be released.

Definition at line 142 of file pool.h.

void release_all (  ) [inherited]

Release all objects in the pool.

Definition at line 150 of file pool.h.

size_t size (  ) const [inherited]

Returns the number of allocated items in the pool.

Definition at line 187 of file pool.h.