Embedded Template Library  1.0
 All Classes Files Functions Variables Typedefs Friends Modules Pages
etl::ipool< T > Class Template Reference

Public Member Functions

T * allocate ()
 
void release (const T &object)
 
void release (const T *const p_object)
 
bool is_in_pool (const T &object) const
 
bool is_in_pool (const T *const p_object) const
 
- Public Member Functions inherited from etl::pool_base
size_t available () const
 Returns the number of free items in the pool.
 
bool empty () const
 

Protected Member Functions

 ipool (T *p_buffer, ibitset &in_use_flags, size_t size)
 Constructor.
 
- Protected Member Functions inherited from etl::pool_base
 pool_base (size_t max_size)
 Constructor.
 

Protected Attributes

T * p_buffer
 
ibitsetin_use_flags
 
- Protected Attributes inherited from etl::pool_base
size_t next_free
 The position of the next free item in the pool.
 
size_t items_allocated
 The number of items allocated.
 
const size_t MAX_SIZE
 The maximum number of objects that can be allocated.
 

Member Function Documentation

template<typename T >
T* etl::ipool< T >::allocate ( )
inline

Allocate an object from the pool. If ETL_THROW_EXCEPTIONS is defined and there are no more free items an etl::pool_no_allocation if thrown, otherwise a nullptr is returned.

Note
The state of the object returned is undefined.
template<typename T >
bool etl::ipool< T >::is_in_pool ( const T &  object) const
inline

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
template<typename T >
bool etl::ipool< T >::is_in_pool ( const T *const  p_object) const
inline

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
template<typename T >
void etl::ipool< T >::release ( const T &  object)
inline

Free an object in the pool. If ETL_THROW_EXCEPTIONS is defined 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.
template<typename T >
void etl::ipool< T >::release ( const T *const  p_object)
inline

Free an object in the pool. If ETL_THROW_EXCEPTIONS is defined 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.

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