OpenTTD Source 20241224-master-gee860a5c8e
|
Base class for all PoolItems. More...
#include <pool_type.hpp>
Public Types | |
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > | Pool |
Type of the pool this item is going to be part of. | |
Public Member Functions | |
void * | operator new (size_t size) |
Allocates space for new Titem. | |
void | operator delete (void *p) |
Marks Titem as free. | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. | |
void * | operator new (size_t, void *ptr) |
Allocates space for new Titem at given memory address. | |
Static Public Member Functions | |
static bool | CanAllocateItem (size_t n=1) |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-nullptr) Titem. | |
static Titem * | Get (size_t index) |
Returns Titem with given index. | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. | |
static size_t | GetPoolSize () |
Returns first unused index. | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. | |
static void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. | |
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
Returns an iterable ensemble of all valid Titem. | |
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 237 of file pool_type.hpp.
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::Pool |
Type of the pool this item is going to be part of.
Definition at line 241 of file pool_type.hpp.
|
inlinestatic |
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 309 of file pool_type.hpp.
|
inlinestatic |
Returns current state of pool cleaning - yes or no.
Definition at line 318 of file pool_type.hpp.
|
inlinestatic |
Returns Titem with given index.
index | of item to get |
Definition at line 339 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns Titem with given index.
index | of item to get |
Definition at line 350 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns number of valid items in the pool.
Definition at line 369 of file pool_type.hpp.
|
inlinestatic |
Returns first unused index.
Useful when iterating over all pool items.
Definition at line 360 of file pool_type.hpp.
|
inlinestatic |
Tests whether given index can be used to get valid (non-nullptr) Titem.
index | index to examine |
Definition at line 328 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns an iterable ensemble of all valid Titem.
from | index of the first Titem to consider |
Definition at line 388 of file pool_type.hpp.
|
inline |
Marks Titem as free.
Its memory is released
p | memory to free |
Definition at line 259 of file pool_type.hpp.
|
inline |
Allocates space for new Titem.
size | size of Titem |
Definition at line 249 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::size.
|
inline |
Allocates space for new Titem with given index.
size | size of Titem |
index | index of item |
Definition at line 275 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::size.
|
inline |
Allocates space for new Titem at given memory address.
ptr | where are we allocating the item? |
Definition at line 287 of file pool_type.hpp.
|
inlinestatic |
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 |
Definition at line 381 of file pool_type.hpp.
Tindex Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index |
Index of this pool item.
Definition at line 238 of file pool_type.hpp.
Referenced by AddCargoDelivery(), LinkGraphOverlay::AddLinks(), LinkGraph::AddNode(), AdvertiseIndustryOpening(), AfterLoadGame(), AfterLoadGRFs(), AgeVehicle(), AircraftEntersTerminal(), AircraftEventHandler_AtTerminal(), AircraftHandleDestTooFar(), AircraftVehicleChangeInfo(), AirportGetNearestTown(), BuildGuiGroupList(), BuildObject(), RefitWindow::BuildRefitList(), BuildReplacementVehicle(), StoryBookWindow::BuildStoryPageElementList(), CalcEngineReliability(), CalculateCompanyAssetValue(), CalculateRefitMasks(), CanRoadContinueIntoNextTile(), CcBuildWagon(), ChangeIndustryProduction(), ChangePopulation(), ChangeTimetable(), ChangeTownRating(), CheckAllowRemoveRoad(), CheckConsistencyOfArticulatedVehicle(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), CheckIfCallBackAllowsCreation(), CheckIfTrainNeedsService(), CheckOrders(), ClearMakeHouseTile(), ClearTile_Town(), CmdAddVehicleGroup(), CmdAlterGroup(), CmdBuildAircraft(), CmdBuildAirport(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildObject(), CmdBuildRailStation(), CmdBuildRailVehicle(), CmdBuildRailWagon(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildRoadStop(), CmdBuildRoadVehicle(), CmdBuildRoadWaypoint(), CmdBuildShip(), CmdBuildShipDepot(), CmdBuildTrainDepot(), CmdBuildVehicle(), CmdBulkChangeTimetable(), CmdBuyCompany(), CmdChangeServiceInt(), CmdCloneVehicle(), CmdCompanyCtrl(), CmdConvertRail(), CmdCreateGoal(), CmdCreateGroup(), CmdCreateLeagueTable(), CmdCreateLeagueTableElement(), CmdCreateStoryPage(), CmdCreateStoryPageElement(), CmdDeleteGroup(), CmdDeleteTown(), CmdForceTrainProceed(), CmdFoundTown(), CmdIndustrySetProduction(), CmdIndustrySetText(), CmdMoveRailVehicle(), CmdMoveVehicle(), CmdOpenCloseAirport(), CmdPlaceSign(), CmdRefitVehicle(), CmdRemoveFromRailStation(), CmdRemoveStoryPage(), CmdRenameDepot(), CmdRenameSign(), CmdReverseTrainDirection(), CmdSetVehicleOnTime(), CmdSetVehicleVisibility(), CmdStartStopVehicle(), CompanyCheckBankrupt(), CompanyNewsInformation::CompanyNewsInformation(), ConvertRoadTypeOwner(), CopyHeadSpecificThings(), CrashAirplane(), CreateRandomTown(), CreateSubsidy(), DecreaseVehicleValue(), DeleteDepotHighlightOfVehicle(), DeleteGroupHighlightOfVehicle(), DeleteOrderWarnings(), DeleteStaleLinks(), DeliverGoods(), DeliverGoodsToIndustry(), DepotWindow::DepotClick(), DisableEngineForCompany(), Disaster_CoalMine_Init(), DisasterTick_Aircraft(), DisasterTick_Big_Ufo(), DisasterTick_Ufo(), DisasterTick_Zeppeliner(), DoCmdStartStopVehicle(), DoCreateNewIndustry(), DoCreateTown(), OrderBackup::DoRestore(), DoStartupNewCompany(), DrawAircraftImage(), DrawRoadVehImage(), DrawShipImage(), DrawTrainImage(), BaseVehicleListWindow::DrawVehicleListItems(), SelectCompanyLiveryWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), CompanyWindow::DrawWidget(), BuyCompanyWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), SelectStationWindow< T >::DrawWidget(), TownDirectoryWindow::DrawWidget(), EnableEngineForCompany(), FinaliseEngineArray(), Aircraft::FindClosestDepot(), Ship::FindClosestDepot(), FindSubsidyCargoDestination(), FindSubsidyIndustryCargoRoute(), FindSubsidyPassengerRoute(), FindSubsidyTownCargoRoute(), FindTrainOnTrackEnum(), FloodVehicle(), FormatString(), GenerateCompanyName(), GeneratePresidentName(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::Get(), GetClosestDeletedStation(), GetCountAndDistanceOfClosestInstance(), NewGRFInspectWindow::GetFeatureIndex(), GetFirstPlayableCompanyID(), GetGroupNumEngines(), GetGroupNumVehicle(), GetGroupNumVehicleMinAge(), GetGroupProfitLastYearMinAge(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::GetIfValid(), IndustryDirectoryWindow::GetIndustryString(), GetNewEngine(), GetOrderCmdFromTile(), NIHVehicle::GetParent(), NIHStation::GetParent(), NIHObject::GetParent(), NIHAirport::GetParent(), NIHRoadStop::GetParent(), GetPreviewCompany(), GetRailTypeDropDownList(), IndustryTileScopeResolver::GetRandomBits(), GetTileHighlightType(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), IndustriesResolverObject::GetTown(), IndustryTileScopeResolver::GetTriggers(), AirportTileScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), IndustryTileScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), TownScopeResolver::GetVariable(), GetVehicleSet(), GrowTown(), GrowTownAtRoad(), GrowTownWithRoad(), HandleBankruptcyTakeover(), HandleClickOnSign(), HandleStationRefit(), IncreaseStats(), IndustryDirectoryWindow::IndustryNameSorter(), IndustryProductionCallback(), InvalidateCompanyWindows(), InvalidateVehicleOrder(), IsShipDestinationTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::IsValidID(), Vehicle::LeaveUnbunchingDepot(), LinkGraphJob::LinkGraphIndex(), INDYChunkHandler::Load(), ORDRChunkHandler::Load(), LoadTownData(), LoadUnloadVehicle(), MarkTrainAsStuck(), MoveWaypointsToBaseStations(), Vehicle::NeedsServicing(), NetworkAdminCompanyNew(), NetworkOnGameStart(), NetworkServerNewCompany(), NewVehicleAvailable(), NormaliseTrainHead(), NormalizeTrainVehInDepot(), VehicleGroupWindow::OnClick(), OrdersWindow::OnClick(), StoryBookWindow::OnClick(), TimetableWindow::OnClick(), TownAuthorityWindow::OnClick(), RefitWindow::OnClick(), VehicleDetailsWindow::OnClick(), VehicleViewWindow::OnClick(), WaypointWindow::OnClick(), DepotWindow::OnDragDrop(), VehicleDetailsWindow::OnDropdownSelect(), VehicleViewWindow::OnHotkey(), LandInfoWindow::OnInit(), RefitWindow::OnInvalidateData(), DepotWindow::OnMouseDrag(), StoryBookWindow::OnPageElementClick(), CompanyWindow::OnPaint(), EndGameWindow::OnPaint(), VehicleDetailsWindow::OnPaint(), VehicleViewWindow::OnPaint(), StoryBookWindow::OnPlaceObject(), TimetableWindow::OnQueryTextFinished(), DepotWindow::OnVehicleSelect(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::operator new(), OrdersWindow::OrderClick_NearestDepot(), OrdersWindow::OrderClick_Skip(), PerformIndustryTileSlopeCheck(), PropagateChildLivery(), LinkGraphSchedule::Queue(), RailVehicleChangeInfo(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), Station::RecomputeCatchment(), RefitVehicle(), LinkRefresher::RefreshLinks(), LinkRefresher::RefreshStats(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveFromRailBaseStation(), RemoveLock(), RemoveNearbyStations(), RemoveRoad(), RemoveRoadStop(), RemoveRoadWaypointStop(), ReplaceChain(), ReplaceFreeUnit(), ReportNewsProductionChangeIndustry(), ResetCompanyLivery(), ResetNewGRFData(), ReverseTrainDirection(), RoadVehArrivesAt(), RoadVehicleChangeInfo(), LGRJChunkHandler::Save(), STNNChunkHandler::Save(), CITYChunkHandler::Save(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), StoryBookWindow::SelectNextPage(), StoryBookWindow::SelectPrevPage(), SendAllVehiclesToDepot(), ServerNetworkAdminSocketHandler::SendCompanyInfo(), ServerNetworkAdminSocketHandler::SendCompanyUpdate(), SetDParamsForOwnedBy(), SetGroupFlag(), OrdersWindow::SetStringParameters(), StationViewWindow::SetStringParameters(), TimetableWindow::SetStringParameters(), TownViewWindow::SetStringParameters(), VehicleViewWindow::SetStringParameters(), WaypointWindow::SetStringParameters(), SetViewportCatchmentStation(), SetViewportCatchmentTown(), SetViewportCatchmentWaypoint(), ShipAccelerate(), ShipArrivesAt(), ShipMoveUpDownOnLock(), ShipVehicleChangeInfo(), ShowRejectOrAcceptNews(), ShowTimetableWindow(), ShowVehicleDetailsWindow(), ShowVehicleRefitWindow(), ShowVehicleViewWindow(), ShowWaypointWindow(), SignList::SignNameSorter(), LinkGraphSchedule::SpawnNext(), StartStopVehicle(), StartupOneEngine(), CompanyStationsWindow::StationNameSorter(), IndustriesScopeResolver::StorePSA(), TestTownOwnsBridge(), TownActionBribe(), TownActionBuyRights(), TownActionFundBuildings(), TownActionRoadRebuild(), TownGenerateCargo(), TrainController(), TrainCrashed(), TrainEnterStation(), TransportIndustryGoods(), TriggerIndustryProduction(), TryPathReserve(), UpdateAircraftSpeed(), UpdateAirplanesOnNewStation(), UpdateCompanyGroupLiveries(), UpdateCompanyRatingAndValue(), UpdateCompanyRoadInfrastructure(), UpdateNearestTownForRoadTiles(), UpdateObjectColours(), UpdateOrderDest(), UpdateStationAcceptance(), UpdateTownGrowth(), UpdateTownGrowthRate(), UpdateVehicleTimetable(), CompanyInfrastructureWindow::UpdateWidgetSize(), BuyCompanyWindow::UpdateWidgetSize(), SelectStationWindow< T >::UpdateWidgetSize(), TownDirectoryWindow::UpdateWidgetSize(), VehicleEnterDepot(), VehicleEnteredDepotThisTick(), VehicleNameSorter(), VehicleServiceInDepot(), LinkGraphJob::~LinkGraphJob(), and Station::~Station().