#include <Free_List.h>
Inheritance diagram for ACE_Locked_Free_List< T, ACE_LOCK >:
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. | |
virtual void | add (T *element) |
virtual T * | remove (void) |
virtual size_t | size (void) |
Returns the current size of the free list. | |
virtual void | resize (size_t newsize) |
Resizes the free list to <newsize>. | |
Protected Methods | |
virtual void | alloc (size_t n) |
Allocates <n> extra nodes for the freelist. | |
virtual void | dealloc (size_t n) |
Removes and frees <n> nodes from the freelist. | |
Protected Attributes | |
int | mode_ |
T * | free_list_ |
Pointer to the first node in the freelist. | |
size_t | lwm_ |
Low water mark. | |
size_t | hwm_ |
High water mark. | |
size_t | inc_ |
Increment value. | |
size_t | size_ |
Keeps track of the size of the list. | |
ACE_LOCK | mutex_ |
Synchronization variable for <ACE_Timer_Queue>. | |
Private Methods | |
ACE_Locked_Free_List (const ACE_Locked_Free_List< T, ACE_LOCK > &) | |
void | operator= (const ACE_Locked_Free_List< T, ACE_LOCK > &) |
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 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. |
|
Destructor - removes all the elements from the free_list.
|
|
|
|
Inserts an element onto the free list (if it isn't past the high water mark). Implements ACE_Free_List< T >. |
|
Allocates <n> extra nodes for the freelist.
|
|
Removes and frees <n> nodes from the freelist.
|
|
|
|
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. Implements ACE_Free_List< T >. |
|
Resizes the free list to <newsize>.
Implements ACE_Free_List< T >. |
|
Returns the current size of the free list.
Implements ACE_Free_List< T >. |
|
Pointer to the first node in the freelist.
|
|
High water mark.
|
|
Increment value.
|
|
Low water mark.
|
|
Free list operation mode, either ACE_FREE_LIST_WITH_POOL or ACE_PURE_FREE_LIST. |
|
Synchronization variable for <ACE_Timer_Queue>.
|
|
Keeps track of the size of the list.
|