Base class for all PoolItems. More...
#include <pool_type.hpp>
Public Member Functions | |
FORCEINLINE void * | operator new (size_t size) |
Allocates space for new Titem. | |
FORCEINLINE void | operator delete (void *p) |
Marks Titem as free. | |
FORCEINLINE void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. | |
FORCEINLINE void * | operator new (size_t size, void *ptr) |
Allocates space for new Titem at given memory address. | |
Static Public Member Functions | |
static FORCEINLINE bool | CanAllocateItem (size_t n=1) |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function(). | |
static FORCEINLINE bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. | |
static FORCEINLINE bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-NULL) Titem. | |
static FORCEINLINE Titem * | Get (size_t index) |
Returs Titem with given index. | |
static FORCEINLINE Titem * | GetIfValid (size_t index) |
Returs Titem with given index. | |
static FORCEINLINE size_t | GetPoolSize () |
Returns first unused index. | |
static FORCEINLINE size_t | GetNumItems () |
Returns number of valid items in the pool. | |
static FORCEINLINE void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. | |
Data Fields | |
Tindex | index |
Index of this pool item. |
Base class for all PoolItems.
Tpool | The pool this item is going to be part of |
Definition at line 136 of file pool_type.hpp.
static FORCEINLINE bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::CanAllocateItem | ( | size_t | n = 1 |
) | [inline, static] |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function().
Tests whether we can allocate 'n' items
n | number of items we want to allocate |
Definition at line 205 of file pool_type.hpp.
static FORCEINLINE bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::CleaningPool | ( | ) | [inline, static] |
Returns current state of pool cleaning - yes or no.
Definition at line 214 of file pool_type.hpp.
static FORCEINLINE Titem* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::Get | ( | size_t | index | ) | [inline, static] |
Returs Titem with given index.
index | of item to get |
Reimplemented in SpecializedStation< T, Tis_waypoint >, SpecializedVehicle< T, Type >, SpecializedStation< Station, false >, SpecializedStation< Waypoint, true >, SpecializedVehicle< DisasterVehicle, VEH_DISASTER >, SpecializedVehicle< Ship, VEH_SHIP >, SpecializedVehicle< Train, Type >, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >, SpecializedVehicle< EffectVehicle, VEH_EFFECT >, and SpecializedVehicle< RoadVehicle, Type >.
Definition at line 235 of file pool_type.hpp.
static FORCEINLINE Titem* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetIfValid | ( | size_t | index | ) | [inline, static] |
Returs Titem with given index.
index | of item to get |
Reimplemented in SpecializedStation< T, Tis_waypoint >, SpecializedVehicle< T, Type >, SpecializedStation< Station, false >, SpecializedStation< Waypoint, true >, SpecializedVehicle< DisasterVehicle, VEH_DISASTER >, SpecializedVehicle< Ship, VEH_SHIP >, SpecializedVehicle< Train, Type >, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >, SpecializedVehicle< EffectVehicle, VEH_EFFECT >, and SpecializedVehicle< RoadVehicle, Type >.
Definition at line 246 of file pool_type.hpp.
static FORCEINLINE size_t Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetNumItems | ( | ) | [inline, static] |
Returns number of valid items in the pool.
Definition at line 265 of file pool_type.hpp.
static FORCEINLINE size_t Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetPoolSize | ( | ) | [inline, static] |
Returns first unused index.
Useful when iterating over all pool items.
Definition at line 256 of file pool_type.hpp.
static FORCEINLINE bool Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::IsValidID | ( | size_t | index | ) | [inline, static] |
Tests whether given index can be used to get valid (non-NULL) Titem.
index | index to examine |
Reimplemented in SpecializedStation< T, Tis_waypoint >, SpecializedVehicle< T, Type >, SpecializedStation< Station, false >, SpecializedStation< Waypoint, true >, SpecializedVehicle< DisasterVehicle, VEH_DISASTER >, SpecializedVehicle< Ship, VEH_SHIP >, SpecializedVehicle< Train, Type >, SpecializedVehicle< Aircraft, VEH_AIRCRAFT >, SpecializedVehicle< EffectVehicle, VEH_EFFECT >, and SpecializedVehicle< RoadVehicle, Type >.
Definition at line 224 of file pool_type.hpp.
FORCEINLINE void Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator delete | ( | void * | p | ) | [inline] |
Marks Titem as free.
Its memory is released
p | memory to free |
Definition at line 155 of file pool_type.hpp.
FORCEINLINE void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new | ( | size_t | size, | |
void * | ptr | |||
) | [inline] |
Allocates space for new Titem at given memory address.
size | size of Titem | |
ptr | where are we allocating the item? |
Definition at line 183 of file pool_type.hpp.
FORCEINLINE void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new | ( | size_t | size, | |
size_t | index | |||
) | [inline] |
Allocates space for new Titem with given index.
size | size of Titem | |
index | index of item |
Definition at line 170 of file pool_type.hpp.
FORCEINLINE void* Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new | ( | size_t | size | ) | [inline] |
Allocates space for new Titem.
size | size of Titem |
Definition at line 145 of file pool_type.hpp.
static FORCEINLINE void Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::PostDestructor | ( | size_t | index | ) | [inline, static] |
Dummy function called after destructor of each member.
If you want to use it, override it in PoolItem's subclass.
index | index of deleted item |
Reimplemented in BaseStation, Company, Industry, and Town.
Definition at line 277 of file pool_type.hpp.