|
OpenTTD Source 20251104-master-g3befbdd52f
|
Class for pooled persistent storage of data. More...
#include <newgrf_storage.h>
Public Member Functions | |
| PersistentStorage (const uint32_t new_grfid, GrfSpecFeature feature, TileIndex tile) | |
| We don't want GCC to zero our struct! It already is zeroed and has an index! | |
Public Member Functions inherited from PersistentStorageArray< int32_t, 256 > | |
| void | StoreValue (uint pos, int32_t value) |
| Stores some value at a given position. | |
| int32_t | GetValue (uint pos) const |
| Gets the value from a given position. | |
| void | ClearChanges () override |
| Discard temporary changes. | |
Public Member Functions inherited from BasePersistentStorageArray | |
| virtual | ~BasePersistentStorageArray () |
| Remove references to use. | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_persistent_storage_pool > | |
| void * | operator new (size_t size) |
| Allocates space for new Titem. | |
| void * | operator new (size_t size, Tindex 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. | |
| void | operator delete (void *p, size_t size) |
| Marks Titem as free. | |
Additional Inherited Members | |
Public Types inherited from PersistentStorageArray< int32_t, 256 > | |
| using | StorageType = std::array< int32_t, SIZE > |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_persistent_storage_pool > | |
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool |
| Type of the pool this item is going to be part of. | |
Static Public Member Functions inherited from BasePersistentStorageArray | |
| static void | SwitchMode (PersistentStorageMode mode, bool ignore_prev_mode=false) |
| Clear temporary changes made since the last call to SwitchMode, and set whether subsequent changes shall be persistent or temporary. | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_persistent_storage_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 inherited from PersistentStorageArray< int32_t, 256 > | |
| StorageType | storage |
| Memory for the storage array. | |
| std::unique_ptr< StorageType > | prev_storage |
| Temporary memory to store previous state so it can be reverted, e.g. for command tests. | |
Data Fields inherited from BasePersistentStorageArray | |
| uint32_t | grfid = 0 |
| GRFID associated to this persistent storage. A value of zero means "default". | |
| GrfSpecFeature | feature = GSF_INVALID |
| NOSAVE: Used to identify in the owner of the array in debug output. | |
| TileIndex | tile = INVALID_TILE |
| NOSAVE: Used to identify in the owner of the array in debug output. | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_persistent_storage_pool > | |
| Tindex | index |
| Index of this pool item. | |
Static Protected Member Functions inherited from BasePersistentStorageArray | |
| static bool | AreChangesPersistent () |
| Check whether currently changes to the storage shall be persistent or temporary till the next call to ClearChanges(). | |
Class for pooled persistent storage of data.
Definition at line 199 of file newgrf_storage.h.
|
inline |
We don't want GCC to zero our struct! It already is zeroed and has an index!
Definition at line 201 of file newgrf_storage.h.
References BasePersistentStorageArray::feature, BasePersistentStorageArray::grfid, and BasePersistentStorageArray::tile.