Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Locked_Free_List Class Template Reference

Implements a free list. More...

`#include <Free_List.h>`

Inheritance diagram for ACE_Locked_Free_List:

[legend]
Collaboration diagram for ACE_Locked_Free_List:

[legend]
List of all members.

## Public Methods
| ACE_Locked_Free_List (int mode=ACE_FREE_LIST_WITH_POOL, size_t prealloc=ACE_DEFAULT_FREE_LIST_PREALLOC, size_t lwm=ACE_DEFAULT_FREE_LIST_LWM, size_t hwm=ACE_DEFAULT_FREE_LIST_HWM, size_t inc=ACE_DEFAULT_FREE_LIST_INC)
virtual | ~ACE_Locked_Free_List (void)
| Destructor - removes all the elements from the free_list. More...
virtual void | add (T *element)
| Inserts an element onto the free list (if it isn't past the high water mark). More...
virtual T * | remove (void)
| Takes a element off the freelist and returns it. It creates <inc> new elements if the size is at or below the low water mark. More...
virtual size_t | size (void)
| Returns the current size of the free list. More...
virtual void | resize (size_t newsize)
| Resizes the free list to <newsize>. More...
## Protected Methods
virtual void | alloc (size_t n)
| Allocates <n> extra nodes for the freelist. More...
virtual void | dealloc (size_t n)
| Removes and frees <n> nodes from the freelist. More...
## Protected Attributes
int | mode_
| Free list operation mode, either ACE_FREE_LIST_WITH_POOL or ACE_PURE_FREE_LIST. More...
T * | free_list_
| Pointer to the first node in the freelist. More...
size_t | lwm_
| Low water mark. More...
size_t | hwm_
| High water mark. More...
size_t | inc_
| Increment value. More...
size_t | size_
| Keeps track of the size of the list. More...
ACE_LOCK | mutex_
| Synchronization variable for <ACE_Timer_Queue>. More...
## Private Methods
| ACE_Locked_Free_List (const ACE_Locked_Free_List< T, ACE_LOCK > &)
void | operator= (const ACE_Locked_Free_List< T, ACE_LOCK > &)

## Detailed Description

### template<class T, class ACE_LOCK>
class ACE_Locked_Free_List< T, ACE_LOCK >

Implements a free list.

This class maintains a free list of nodes of type T. It depends on the type T having a <get_next> and <set_next> method. It maintains a mutex so the freelist can be used in a multithreaded program .

## Constructor & Destructor Documentation

template<class T, class ACE_LOCK>
ACE_Locked_Free_List< T, ACE_LOCK >::ACE_Locked_Free_List | ( | int | mode = ACE_FREE_LIST_WITH_POOL,
|  | size_t | prealloc = ACE_DEFAULT_FREE_LIST_PREALLOC,
|  | size_t | lwm = ACE_DEFAULT_FREE_LIST_LWM,
|  | size_t | hwm = ACE_DEFAULT_FREE_LIST_HWM,
|  | size_t | inc = ACE_DEFAULT_FREE_LIST_INC
| ) |

| Constructor takes a <mode> (i.e., ACE_FREE_LIST_WITH_POOL or ACE_PURE_FREE_LIST), a count of the number of nodes to <prealloc>, a low and high water mark (<lwm> and <hwm>) that indicate when to allocate more nodes, an increment value (<inc>) that indicates how many nodes to allocate when the list must grow.

template<class T, class ACE_LOCK>
ACE_Locked_Free_List< T, ACE_LOCK >::~ACE_Locked_Free_List | ( | void |  | ) | `[virtual]`

| Destructor - removes all the elements from the free_list.

template<class T, class ACE_LOCK>
ACE_Locked_Free_List< T, ACE_LOCK >::ACE_Locked_Free_List | ( | const ACE_Locked_Free_List< T, ACE_LOCK > & |  | ) | `[private]`

## Member Function Documentation

template<class T, class ACE_LOCK>
ACE_INLINE void ACE_Locked_Free_List< T, ACE_LOCK >::add | ( | T * | element | ) | `[virtual]`

| Inserts an element onto the free list (if it isn't past the high water mark). Reimplemented from ACE_Free_List.

template<class T, class ACE_LOCK>
void ACE_Locked_Free_List< T, ACE_LOCK >::alloc | ( | size_t | n | ) | `[protected, virtual]`

| Allocates <n> extra nodes for the freelist.

template<class T, class ACE_LOCK>
void ACE_Locked_Free_List< T, ACE_LOCK >::dealloc | ( | size_t | n | ) | `[protected, virtual]`

| Removes and frees <n> nodes from the freelist.

template<class T, class ACE_LOCK>
void ACE_Locked_Free_List< T, ACE_LOCK >::operator= | ( | const ACE_Locked_Free_List< T, ACE_LOCK > & |  | ) | `[private]`

template<class T, class ACE_LOCK>
ACE_INLINE T * ACE_Locked_Free_List< T, ACE_LOCK >::remove | ( | void |  | ) | `[virtual]`

| Takes a element off the freelist and returns it. It creates <inc> new elements if the size is at or below the low water mark. Reimplemented from ACE_Free_List.

template<class T, class ACE_LOCK>
ACE_INLINE void ACE_Locked_Free_List< T, ACE_LOCK >::resize | ( | size_t | newsize | ) | `[virtual]`

| Resizes the free list to <newsize>. Reimplemented from ACE_Free_List.

template<class T, class ACE_LOCK>
ACE_INLINE size_t ACE_Locked_Free_List< T, ACE_LOCK >::size | ( | void |  | ) | `[virtual]`

| Returns the current size of the free list. Reimplemented from ACE_Free_List.

## Member Data Documentation

template<class T, class ACE_LOCK>
T* ACE_Locked_Free_List::free_list_`[protected]`

| Pointer to the first node in the freelist.

template<class T, class ACE_LOCK>
size_t ACE_Locked_Free_List::hwm_`[protected]`

| High water mark.

template<class T, class ACE_LOCK>
size_t ACE_Locked_Free_List::inc_`[protected]`

| Increment value.

template<class T, class ACE_LOCK>
size_t ACE_Locked_Free_List::lwm_`[protected]`

| Low water mark.

template<class T, class ACE_LOCK>
int ACE_Locked_Free_List::mode_`[protected]`

| Free list operation mode, either ACE_FREE_LIST_WITH_POOL or ACE_PURE_FREE_LIST.

template<class T, class ACE_LOCK>
ACE_LOCK ACE_Locked_Free_List::mutex_`[protected]`

| Synchronization variable for <ACE_Timer_Queue>.

template<class T, class ACE_LOCK>
size_t ACE_Locked_Free_List::size_`[protected]`

| Keeps track of the size of the list.

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

- Free_List.h
- Free_List.cpp
- Free_List.i