tess 0.4.0
Performance-first tile and path simulation substrate
Loading...
Searching...
No Matches
tess::PathRequestRuntime Class Reference

#include <tess/path/path_runtime.h>

Public Member Functions

void reserve_requests (std::size_t count)
void reserve_path_nodes (std::size_t count)
void reserve_search_nodes (std::size_t count)
void reserve_unit_routes (std::size_t count)
void reserve_unit_field_products (std::size_t count)
void reserve_unit_field_product_dependencies (std::size_t count)
void reserve_portal_segments (std::size_t count)
void clear_requests () noexcept
void clear_caches () noexcept
auto submit (PathRequest request) -> PathTicket
auto requests () const noexcept -> std::span< const PathRequest >
auto results () const noexcept -> std::span< const PathResult >
auto result (PathTicket ticket) const noexcept -> PathResult
auto route_cache () noexcept -> RouteCacheScratch &
auto route_cache () const noexcept -> const RouteCacheScratch &
auto portal_segment_cache () noexcept -> WeightedPortalSegmentCache &
auto portal_segment_cache () const noexcept -> const WeightedPortalSegmentCache &
auto stats () const noexcept -> PathRuntimeStats
template<typename World, typename ClassOrTag>
auto process_unit_cached (const World &world, PathRuntimeCachePolicy policy={}, const RegionGraphT< typename World::residency_type > *graph=nullptr) -> std::span< const PathResult >
template<typename World, typename Class, std::uint32_t MaxCost>
auto process_weighted_batch (const World &world, PathRuntimeCachePolicy policy={}, const RegionGraphT< typename World::residency_type > *graph=nullptr) -> std::span< const PathResult >
template<typename World, typename PassableTag, typename CostTag, std::uint32_t MaxCost>
auto process_weighted_batch (const World &world, PathRuntimeCachePolicy policy={}, const RegionGraphT< typename World::residency_type > *graph=nullptr) -> std::span< const PathResult >

Detailed Description

Owns a reusable batch of path requests, results, scratch, and caches.

Bind one runtime to one world. Cache fingerprints describe world content, not object identity, so sharing a runtime between worlds with matching version counters can serve stale routes. Results and their PathView data are borrowed from runtime-owned buffers and are invalidated by the next process call or clear_requests().

Submission and processing may allocate unless the matching reserve_*() methods have provisioned sufficient capacity. The runtime is not internally synchronized; confine it to one thread or externally synchronize every use.

Member Function Documentation

◆ clear_caches()

void tess::PathRequestRuntime::clear_caches ( )
inlinenoexcept

Clears all caches without removing submitted requests.

◆ clear_requests()

void tess::PathRequestRuntime::clear_requests ( )
inlinenoexcept

Clears requests and results and invalidates every outstanding ticket and result view. Cache contents are retained for reuse.

◆ portal_segment_cache() [1/2]

auto tess::PathRequestRuntime::portal_segment_cache ( ) const -> const WeightedPortalSegmentCache &
inlinenodiscardnoexcept

Const overload of portal_segment_cache().

◆ portal_segment_cache() [2/2]

auto tess::PathRequestRuntime::portal_segment_cache ( ) -> WeightedPortalSegmentCache &
inlinenodiscardnoexcept

Returns the runtime-owned weighted portal-segment cache.

◆ process_unit_cached()

template<typename World, typename ClassOrTag>
auto tess::PathRequestRuntime::process_unit_cached ( const World & world,
PathRuntimeCachePolicy policy = {},
const RegionGraphT< typename World::residency_type > * graph = nullptr ) -> std::span< const PathResult >
inlinenodiscard

Processes all submitted requests with cached unit-cost A*.

An optional graph enables a topology precheck. A graph built for another movement class degrades to no pruning rather than rejecting a valid path. The runtime binds its unit caches to ClassOrTag; changing class clears those caches. The returned span and every result path are borrowed and are invalidated by the next process or clear operation. Processing may allocate unless all relevant runtime and cache capacities were reserved.

◆ process_weighted_batch() [1/2]

template<typename World, typename PassableTag, typename CostTag, std::uint32_t MaxCost>
auto tess::PathRequestRuntime::process_weighted_batch ( const World & world,
PathRuntimeCachePolicy policy = {},
const RegionGraphT< typename World::residency_type > * graph = nullptr ) -> std::span< const PathResult >
inlinenodiscard

Processes a legacy passability/cost-tag pair as a weighted batch.

The precheck uses the passability tag's identity class. Result lifetime and allocation behavior match process_unit_cached().

◆ process_weighted_batch() [2/2]

template<typename World, typename Class, std::uint32_t MaxCost>
auto tess::PathRequestRuntime::process_weighted_batch ( const World & world,
PathRuntimeCachePolicy policy = {},
const RegionGraphT< typename World::residency_type > * graph = nullptr ) -> std::span< const PathResult >
inlinenodiscard

Processes the batch with one movement class for weighted search and precheck. A mismatched graph disables pruning. Result lifetime and allocation behavior match process_unit_cached().

◆ requests()

auto tess::PathRequestRuntime::requests ( ) const -> std::span< const PathRequest >
inlinenodiscardnoexcept

Borrows submitted requests until the next submission or clear operation.

◆ reserve_path_nodes()

void tess::PathRequestRuntime::reserve_path_nodes ( std::size_t count)
inline

Reserves result and cache path-node storage.

◆ reserve_portal_segments()

void tess::PathRequestRuntime::reserve_portal_segments ( std::size_t count)
inline

Reserves weighted portal-segment cache entries.

◆ reserve_requests()

void tess::PathRequestRuntime::reserve_requests ( std::size_t count)
inline

Reserves request/result batch storage to reduce later allocations.

◆ reserve_search_nodes()

void tess::PathRequestRuntime::reserve_search_nodes ( std::size_t count)
inline

Reserves node-search scratch across unit and weighted searches.

◆ reserve_unit_field_product_dependencies()

void tess::PathRequestRuntime::reserve_unit_field_product_dependencies ( std::size_t count)
inline

Reserves dependency-key storage for unit field products.

Reserve World::chunk_count: dependency sets are bounded by, and failed products can equal, that count.

◆ reserve_unit_field_products()

void tess::PathRequestRuntime::reserve_unit_field_products ( std::size_t count)
inline

Reserves unit distance-field product cache entries.

◆ reserve_unit_routes()

void tess::PathRequestRuntime::reserve_unit_routes ( std::size_t count)
inline

Reserves unit-route cache entries.

◆ result()

auto tess::PathRequestRuntime::result ( PathTicket ticket) const -> PathResult
inlinenodiscardnoexcept

Returns a result by ticket.

The ticket must originate from this runtime. Stale and out-of-range tickets assert in debug builds and return PathStatus::NoPath in release builds. The returned result's path view follows the runtime result lifetime documented on the class.

◆ results()

auto tess::PathRequestRuntime::results ( ) const -> std::span< const PathResult >
inlinenodiscardnoexcept

Borrows the current result array until the next process or clear operation.

◆ route_cache() [1/2]

auto tess::PathRequestRuntime::route_cache ( ) const -> const RouteCacheScratch &
inlinenodiscardnoexcept

Const overload of route_cache().

◆ route_cache() [2/2]

auto tess::PathRequestRuntime::route_cache ( ) -> RouteCacheScratch &
inlinenodiscardnoexcept

Returns the runtime-owned unit-route cache for tuning or inspection.

◆ stats()

auto tess::PathRequestRuntime::stats ( ) const -> PathRuntimeStats
inlinenodiscardnoexcept

Returns a by-value snapshot of current runtime and cache counters.

◆ submit()

auto tess::PathRequestRuntime::submit ( PathRequest request) -> PathTicket
inlinenodiscard

Appends a request and returns its generation-stamped ticket.

This may allocate unless request storage was reserved.


The documentation for this class was generated from the following file: