|
tess 1.0.0
Performance-first tile and path simulation substrate
|
#include <tess/path/field_product_cache.h>
Public Member Functions | |
| FieldProductCache (std::size_t byte_budget=std::numeric_limits< std::size_t >::max()) noexcept | |
| void | set_byte_budget (std::size_t byte_budget) |
| void | reserve_entries (std::size_t count) |
| auto | can_fit_distance_storage (std::size_t node_count) const noexcept -> bool |
| void | clear () noexcept |
| void | reset_stats () noexcept |
| auto | stats () const noexcept -> FieldProductCacheStats |
| template<typename World, typename Tag> | |
| auto | lookup (const World &world, const GoalSet &goals) -> const DistanceFieldProduct * |
| template<typename World, typename Tag, typename Provider> | |
| auto | lookup (const World &world, const GoalSet &goals, const Provider &provider) -> const DistanceFieldProduct * |
| Looks up a product for the exact provider type and revision. | |
| template<typename World, typename Class, typename Provider> | |
| auto | lookup_weighted (const World &world, const GoalSet &goals, const Provider &provider) -> const DistanceFieldProduct * |
| Looks up a weighted product for the exact movement class and provider. | |
| template<typename World, typename Class> | |
| auto | lookup_weighted (const World &world, const GoalSet &goals) -> const DistanceFieldProduct * |
| Looks up a weighted product using regular adjacent transitions. | |
| template<typename World, typename Tag> | |
| auto | store (DistanceFieldProduct &&product) -> bool |
| template<typename World, typename Tag, typename Provider> | |
| auto | store (DistanceFieldProduct &&product, const Provider &provider) -> bool |
| Stores a product under the exact provider type and revision. | |
| template<typename World, typename Tag, typename Provider> | |
| auto | store_reusing (DistanceFieldProduct &product, const Provider &provider) -> const DistanceFieldProduct * |
| template<typename World, typename Tag> | |
| auto | store_reusing (DistanceFieldProduct &product) -> const DistanceFieldProduct * |
| Stores a product built for ordinary adjacent transitions. | |
| template<typename World, typename Class, typename Provider> | |
| auto | store_weighted (DistanceFieldProduct &&product, const Provider &provider) -> bool |
| Stores a weighted product under its movement class and provider. | |
| template<typename World, typename Class, typename Provider> | |
| auto | store_weighted_reusing (DistanceFieldProduct &product, const Provider &provider) -> const DistanceFieldProduct * |
| template<typename World, typename Class> | |
| auto | store_weighted (DistanceFieldProduct &&product) -> bool |
| Stores a weighted product using regular adjacent transitions. | |
Static Public Member Functions | |
| static auto | key_matches_product (const Key &key, const DistanceFieldProduct &product) noexcept -> bool |
Owns LRU-cached distance-field products within a configurable byte budget.
Entries are keyed by field type, shape, goals, and exact provider instance plus revision, but not by world identity; use one cache per world. Historical provider revisions remain distinct entries until normal LRU eviction, so configure a finite byte budget when provider state changes without bound. A stateful provider must stay address-stable while its products can be retained, and the cache must be cleared before that object is destroyed. Moving the cache is safe because it does not move the externally owned provider. Lookup pointers remain cache-owned and are invalidated when their entry is replaced, evicted, or cleared. Model identities are process-local; do not share a cache across a dynamic-library boundary.
|
inline |
Stores a product and returns it, leaving product holding reusable storage the cache displaced. Prefer this when rebuilding in place.
|
inline |
Stores a weighted product and returns it, leaving product holding reusable storage the cache displaced.