|
OpenTTD Source 20260108-master-g8ba1860eaa
|
Base class for all PoolItems. More...
#include <pool_type.hpp>
Public Types | |
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool |
| Type of the pool this item is going to be part of. | |
Public Member Functions | |
| PoolItem (Tindex index) | |
| Construct the item. | |
| void * | operator new (size_t)=delete |
| Do not use new PoolItem, but rather PoolItem::Create. | |
| void | operator delete (void *p, size_t size) |
| Marks Titem as free. | |
| void * | operator new (size_t size, Tindex index)=delete |
| Do not use new (index) PoolItem(...), but rather PoolItem::CreateAtIndex(index, ...). | |
| void * | operator new (size_t, void *ptr)=delete |
| Do not use new (address) PoolItem(...). | |
Static Public Member Functions | |
| template<typename T = Titem, typename... Targs> requires std::is_base_of_v<Titem, T> | |
| static T * | Create (Targs &&... args) |
| Creates a new T-object in the associated pool. | |
| template<typename T = Titem, typename... Targs> requires std::is_base_of_v<Titem, T> | |
| static T * | CreateAtIndex (Tindex index, Targs &&... args) |
| Creates a new T-object in the associated pool. | |
| 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 (auto index) |
| Tests whether given index can be used to get valid (non-nullptr) Titem. | |
| static Titem * | Get (auto index) |
| Returns Titem with given index. | |
| static Titem * | GetIfValid (auto 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 | |
| const 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 290 of file pool_type.hpp.
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::Pool |
Type of the pool this item is going to be part of.
Definition at line 300 of file pool_type.hpp.
|
inline |
Construct the item.
| index | The index of this PoolItem in the pool. |
Definition at line 297 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 359 of file pool_type.hpp.
|
inlinestatic |
Returns current state of pool cleaning - yes or no.
Definition at line 368 of file pool_type.hpp.
|
inlinestatic |
Creates a new T-object in the associated pool.
| args... | The arguments to the constructor. |
Definition at line 332 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::data, and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.
|
inlinestatic |
Creates a new T-object in the associated pool.
| index | The to allocate the object at. |
| args... | The arguments to the constructor. |
Definition at line 346 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::data, and Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns Titem with given index.
| index | of item to get |
Definition at line 389 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns Titem with given index.
| index | of item to get |
Definition at line 400 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns number of valid items in the pool.
Definition at line 419 of file pool_type.hpp.
|
inlinestatic |
Returns first unused index.
Useful when iterating over all pool items.
Definition at line 410 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 378 of file pool_type.hpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index.
|
inlinestatic |
Returns an iterable ensemble of all valid Titem.
| from | index of the first Titem to consider |
Definition at line 438 of file pool_type.hpp.
|
inline |
Marks Titem as free.
Its memory is released
| p | memory to free |
Definition at line 310 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 431 of file pool_type.hpp.
| const Tindex Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index |
Index of this pool item.
Definition at line 291 of file pool_type.hpp.
Referenced by AddCargoDelivery(), LinkGraphOverlay::AddLinks(), LinkGraph::AddNode(), AddVehicleToGroup(), AdvertiseIndustryOpening(), AfterLoadGame(), AgeVehicle(), AircraftEntersTerminal(), AircraftEventHandler_AtTerminal(), AircraftHandleDestTooFar(), AircraftVehicleChangeInfo(), AirportGetNearestTown(), BuildObject(), RefitWindow::BuildRefitList(), BuildReplacementVehicle(), StoryBookWindow::BuildStoryPageElementList(), CalcEngineReliability(), CalculateCompanyAssetValue(), CanRoadContinueIntoNextTile(), CcBuildWagon(), ChangeIndustryProduction(), ChangePopulation(), ChangeTimetable(), ChangeTownRating(), CheckAllowRemoveRoad(), CheckConsistencyOfArticulatedVehicle(), CheckforTownRating(), CheckIfAuthorityAllowsNewStation(), CheckIfTrainNeedsService(), CheckOrders(), CheckTrainsOnTrack(), ClearMakeHouseTile(), ClearTile_Town(), 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(), CmdRenameCompany(), CmdRenameDepot(), CmdRenamePresident(), CmdRenameSign(), CmdReverseTrainDirection(), CmdSetVehicleOnTime(), CmdSetVehicleVisibility(), CmdStartStopVehicle(), CompanyCheckBankrupt(), CompanyNewsInformation::CompanyNewsInformation(), ConvertRoadTypeOwner(), CopyHeadSpecificThings(), CrashAirplane(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::Create(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::CreateAtIndex(), 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(), CompanyWindow::DrawWidget(), BuyCompanyWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), SignListWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), SelectStationWindow< T >::DrawWidget(), EnableEngineForCompany(), BuildVehicleWindow::FilterByText(), Aircraft::FindClosestDepot(), Ship::FindClosestDepot(), FindSubsidyCargoDestination(), FindSubsidyIndustryCargoRoute(), FindSubsidyPassengerRoute(), FindSubsidyTownCargoRoute(), FloodVehicle(), FormatString(), GenerateCompanyName(), GeneratePresidentName(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::Get(), GetClosestDeletedStation(), GetCountAndDistanceOfClosestInstance(), NewGRFInspectWindow::GetFeatureIndex(), GetFirstPlayableCompanyID(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::GetIfValid(), IndustryDirectoryWindow::GetIndustryString(), GetNewEngine(), GetOrderCmdFromTile(), GetParamsForOwnedBy(), NIHVehicle::GetParent(), NIHStation::GetParent(), NIHObject::GetParent(), NIHAirport::GetParent(), NIHRoadStop::GetParent(), GetPreviewCompany(), GetRailTypeDropDownList(), IndustryTileScopeResolver::GetRandomBits(), IndustryTileScopeResolver::GetRandomTriggers(), GetTileHighlightType(), IndustriesResolverObject::GetTown(), TownDirectoryWindow::GetTownString(), AirportTileScopeResolver::GetVariable(), IndustriesScopeResolver::GetVariable(), IndustryTileScopeResolver::GetVariable(), ObjectScopeResolver::GetVariable(), RoadStopScopeResolver::GetVariable(), TownScopeResolver::GetVariable(), GetVehicleSet(), OrdersWindow::GetWidgetString(), StationViewWindow::GetWidgetString(), TimetableWindow::GetWidgetString(), TownViewWindow::GetWidgetString(), VehicleViewWindow::GetWidgetString(), WaypointWindow::GetWidgetString(), GrowTown(), GrowTownAtRoad(), GrowTownWithRoad(), GuiGroupListAddChildren(), HandleBankruptcyTakeover(), HandleClickOnSign(), HandleStationRefit(), IncreaseStats(), IndustriesResolverObject::IndustriesResolverObject(), IndustryDirectoryWindow::IndustryNameSorter(), IndustryProductionCallback(), IndustryTileResolverObject::IndustryTileResolverObject(), InvalidateCompanyWindows(), InvalidateVehicleOrder(), StoryBookWindow::IsLastPageSelected(), IsRoadAllowedHere(), IsShipDestinationTile(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::IsValidID(), Vehicle::LeaveUnbunchingDepot(), LinkGraphJob::LinkGraphIndex(), INDYChunkHandler::Load(), LoadTownData(), LoadUnloadVehicle(), MarkTrainAsStuck(), MoveWaypointsToBaseStations(), Vehicle::NeedsServicing(), NetworkAdminCompanyNew(), NetworkOnGameStart(), NetworkServerNewCompany(), NewVehicleAvailable(), NormaliseTrainHead(), NormalizeTrainVehInDepot(), VehicleGroupWindow::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(), OrdersWindow::OrderClick_Skip(), OrdersWindow::OrderClick_StopSharing(), PropagateChildLivery(), LinkGraphSchedule::Queue(), RailVehicleChangeInfo(), ServerNetworkGameSocketHandler::Receive_CLIENT_IDENTIFY(), Station::RecomputeCatchment(), RefitVehicle(), LinkRefresher::RefreshStats(), RemoveAirport(), RemoveBuoy(), RemoveDock(), RemoveFromRailBaseStation(), RemoveLock(), RemoveNearbyStations(), RemoveRoad(), RemoveRoadStop(), RemoveRoadWaypointStop(), ReplaceChain(), ReplaceFreeUnit(), ReportNewsProductionChangeIndustry(), ResetCompanyLivery(), ReverseTrainDirection(), RoadVehArrivesAt(), RoadVehicleChangeInfo(), LGRJChunkHandler::Save(), STNNChunkHandler::Save(), CITYChunkHandler::Save(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), StoryBookWindow::SelectNextPage(), StoryBookWindow::SelectPrevPage(), SendAllVehiclesToDepot(), ServerNetworkAdminSocketHandler::SendCompanyInfo(), ServerNetworkAdminSocketHandler::SendCompanyUpdate(), SetViewportCatchmentStation(), SetViewportCatchmentTown(), SetViewportCatchmentWaypoint(), SetViewportStationRect(), SetViewportWaypointRect(), 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(), TriggerIndustryProduction(), TryPathReserve(), UpdateAircraftSpeed(), UpdateAirplanesOnNewStation(), UpdateCompanyGroupLiveries(), UpdateCompanyRatingAndValue(), UpdateCompanyRoadInfrastructure(), UpdateNearestTownForRoadTiles(), UpdateObjectColours(), UpdateOrderDest(), UpdateStationAcceptance(), UpdateStationRating(), UpdateTownGrowth(), UpdateTownGrowthRate(), UpdateVehicleTimetable(), BuyCompanyWindow::UpdateWidgetSize(), SelectStationWindow< T >::UpdateWidgetSize(), VehicleEnterDepot(), VehicleEnteredDepotThisTick(), VehicleNameSorter(), VehicleServiceInDepot(), LinkGraphJob::~LinkGraphJob(), and Station::~Station().