# oldpool.h File Reference

`#include "core/math_func.hpp"`

Go to the source code of this file.

## Data Structures
struct | OldMemoryPoolBase
| Stuff for dynamic vehicles. More...
struct | OldMemoryPool< T >
struct | PoolItem< T, Tid, Tpool >
| Generalization for all pool items that are saved in the savegame. More...
## Defines
#define | OLD_POOL_ENUM(name, type, block_size_bits, max_blocks)
#define | OLD_POOL_ACCESSORS(name, type)
#define | DECLARE_OLD_POOL(name, type, block_size_bits, max_blocks)
#define | DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc)
#define | DEFINE_OLD_POOL_GENERIC(name, type)
#define | STATIC_OLD_POOL(name, type, block_size_bits, max_blocks, new_block_proc, clean_block_proc)
## Typedefs
typedef void | OldMemoryPoolNewBlock (uint start_item)
typedef void | OldMemoryPoolCleanBlock (uint start_item, uint end_item)
## Functions
template<typename T, OldMemoryPool< T > * Tpool>
static void | PoolNewBlock (uint start_item)
| Generic function to initialize a new block in a pool.
template<typename T, OldMemoryPool< T > * Tpool>
static void | PoolCleanBlock (uint start_item, uint end_item)
| Generic function to free a new block in a pool.

## Detailed Description

Definition in file oldpool.h.

## Define Documentation

#define DECLARE_OLD_POOL | ( | name,
|  | type,
|  | block_size_bits,
|  | max_blocks |  | ) |

Value:

    OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
      extern OldMemoryPool<type> _##name##_pool; \
      OLD_POOL_ACCESSORS(name, type)

Definition at line 357 of file oldpool.h.

#define DEFINE_OLD_POOL | ( | name,
|  | type,
|  | new_block_proc,
|  | clean_block_proc |  | ) |

Value:

    OldMemoryPool<type> _##name##_pool( \
        #name, name##_POOL_MAX_BLOCKS, name##_POOL_BLOCK_SIZE_BITS, sizeof(type), \
        new_block_proc, clean_block_proc);

Definition at line 363 of file oldpool.h.

#define DEFINE_OLD_POOL_GENERIC | ( | name,
|  | type |  | ) |

Value:

    OldMemoryPool<type> _##name##_pool( \
        #name, name##_POOL_MAX_BLOCKS, name##_POOL_BLOCK_SIZE_BITS, sizeof(type), \
        PoolNewBlock<type, &_##name##_pool>, PoolCleanBlock<type, &_##name##_pool>);

Definition at line 368 of file oldpool.h.

#define OLD_POOL_ACCESSORS | ( | name,
|  | type |  | ) |

Value:

    static inline type* Get##name(uint index) { return _##name##_pool.Get(index);  } \
      static inline uint Get##name##PoolSize()  { return _##name##_pool.GetSize(); }

Definition at line 352 of file oldpool.h.

#define OLD_POOL_ENUM | ( | name,
|  | type,
|  | block_size_bits,
|  | max_blocks |  | ) |

Value:

    enum { \
        name##_POOL_BLOCK_SIZE_BITS = block_size_bits, \
        name##_POOL_MAX_BLOCKS      = max_blocks \
      };

Definition at line 345 of file oldpool.h.

#define STATIC_OLD_POOL | ( | name,
|  | type,
|  | block_size_bits,
|  | max_blocks,
|  | new_block_proc,
|  | clean_block_proc |  | ) |

Value:

    OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \
      static DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \
      OLD_POOL_ACCESSORS(name, type)

Definition at line 374 of file oldpool.h.

## Function Documentation

template<typename T, OldMemoryPool< T > * Tpool>

static void PoolCleanBlock | ( | uint | start_item,
|  | uint | end_item |
| ) |  |  | `[inline, static]`

Generic function to free a new block in a pool.

Parameters:

  | start_item | the first item that needs to be cleaned
  | end_item | the last item that needs to be cleaned

Definition at line 150 of file oldpool.h.

template<typename T, OldMemoryPool< T > * Tpool>

static void PoolNewBlock | ( | uint | start_item | ) | `[inline, static]`

Generic function to initialize a new block in a pool.

Parameters:

  | start_item | the first item that needs to be initialized

Definition at line 136 of file oldpool.h.