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

#include <tess/path/path_view.h>

Public Member Functions

constexpr PathView () noexcept=default
constexpr PathView (std::span< const Coord3 > nodes) noexcept
 PathView (const std::vector< Coord3 > &nodes) noexcept
 PathView (std::vector< Coord3 > &&)=delete
 PathView (const std::vector< Coord3 > &&)=delete
constexpr auto size () const noexcept -> std::size_t
constexpr auto empty () const noexcept -> bool
constexpr auto operator[] (std::size_t index) const noexcept -> const Coord3 &
constexpr auto front () const noexcept -> const Coord3 &
constexpr auto back () const noexcept -> const Coord3 &
constexpr auto begin () const noexcept
constexpr auto end () const noexcept
constexpr auto data () const noexcept -> const Coord3 *
constexpr auto span () const noexcept -> std::span< const Coord3 >
constexpr auto suffix (std::size_t offset) const noexcept -> PathView

Detailed Description

Non-owning, read-only view over a path's coordinates.

Copying a PathView never copies path data. The view has the lifetime of its backing storage: a view returned from scratch search state is invalidated by the next query that reuses that state, and a runtime result view is invalidated by the next process or clear operation. The caller must keep a directly supplied span or vector alive. Concurrent reads are safe only while no owner mutates or reuses the backing storage.

Constructor & Destructor Documentation

◆ PathView() [1/5]

tess::PathView::PathView ( )
constexprdefaultnoexcept

Constructs an empty view.

◆ PathView() [2/5]

tess::PathView::PathView ( std::span< const Coord3 > nodes)
inlineconstexprnoexcept

Borrows nodes; the caller retains ownership of the elements.

◆ PathView() [3/5]

tess::PathView::PathView ( const std::vector< Coord3 > & nodes)
inlinenoexcept

Borrows an lvalue vector; the vector must outlive the view.

◆ PathView() [4/5]

tess::PathView::PathView ( std::vector< Coord3 > && )
delete

Rejects a temporary vector whose elements would immediately dangle.

◆ PathView() [5/5]

tess::PathView::PathView ( const std::vector< Coord3 > && )
delete

Rejects a const temporary vector whose elements would immediately dangle.

Member Function Documentation

◆ back()

auto tess::PathView::back ( ) const -> const Coord3 &
inlinenodiscardconstexprnoexcept

Returns the last coordinate; the view must not be empty.

◆ begin()

auto tess::PathView::begin ( ) const
inlinenodiscardconstexprnoexcept

Returns an iterator to the first coordinate.

◆ data()

auto tess::PathView::data ( ) const -> const Coord3 *
inlinenodiscardconstexprnoexcept

Returns the borrowed coordinate array; the empty-view value is unspecified.

◆ empty()

auto tess::PathView::empty ( ) const -> bool
inlinenodiscardconstexprnoexcept

Returns whether the view contains no coordinates.

◆ end()

auto tess::PathView::end ( ) const
inlinenodiscardconstexprnoexcept

Returns the past-the-end iterator.

◆ front()

auto tess::PathView::front ( ) const -> const Coord3 &
inlinenodiscardconstexprnoexcept

Returns the first coordinate; the view must not be empty.

◆ operator[]()

auto tess::PathView::operator[] ( std::size_t index) const -> const Coord3 &
inlinenodiscardconstexprnoexcept

Returns a coordinate; index must be less than size().

◆ size()

auto tess::PathView::size ( ) const -> std::size_t
inlinenodiscardconstexprnoexcept

Returns the number of coordinates in the view.

◆ span()

auto tess::PathView::span ( ) const -> std::span< const Coord3 >
inlinenodiscardconstexprnoexcept

Returns the underlying borrowed span without copying path data.

◆ suffix()

auto tess::PathView::suffix ( std::size_t offset) const -> PathView
inlinenodiscardconstexprnoexcept

Returns the remaining path from offset without copying path data.

The offset is bounds-clamped, so an offset at or past the end returns an empty view. The result shares this view's backing storage and lifetime.


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