OpenTTD Source 20250312-master-gcdcc6b491d
pool_type.hpp File Reference

Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle, Town, and other indexed items. More...

#include "enum_type.hpp"

Go to the source code of this file.

Data Structures

struct  PoolIDBase
 Non-templated base for PoolID for use with type trait queries. More...
 
struct  PoolID< TBaseType, TTag, TEnd, TInvalid >
 Templated helper to make a PoolID a single POD value. More...
 
struct  PoolBase
 Base class for base of all pools. More...
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >
 Base class for all pools. More...
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolIterator< T >
 Iterator to iterate all valid T of a pool. More...
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::IterateWrapper< T >
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolIteratorFiltered< T, F >
 Iterator to iterate all valid T of a pool. More...
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::IterateWrapperFiltered< T, F >
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >
 Base class for all PoolItems. More...
 
struct  Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::AllocCache
 Helper struct to cache 'freed' PoolItems so we do not need to allocate them again. More...
 

Typedefs

using PoolTypes = EnumBitSet< PoolType, uint8_t >
 
typedef std::vector< struct PoolBase * > PoolVector
 Vector of pointers to PoolBase.
 

Enumerations

enum class  PoolType : uint8_t { Normal , NetworkClient , NetworkAdmin , Data }
 Various types of a pool. More...
 

Functions

template<typename T >
requires std::is_base_of_v<PoolIDBase, T>
constexpr auto operator+ (const std::integral auto &val, const T &pool_id)
 
template<typename Te , typename Tp >
requires std::is_enum_v<Te> && std::is_base_of_v<PoolIDBase, Tp>
constexpr auto operator+ (const Te &val, const Tp &pool_id)
 

Variables

static constexpr PoolTypes PT_ALL = {PoolType::Normal, PoolType::NetworkClient, PoolType::NetworkAdmin, PoolType::Data}
 

Detailed Description

Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle, Town, and other indexed items.

Definition in file pool_type.hpp.

Typedef Documentation

◆ PoolTypes

using PoolTypes = EnumBitSet<PoolType, uint8_t>

Definition at line 22 of file pool_type.hpp.

◆ PoolVector

typedef std::vector<struct PoolBase *> PoolVector

Vector of pointers to PoolBase.

Definition at line 25 of file pool_type.hpp.

Enumeration Type Documentation

◆ PoolType

enum class PoolType : uint8_t
strong

Various types of a pool.

Enumerator
Normal 

Normal pool containing game objects.

NetworkClient 

Network client pools.

NetworkAdmin 

Network admin pool.

Data 

NewGRF or other data, that is not reset together with normal pools.

Definition at line 16 of file pool_type.hpp.

Function Documentation

◆ operator+() [1/2]

template<typename T >
requires std::is_base_of_v<PoolIDBase, T>
constexpr auto operator+ ( const std::integral auto &  val,
const T &  pool_id 
)
constexpr

Definition at line 78 of file pool_type.hpp.

◆ operator+() [2/2]

template<typename Te , typename Tp >
requires std::is_enum_v<Te> && std::is_base_of_v<PoolIDBase, Tp>
constexpr auto operator+ ( const Te &  val,
const Tp &  pool_id 
)
constexpr

Definition at line 80 of file pool_type.hpp.

Variable Documentation

◆ PT_ALL

Definition at line 23 of file pool_type.hpp.