Simple vector template class. More...
#include <smallvec_type.hpp>
Public Member Functions | |
template<uint X> | |
SmallVector (const SmallVector< T, X > &other) | |
Copy constructor. | |
template<uint X> | |
SmallVector & | operator= (const SmallVector< T, X > &other) |
Assignment. | |
FORCEINLINE void | Clear () |
Remove all items from the list. | |
FORCEINLINE void | Reset () |
Remove all items from the list and free allocated memory. | |
FORCEINLINE void | Compact () |
Compact the list down to the smallest block size boundary. | |
FORCEINLINE T * | Append (uint to_add=1) |
Append an item and return it. | |
FORCEINLINE const T * | Find (const T &item) const |
Search for the first occurrence of an item. | |
FORCEINLINE T * | Find (const T &item) |
Search for the first occurrence of an item. | |
FORCEINLINE int | FindIndex (const T &item) |
Search for the first occurrence of an item. | |
FORCEINLINE bool | Contains (const T &item) const |
Tests whether a item is present in the vector. | |
FORCEINLINE void | Erase (T *item) |
Removes given item from this vector. | |
FORCEINLINE bool | Include (const T &item) |
Tests whether a item is present in the vector, and appends it to the end if not. | |
FORCEINLINE uint | Length () const |
Get the number of items in the list. | |
FORCEINLINE const T * | Begin () const |
Get the pointer to the first item (const). | |
FORCEINLINE T * | Begin () |
Get the pointer to the first item. | |
FORCEINLINE const T * | End () const |
Get the pointer behind the last valid item (const). | |
FORCEINLINE T * | End () |
Get the pointer behind the last valid item. | |
FORCEINLINE const T * | Get (uint index) const |
Get the pointer to item "number" (const). | |
FORCEINLINE T * | Get (uint index) |
Get the pointer to item "number". | |
FORCEINLINE const T & | operator[] (uint index) const |
Get item "number" (const). | |
FORCEINLINE T & | operator[] (uint index) |
Get item "number". | |
Protected Attributes | |
T * | data |
The pointer to the first item. | |
uint | items |
The number of items stored. | |
uint | capacity |
The available space for storing items. |
Simple vector template class.
T | The type of the items stored | |
S | The steps of allocation |
Definition at line 29 of file smallvec_type.hpp.
SmallVector< T, S >::SmallVector | ( | const SmallVector< T, X > & | other | ) | [inline] |
Copy constructor.
other | The other vector to copy. |
Definition at line 43 of file smallvec_type.hpp.
FORCEINLINE T* SmallVector< T, S >::Append | ( | uint | to_add = 1 |
) | [inline] |
Append an item and return it.
to_add | the number of items to append |
Definition at line 104 of file smallvec_type.hpp.
Referenced by OutputStore::Add(), NetworkClientListPopupWindow::AddAction(), AddChildSpriteScreen(), FiosFileScanner::AddFile(), AddMissingIndustryLinks(), AddNearbyStation(), PacketReader::AddPacket(), AddSortableSpriteToDraw(), AddTileSpriteToDraw(), CompanyLeagueWindow::BuildCompanyList(), NetworkContentListWindow::BuildContentList(), BuildDepotVehicleList(), VehicleGroupWindow::BuildGroupList(), NetworkGameWindow::BuildNetworkGameList(), IndustryDirectoryWindow::BuildSortIndustriesList(), CompanyStationsWindow::BuildStationsList(), CheckFlatLandRailStation(), CmdBuildRailStation(), CmdConvertRail(), IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), CreateNewLinks(), Town::CreateSpecialLinks(), CargoSourceSink::CreateSpecialLinks(), ClientNetworkContentSocketHandler::DownloadContentInfo(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), DrawString(), FindIndustryToDeliver(), FindRouteLinkForCargo(), FindStationsNearby(), FiosGetFileList(), ReplaceVehicleWindow::GenerateReplaceVehList(), GenerateVehicleSortList(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), GetGRFPresetList(), GetLanguageList(), GetNewEngine(), GRFConfig::GRFConfig(), HandleParameterInfo(), SmallVector< RefitOption, 32 >::Include(), IniLoadSettingList(), Window::InvalidateData(), MakeTrainBackup(), NetworkFindBroadcastIPsInternal(), NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(), NetworkServerKickOrBanIP(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), NewGRFWindow::OnClick(), ClientNetworkContentSocketHandler::OnReceiveData(), SmallVector< RefitOption, 32 >::operator=(), PoolBase::PoolBase(), CargoDestinationList::RebuildList(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), ClientNetworkContentSocketHandler::RequestContentList(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), CYapfOriginRouteLinkT< Types >::SetOrigin(), ShowBuildBridgeWindow(), SmallVector< RefitOption, 32 >::SmallVector(), TCPConnecter::TCPConnecter(), and MemoryDumper::WriteByte().
FORCEINLINE T* SmallVector< T, S >::Begin | ( | ) | [inline] |
Get the pointer to the first item.
Definition at line 221 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::Begin | ( | ) | const [inline] |
Get the pointer to the first item (const).
Definition at line 211 of file smallvec_type.hpp.
Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::AcceptClient(), FiosFileScanner::AddFile(), ClientNetworkContentSocketHandler::Begin(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), PoolBase::Clean(), ClientNetworkContentSocketHandler::Clear(), LoadCheckData::Clear(), NetworkUDPSocketHandler::Close(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::CloseListeners(), CmdConvertRail(), CmdRemoveFromRailStation(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(), ClientNetworkContentSocketHandler::DownloadSelectedContentHTTP(), NetworkContentListWindow::DrawDetails(), CargoDestinationList::DrawList(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), EngList_Sort(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseAirportsArray(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinaliseObjectsArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), FindClearedObject(), SmallVector< RefitOption, 32 >::FindIndex(), FiosGetFileList(), GetBindAddresses(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::GetDescription(), GetLanguage(), LanguageMap::GetMapping(), LanguageMap::GetReverseMapping(), HasScenario(), NetworkHTTPSocketHandler::HTTPReceive(), IniSaveSettingList(), InitializeLanguagePacks(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPBroadCast(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), ClientNetworkContentSocketHandler::OnConnect(), ClientNetworkContentSocketHandler::OnDisconnect(), ClientNetworkContentSocketHandler::OnDownloadComplete(), ClientNetworkContentSocketHandler::OnDownloadProgress(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveContentInfo(), ClientNetworkContentSocketHandler::OnReceiveData(), SmallVector< RefitOption, 32 >::operator=(), CYapfOriginRouteLinkT< Types >::PfSetStartupNodes(), Window::ProcessScheduledInvalidations(), RebuildCargoLinkCounts(), CargoDestinationList::RebuildList(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Receive(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), NetworkUDPSocketHandler::ReceivePackets(), RemoveFromRailBaseStation(), RemoveInvalidLinks(), RemoveLowestLink(), ClientNetworkContentSocketHandler::RequestContentList(), PacketReader::Reset(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), CYapfOriginRouteLinkT< Types >::SetOrigin(), SetupEngines(), ShowNetworkContentListWindow(), SmallVector< RefitOption, 32 >::SmallVector(), NetworkContentListWindow::SortContentList(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateLinkWeights(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), OutputStore::Write(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow(), and UnmappedChoiceList::~UnmappedChoiceList().
FORCEINLINE bool SmallVector< T, S >::Contains | ( | const T & | item | ) | const [inline] |
Tests whether a item is present in the vector.
The '!=' operator of T is used for comparison.
item | Item to test for |
Definition at line 169 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), RefitWindow::BuildRefitList(), CheckHotkeyMatch(), ClientNetworkContentSocketHandler::DownloadContentInfo(), RefitWindow::DrawWidget(), BuildVehicleWindow::FilterEngineList(), FindIndustryToDeliver(), CargoSourceSink::HasLinkTo(), SmallVector< RefitOption, 32 >::Include(), NetworkFindBroadcastIPsInternal(), RefitVehicle(), and WhoCanServiceIndustry().
FORCEINLINE T* SmallVector< T, S >::End | ( | ) | [inline] |
Get the pointer behind the last valid item.
Definition at line 241 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::End | ( | ) | const [inline] |
Get the pointer behind the last valid item (const).
Definition at line 231 of file smallvec_type.hpp.
Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::AcceptClient(), AddCombinedSprite(), FiosFileScanner::AddFile(), ChangeGRFParamValueNames(), TCPConnecter::CheckCallbacks(), ClientNetworkContentSocketHandler::CheckDependencyState(), CheckSubsidised(), PoolBase::Clean(), ClientNetworkContentSocketHandler::Clear(), LoadCheckData::Clear(), NetworkUDPSocketHandler::Close(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::CloseListeners(), CmdConvertRail(), CmdRemoveFromRailStation(), SmallVector< RefitOption, 32 >::Contains(), ClientNetworkContentSocketHandler::DownloadSelectedContent(), ClientNetworkContentSocketHandler::DownloadSelectedContentHTTP(), NetworkContentListWindow::DrawDetails(), CargoDestinationList::DrawList(), NetworkContentListWindow::DrawMatrix(), DrawString(), NetworkClientListPopupWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), ClientNetworkContentSocketHandler::End(), SmallVector< RefitOption, 32 >::Erase(), NetworkContentListWindow::FilterContentList(), FinaliseAirportsArray(), FinaliseHouseArray(), FinaliseIndustriesArray(), FinaliseObjectsArray(), FinalisePriceBaseMultipliers(), SmallVector< RefitOption, 32 >::Find(), FindClearedObject(), SmallVector< RefitOption, 32 >::FindIndex(), GamelogPrint(), GetBindAddresses(), GetCargoSummaryOfArticulatedVehicle(), ClientNetworkContentSocketHandler::GetContent(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::GetDescription(), GetLanguage(), LanguageMap::GetMapping(), CargoSourceSink::GetRandomLink(), LanguageMap::GetReverseMapping(), HasScenario(), NetworkHTTPSocketHandler::HTTPReceive(), IniSaveSettingList(), InitializeLanguagePacks(), TCPConnecter::KillAll(), NetworkUDPSocketHandler::Listen(), LoadUnloadStation(), MoveCargoWithDestinationToStationWorker(), MoveWaypointsToBaseStations(), NetworkFindBroadcastIPs(), NetworkUDPBroadCast(), NetworkUDPSocketHandler::NetworkUDPSocketHandler(), ClientNetworkContentSocketHandler::OnConnect(), ClientNetworkContentSocketHandler::OnDisconnect(), ClientNetworkContentSocketHandler::OnDownloadComplete(), ClientNetworkContentSocketHandler::OnDownloadProgress(), NetworkContentListWindow::OnInvalidateData(), ClientNetworkContentSocketHandler::OnReceiveContentInfo(), CYapfOriginRouteLinkT< Types >::PfSetStartupNodes(), Window::ProcessScheduledInvalidations(), RebuildCargoLinkCounts(), CargoDestinationList::RebuildList(), TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Receive(), ClientNetworkContentSocketHandler::Receive_SERVER_INFO(), NetworkUDPSocketHandler::ReceivePackets(), RemoveFromRailBaseStation(), RemoveInvalidLinks(), RemoveLowestLink(), ClientNetworkContentSocketHandler::RequestContentList(), RestoreTrainBackup(), ClientNetworkContentSocketHandler::ReverseLookupDependency(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), ClientNetworkContentSocketHandler::SelectAll(), ClientNetworkContentSocketHandler::SelectUpgrade(), NetworkUDPSocketHandler::SendPacket(), CYapfOriginRouteLinkT< Types >::SetOrigin(), SetupEngines(), ShowNetworkContentListWindow(), NetworkContentListWindow::SortContentList(), ClientNetworkContentSocketHandler::UnselectAll(), UpdateLinkWeights(), UpdateWaypointOrder(), NetworkClientListPopupWindow::UpdateWidgetSize(), ViewportDrawBoundingBoxes(), ViewportSortParentSprites(), OutputStore::Write(), BaseSet< MusicSet, NUM_SONGS_AVAILABLE, GM_DIR >::~BaseSet(), ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler(), NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow(), and UnmappedChoiceList::~UnmappedChoiceList().
FORCEINLINE void SmallVector< T, S >::Erase | ( | T * | item | ) | [inline] |
Removes given item from this vector.
item | item to remove |
Reimplemented in SmallMap< NetworkAddress, SOCKET, 4 >.
Definition at line 179 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), TCPConnecter::CheckCallbacks(), Town::CreateSpecialLinks(), NetworkHTTPSocketHandler::HTTPReceive(), ClientNetworkContentSocketHandler::RemoveCallback(), RemoveInvalidLinks(), RemoveLowestLink(), and PoolBase::~PoolBase().
FORCEINLINE T* SmallVector< T, S >::Find | ( | const T & | item | ) | [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 137 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::Find | ( | const T & | item | ) | const [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 123 of file smallvec_type.hpp.
Referenced by SmallVector< RefitOption, 32 >::Contains(), GetCargoSummaryOfArticulatedVehicle(), MoveCargoWithDestinationToStationWorker(), ClientNetworkContentSocketHandler::RemoveCallback(), RemoveLowestLink(), and PoolBase::~PoolBase().
FORCEINLINE int SmallVector< T, S >::FindIndex | ( | const T & | item | ) | [inline] |
Search for the first occurrence of an item.
The '!=' operator of T is used for comparison.
item | Item to search for |
Definition at line 151 of file smallvec_type.hpp.
Referenced by FinalisePriceBaseMultipliers().
FORCEINLINE T* SmallVector< T, S >::Get | ( | uint | index | ) | [inline] |
Get the pointer to item "number".
index | the position of the item |
Definition at line 265 of file smallvec_type.hpp.
FORCEINLINE const T* SmallVector< T, S >::Get | ( | uint | index | ) | const [inline] |
Get the pointer to item "number" (const).
index | the position of the item |
Definition at line 252 of file smallvec_type.hpp.
Referenced by AddNearbyStation(), Town::CreateSpecialLinks(), CargoSourceSink::CreateSpecialLinks(), NetworkContentListWindow::DrawMatrix(), BuildBridgeWindow::DrawWidget(), EngList_SortPartial(), FiosGetFileList(), ClientNetworkContentSocketHandler::Get(), GetNewEngine(), GRFParameterInfo::GRFParameterInfo(), NetworkContentListWindow::OnClick(), NetworkContentListWindow::OnKeyPress(), UpdateExpectedLinks(), UpdateLinkWeights(), BuildBridgeWindow::UpdateWidgetSize(), and GRFParameterInfo::~GRFParameterInfo().
FORCEINLINE bool SmallVector< T, S >::Include | ( | const T & | item | ) | [inline] |
Tests whether a item is present in the vector, and appends it to the end if not.
The '!=' operator of T is used for comparison.
item | Item to test for |
Definition at line 191 of file smallvec_type.hpp.
Referenced by ClientNetworkContentSocketHandler::AddCallback(), Hotkey< TerraformToolbarWindow >::AddKeycode(), RefitWindow::BuildRefitList(), CheckSubsidised(), DeliverGoodsToIndustry(), FindStationsAroundTiles(), NetworkContentDownloadStatusWindow::OnDownloadProgress(), RemoveFromRailBaseStation(), ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(), and UpdateTrainPowerProc().
SmallVector& SmallVector< T, S >::operator= | ( | const SmallVector< T, X > & | other | ) | [inline] |
FORCEINLINE T& SmallVector< T, S >::operator[] | ( | uint | index | ) | [inline] |
Get item "number".
index | the position of the item |
Definition at line 290 of file smallvec_type.hpp.
FORCEINLINE const T& SmallVector< T, S >::operator[] | ( | uint | index | ) | const [inline] |
Get item "number" (const).
index | the position of the item |
Definition at line 278 of file smallvec_type.hpp.