vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::EntityMapping< R(A)> Class Template Reference

Maps entities to one carrier's names for them, or back. More...

#include <entity_mapping.h>

Public Member Functions

template<typename Fn, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Fn>, EntityMapping>>>
 EntityMapping (Fn &fn) noexcept
 Wrap fn, the carrier's mapping.
R operator() (A from) const
 Map one reference.

Detailed Description

template<typename R, typename A>
class Vkm::Engine::EntityMapping< R(A)>

Maps entities to one carrier's names for them, or back.

An EntityId means nothing outside the Scene that minted it, so a reference travels as a number only its carrier (a scene file, a prefab, a connection) can read. Non-owning and type-erased: a carrier passes a stack lambda, no allocation or template. Empty in is empty out, unasked.

Template Parameters
RWhat the carrier maps to.
AWhat it maps from; zero or a null EntityId is "none".

Constructor & Destructor Documentation

◆ EntityMapping()

template<typename R, typename A>
template<typename Fn, typename = std::enable_if_t<!std::is_same_v<std::decay_t<Fn>, EntityMapping>>>
Vkm::Engine::EntityMapping< R(A)>::EntityMapping ( Fn & fn)
inlinenoexcept

Wrap fn, the carrier's mapping.

Excludes its own type, or Fn& would out-match the copy constructor for a non-const lvalue.

Template Parameters
FnCallable as R(A). Must outlive the mapping.
Parameters
fnThe carrier's mapping; never asked for "none".

Member Function Documentation

◆ operator()()

template<typename R, typename A>
R Vkm::Engine::EntityMapping< R(A)>::operator() ( A from) const
inline

Map one reference.

Parameters
fromThe entity or name; "none" maps to none without asking the carrier.
Returns
The mapped value, or none when the carrier does not hold it.

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