|
tess 1.0.0
Performance-first tile and path simulation substrate
|
#include <tess/path/route_cache.h>
Public Member Functions | |
| void | set_caps (UnitRouteCacheLimits limits) noexcept |
| void | reserve_routes (std::size_t route_count) |
| void | reserve_path_nodes (std::size_t node_count) |
| void | clear () noexcept |
| void | bind_class (std::uintptr_t identity) noexcept |
| void | bind_provider (std::uintptr_t type_identity, const void *instance_identity, std::uint64_t revision) noexcept |
| void | bind_missing_chunk_policy (MissingChunkPolicy policy) noexcept |
| void | invalidate () noexcept |
| void | set_staleness (UnitRouteStaleness staleness) noexcept |
| auto | staleness () const noexcept -> UnitRouteStaleness |
| void | set_dependency_cap (std::size_t max_dependency_pairs) noexcept |
| template<typename World> | |
| auto | refresh_if_world_changed (const World &world) -> bool |
| void | reset_stats () noexcept |
| template<typename World> | |
| void | capture_world_versions (const World &world) noexcept |
| template<typename World> | |
| auto | invalidate_if_world_changed (const World &world) noexcept -> bool |
| auto | stats () const noexcept -> UnitRouteCacheStats |
Static Public Attributes | |
| static constexpr std::size_t | default_max_entries = 512 |
| static constexpr std::size_t | default_max_path_nodes = std::size_t{1} << 20u |
Friends | |
| template<typename World, typename Tag> | |
| auto | cached_astar_path (const World &world, PathRequest request, PathScratch &scratch, UnitRouteCache &cache, MissingChunkPolicy policy=MissingChunkPolicy::ReportIndeterminate) -> PathResult |
| Finds a cached empty-provider route or computes and stores one. | |
| template<typename World, typename Tag, typename Provider> | |
| auto | cached_astar_path (const World &world, PathRequest request, PathScratch &scratch, UnitRouteCache &cache, const Provider &provider, MissingChunkPolicy policy=MissingChunkPolicy::ReportIndeterminate) -> PathResult |
| Runs unit A* with exact and same-goal suffix reuse from caller-owned cache. | |
Bounded cache for exact and same-goal suffix unit routes.
Class and provider identities are process-local; do not share this cache across a dynamic-library boundary.
|
friend |
Finds a cached empty-provider route or computes and stores one.
Contract: cached_astar_path never refreshes cache against the world by itself (the refresh scans world versions: O(chunk_count) on dense worlds, O(resident_count) on sparse ones – paid once per edit batch rather than per lookup). Direct adopters must therefore run cache.refresh_if_world_changed(world) at two points:
PathRequestRuntime performs the refresh once per batch in prepare_process under the DEFAULT cache policy; a runtime caller that sets PathRuntimeCachePolicy::invalidate_unit_route_cache_on_world_change to false opts out of that and carries this obligation directly. The definition in route_cache.h carries the full staleness contract, including the exact-mode alternatives.