Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

static_mem_pool.h File Reference

Header file for the `static' memory pool. More...

#include <new>
#include <stdexcept>
#include <string>
#include <vector>
#include <assert.h>
#include <stddef.h>
#include "class_level_lock.h"
#include "mem_pool_base.h"

Include dependency graph for static_mem_pool.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  static_mem_pool_set
 Singleton class to maintain a set of existing instantiations of static_mem_pool. More...
class  static_mem_pool< _Sz, _Gid >
 Singleton class template to manage the allocation/deallocation of memory blocks of one specific size. More...

Defines

#define __PRIVATE   private
#define _STATIC_MEM_POOL_TRACE(_Lck, _Msg)   ((void)0)
#define DECLARE_STATIC_MEM_POOL(_Cls)
#define DECLARE_STATIC_MEM_POOL__NOTHROW(_Cls)
#define DECLARE_STATIC_MEM_POOL_GROUPED(_Cls, _Gid)
#define DECLARE_STATIC_MEM_POOL_GROUPED__NOTHROW(_Cls, _Gid)
#define PREPARE_STATIC_MEM_POOL(_Cls)
#define PREPARE_STATIC_MEM_POOL_GROUPED(_Cls, _Gid)


Detailed Description

Header file for the `static' memory pool.

Version:
1.19, 2006/08/28
Author:
Wu Yongwei

Define Documentation

#define __PRIVATE   private
 

#define _STATIC_MEM_POOL_TRACE _Lck,
_Msg   )     ((void)0)
 

#define DECLARE_STATIC_MEM_POOL _Cls   ) 
 

Value:

public: \
    static void* operator new(size_t __size) \
    { \
        assert(__size == sizeof(_Cls)); \
        void* __ptr; \
        __ptr = static_mem_pool<sizeof(_Cls)>:: \
                               instance_known().allocate(); \
        if (__ptr == NULL) \
            throw std::bad_alloc(); \
        return __ptr; \
    } \
    static void operator delete(void* __ptr) \
    { \
        if (__ptr) \
            static_mem_pool<sizeof(_Cls)>:: \
                           instance_known().deallocate(__ptr); \
    }

#define DECLARE_STATIC_MEM_POOL__NOTHROW _Cls   ) 
 

Value:

public: \
    static void* operator new(size_t __size) throw() \
    { \
        assert(__size == sizeof(_Cls)); \
        return static_mem_pool<sizeof(_Cls)>:: \
                              instance_known().allocate(); \
    } \
    static void operator delete(void* __ptr) \
    { \
        if (__ptr) \
            static_mem_pool<sizeof(_Cls)>:: \
                           instance_known().deallocate(__ptr); \
    }

#define DECLARE_STATIC_MEM_POOL_GROUPED _Cls,
_Gid   ) 
 

Value:

public: \
    static void* operator new(size_t __size) \
    { \
        assert(__size == sizeof(_Cls)); \
        void* __ptr; \
        __ptr = static_mem_pool<sizeof(_Cls), (_Gid)>:: \
                               instance_known().allocate(); \
        if (__ptr == NULL) \
            throw std::bad_alloc(); \
        return __ptr; \
    } \
    static void operator delete(void* __ptr) \
    { \
        if (__ptr) \
            static_mem_pool<sizeof(_Cls), (_Gid)>:: \
                           instance_known().deallocate(__ptr); \
    }

#define DECLARE_STATIC_MEM_POOL_GROUPED__NOTHROW _Cls,
_Gid   ) 
 

Value:

public: \
    static void* operator new(size_t __size) throw() \
    { \
        assert(__size == sizeof(_Cls)); \
        return static_mem_pool<sizeof(_Cls), (_Gid)>:: \
                              instance_known().allocate(); \
    } \
    static void operator delete(void* __ptr) \
    { \
        if (__ptr) \
            static_mem_pool<sizeof(_Cls), (_Gid)>:: \
                           instance_known().deallocate(__ptr); \
    }

#define PREPARE_STATIC_MEM_POOL _Cls   ) 
 

#define PREPARE_STATIC_MEM_POOL_GROUPED _Cls,
_Gid   ) 
 


Generated on Sat Oct 6 08:27:27 2007 for Nvwa by  doxygen 1.3.9.1