static_mem_pool_set Class Reference

#include <static_mem_pool.h>


Detailed Description

Singleton class to maintain a set of existing instantiations of static_mem_pool.

Definition at line 80 of file static_mem_pool.h.


Public Types

typedef class_level_lock
< static_mem_pool_set >::lock 
lock

Public Member Functions

void add (mem_pool_base *__memory_pool_p)
void recycle ()

Static Public Member Functions

static static_mem_pool_setinstance ()

Data Fields

__PRIVATE __pad0__: ~static_mem_pool_set()

Private Types

typedef std::vector
< mem_pool_base * > 
container_type

Private Member Functions

const static_mem_pool_setoperator= (const static_mem_pool_set &)
 static_mem_pool_set (const static_mem_pool_set &)
 static_mem_pool_set ()

Private Attributes

container_type _M_memory_pool_set

Member Typedef Documentation

typedef std::vector<mem_pool_base*> static_mem_pool_set::container_type [private]

Definition at line 93 of file static_mem_pool.h.

Definition at line 83 of file static_mem_pool.h.


Constructor & Destructor Documentation

static_mem_pool_set::static_mem_pool_set (  )  [private]

Definition at line 43 of file static_mem_pool.cpp.

References _STATIC_MEM_POOL_TRACE.

00044 {
00045     _STATIC_MEM_POOL_TRACE(false, "The static_mem_pool_set is created");
00046 }

static_mem_pool_set::static_mem_pool_set ( const static_mem_pool_set  )  [private]


Member Function Documentation

void static_mem_pool_set::add ( mem_pool_base __memory_pool_p  ) 

Adds a new memory pool to static_mem_pool_set.

Parameters:
__memory_pool_p pointer to the memory pool to add

Definition at line 90 of file static_mem_pool.cpp.

References _M_memory_pool_set.

Referenced by static_mem_pool< _Sz, _Gid >::_S_create_instance().

00091 {
00092     lock __guard;
00093     _M_memory_pool_set.push_back(__memory_pool_p);
00094 }

static_mem_pool_set & static_mem_pool_set::instance (  )  [static]

Creates the singleton instance of static_mem_pool_set.

Returns:
reference to the instance of static_mem_pool_set

Definition at line 61 of file static_mem_pool.cpp.

Referenced by static_mem_pool< _Sz, _Gid >::_S_alloc_sys(), and static_mem_pool< _Sz, _Gid >::_S_create_instance().

00062 {
00063     lock __guard;
00064     static static_mem_pool_set _S_instance;
00065     return _S_instance;
00066 }

const static_mem_pool_set& static_mem_pool_set::operator= ( const static_mem_pool_set  )  [private]

void static_mem_pool_set::recycle (  ) 

Asks all static memory pools to recycle unused memory blocks back to the system. The caller should get the lock to prevent other operations to static_mem_pool_set during its execution.

Definition at line 73 of file static_mem_pool.cpp.

References _M_memory_pool_set, and _STATIC_MEM_POOL_TRACE.

Referenced by static_mem_pool< _Sz, _Gid >::_S_alloc_sys().

00074 {
00075     _STATIC_MEM_POOL_TRACE(false, "Memory pools are being recycled");
00076     container_type::iterator __end = _M_memory_pool_set.end();
00077     for (container_type::iterator
00078             __i  = _M_memory_pool_set.begin();
00079             __i != __end; ++__i)
00080     {
00081         (*__i)->recycle();
00082     }
00083 }


Field Documentation

Definition at line 89 of file static_mem_pool.h.

Definition at line 94 of file static_mem_pool.h.

Referenced by add(), and recycle().


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

Generated on Wed May 5 00:07:00 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6