NavMap
Loading...
Searching...
No Matches
LayerViewBase Struct Referenceabstract

Non-templated base for runtime layer handling. More...

#include <NavMap.hpp>

Inheritance diagram for LayerViewBase:
Collaboration diagram for LayerViewBase:

Public Member Functions

bool all_changed () const noexcept
 Whether the whole layer changed (then changed() is not meaningful).
const std::vector< NavCelId > & changed () const noexcept
 Cells changed one by one since the last clear_changes(), in order of first change.
void clear_changes () const
 Forget the recorded changes (call it once every consumer has seen them).
virtual std::shared_ptr< LayerViewBase > clone () const =0
 Independent copy of this layer (data, name, type, cached hash and pending changes).
virtual std::uint64_t content_hash () const =0
 Return 64-bit content hash (cached; recomputed lazily).
bool has_changes () const noexcept
void mark_all_changed () const noexcept
 Record that the whole layer changed.
void mark_changed (NavCelId cid) const
 Record that cell cid changed (deduplicated).
void mark_dirty () const noexcept
 Mark content dirty (forces hash recompute on next query).
virtual const std::string & name () const =0
virtual size_t size () const =0
virtual LayerType type () const =0
virtual ~LayerViewBase ()=default

Protected Attributes

bool all_changed_ {true}
std::vector< NavCelId > changed_
std::vector< std::uint64_t > changed_bits_
std::uint64_t hash_cache_ {0}
bool hash_dirty_ {true}

Detailed Description

Non-templated base for runtime layer handling.

A layer stores one scalar value per NavCel (triangle).

Constructor & Destructor Documentation

◆ ~LayerViewBase()

virtual ~LayerViewBase ( )
virtualdefault

Member Function Documentation

◆ all_changed()

bool all_changed ( ) const
noexcept

Whether the whole layer changed (then changed() is not meaningful).

◆ changed()

const std::vector< NavCelId > & changed ( ) const
noexcept

Cells changed one by one since the last clear_changes(), in order of first change.

◆ clear_changes()

void clear_changes ( ) const

Forget the recorded changes (call it once every consumer has seen them).

◆ clone()

virtual std::shared_ptr< LayerViewBase > clone ( ) const
pure virtual

Independent copy of this layer (data, name, type, cached hash and pending changes).

Implemented in LayerView< T >, and LayerView< T >.

◆ content_hash()

virtual std::uint64_t content_hash ( ) const
pure virtual

Return 64-bit content hash (cached; recomputed lazily).

Implemented in LayerView< T >, and LayerView< T >.

◆ has_changes()

bool has_changes ( ) const
noexcept

◆ mark_all_changed()

void mark_all_changed ( ) const
noexcept

Record that the whole layer changed.

◆ mark_changed()

void mark_changed ( NavCelId cid) const

Record that cell cid changed (deduplicated).

◆ mark_dirty()

void mark_dirty ( ) const
noexcept

Mark content dirty (forces hash recompute on next query).

◆ name()

virtual const std::string & name ( ) const
pure virtual
Returns
Layer name (unique within the registry).

Implemented in LayerView< T >, and LayerView< T >.

◆ size()

virtual size_t size ( ) const
pure virtual
Returns
Number of items (= number of NavCels).

Implemented in LayerView< T >, and LayerView< T >.

◆ type()

virtual LayerType type ( ) const
pure virtual
Returns
Type tag of the underlying storage.

Implemented in LayerView< T >, and LayerView< T >.

Member Data Documentation

◆ all_changed_

bool all_changed_ {true}
mutableprotected

◆ changed_

std::vector<NavCelId> changed_
mutableprotected

◆ changed_bits_

std::vector<std::uint64_t> changed_bits_
mutableprotected

◆ hash_cache_

std::uint64_t hash_cache_ {0}
mutableprotected

◆ hash_dirty_

bool hash_dirty_ {true}
mutableprotected

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