OpenTTD Source
20241108-master-g80f628063a
|
Some methods of Pool are placed here in order to reduce compilation time and binary size. More...
#include "alloc_func.hpp"
#include "bitmath_func.hpp"
#include "mem_func.hpp"
#include "pool_type.hpp"
#include "../error_func.h"
#include "../saveload/saveload_error.hpp"
Go to the source code of this file.
Macros | |
#define | DEFINE_POOL_METHOD(type) |
Helper for defining the method's signature. More... | |
#define | INSTANTIATE_POOL_METHODS(name) |
Force instantiation of pool methods so we don't get linker errors. More... | |
Functions | |
DEFINE_POOL_METHOD (inline) | |
Create a clean pool. More... | |
DEFINE_POOL_METHOD (inline void) | |
Resizes the pool so 'index' can be addressed. More... | |
DEFINE_POOL_METHOD (inline void *) | |
Makes given index valid. More... | |
DEFINE_POOL_METHOD (void *) | |
Allocates new item. More... | |
DEFINE_POOL_METHOD (void) | |
Deallocates memory used by this index and marks item as free. More... | |
Some methods of Pool are placed here in order to reduce compilation time and binary size.
Definition in file pool_func.hpp.
#define DEFINE_POOL_METHOD | ( | type | ) |
Helper for defining the method's signature.
type | The return type of the method. |
Definition at line 25 of file pool_func.hpp.
#define INSTANTIATE_POOL_METHODS | ( | name | ) |
Force instantiation of pool methods so we don't get linker errors.
Only methods accessed from methods defined in pool.hpp need to be forcefully instantiated.
Definition at line 237 of file pool_func.hpp.
DEFINE_POOL_METHOD | ( | inline void * | ) |
Makes given index valid.
size | size of item |
index | index of item |
Definition at line 108 of file pool_func.hpp.
References SetBit().
DEFINE_POOL_METHOD | ( | inline void | ) |
Resizes the pool so 'index' can be addressed.
index | index we will allocate later |
Definition at line 54 of file pool_func.hpp.
References Align(), MemSetT(), and ReallocT().
DEFINE_POOL_METHOD | ( | inline | size_t | ) |
Create a clean pool.
Searches for first free index.
name | The name for the pool. |
Definition at line 33 of file pool_func.hpp.
DEFINE_POOL_METHOD | ( | void * | ) |
Allocates new item.
Allocates new item with given index.
size | size of item |
size | size of item |
index | index of item |
Definition at line 142 of file pool_func.hpp.
DEFINE_POOL_METHOD | ( | void | ) |
Deallocates memory used by this index and marks item as free.
Destroys all items in the pool and resets all member variables.
index | item to deallocate |
Definition at line 186 of file pool_func.hpp.