ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::types::mapped_registry< registry_t, type_selector_t > Class Template Reference

Select a number of types from another registry and map their IDs to a continuous range of new type indices. More...

#include <detray/utils/type_registry.hpp>

Inheritance diagram for detray::types::mapped_registry< registry_t, type_selector_t >:
[legend]
Collaboration diagram for detray::types::mapped_registry< registry_t, type_selector_t >:
[legend]

Public Types

enum  : std::size_t { n_types = detray::types::size<type_list> , e_any = detray::types::size<type_list> , e_unknown = detray::types::size<type_list> + 1u }
 Conventions for some basic info.
using id = typename registry_t::id
 Make the original type ids accessible.
using orig_types = typename registry_t::type_list
 Make the original types accessible.
using type_list
 Make the filtered types accessible.

Static Public Member Functions

static consteval auto index_map ()
static constexpr std::size_t mapped_index (const id orig_id)
 Return the filtered position corresponding to an original ID.
static constexpr std::size_t mapped_index (const std::size_t orig_idx)
 Return the filtered position corresponding to an original position.
static constexpr id original_id (const std::size_t pos)
static constexpr std::size_t original_index (const std::size_t pos)
static constexpr bool is_valid (const std::size_t filtered_type_idx)
template<typename id_t = id>
requires (!std::convertible_to<id_t, std::size_t>)
static constexpr bool is_valid (const id_t orig_id)
 Check whether an original ID selects a type retained by the mapping.

Detailed Description

template<concepts::type_registry registry_t, class type_selector_t>
class detray::types::mapped_registry< registry_t, type_selector_t >

Select a number of types from another registry and map their IDs to a continuous range of new type indices.

Note
Contrary to the original type registry, the type ID does not match the position of the filtered type in the mapped registry anymore
Template Parameters
registry_tthe original type registry
type_selector_thow to select the new types from the original ones

Member Typedef Documentation

◆ type_list

template<concepts::type_registry registry_t, class type_selector_t>
using detray::types::mapped_registry< registry_t, type_selector_t >::type_list
Initial value:
decltype(detray::types::filtered_list<orig_types, type_selector_t>())

Make the filtered types accessible.

Member Function Documentation

◆ index_map()

template<concepts::type_registry registry_t, class type_selector_t>
consteval auto detray::types::mapped_registry< registry_t, type_selector_t >::index_map ( )
staticconsteval
Returns
the array that maps the original type positions to the new ones

◆ is_valid() [1/2]

template<concepts::type_registry registry_t, class type_selector_t>
template<typename id_t = id>
requires (!std::convertible_to<id_t, std::size_t>)
constexpr bool detray::types::mapped_registry< registry_t, type_selector_t >::is_valid ( const id_t orig_id)
staticconstexpr

Check whether an original ID selects a type retained by the mapping.

Parameters
orig_idthe original type identifier (ID) to be checked
Returns
whether the identifier maps to a selected type

◆ is_valid() [2/2]

template<concepts::type_registry registry_t, class type_selector_t>
constexpr bool detray::types::mapped_registry< registry_t, type_selector_t >::is_valid ( const std::size_t filtered_type_idx)
staticconstexpr
Returns
whether a given index/identifier can be mapped to a filtered type.

Check whether a filtered index is in the mapped registry.

Parameters
filtered_type_idxthe filtered type index to be checked
Returns
whether the index is valid

◆ mapped_index() [1/2]

template<concepts::type_registry registry_t, class type_selector_t>
constexpr std::size_t detray::types::mapped_registry< registry_t, type_selector_t >::mapped_index ( const id orig_id)
staticconstexpr

Return the filtered position corresponding to an original ID.

Parameters
orig_ididentifier in the original registry
Returns
the filtered type index corresponding to the original type ID

◆ mapped_index() [2/2]

template<concepts::type_registry registry_t, class type_selector_t>
constexpr std::size_t detray::types::mapped_registry< registry_t, type_selector_t >::mapped_index ( const std::size_t orig_idx)
staticconstexpr

Return the filtered position corresponding to an original position.

Parameters
orig_idxposition in the original registry
Returns
the filtered type index corresponding to the original type index

◆ original_id()

template<concepts::type_registry registry_t, class type_selector_t>
constexpr id detray::types::mapped_registry< registry_t, type_selector_t >::original_id ( const std::size_t pos)
staticconstexpr
Parameters
posposition in the filtered type list
Returns
the original id given the new pos in the type list

◆ original_index()

template<concepts::type_registry registry_t, class type_selector_t>
constexpr std::size_t detray::types::mapped_registry< registry_t, type_selector_t >::original_index ( const std::size_t pos)
staticconstexpr
Parameters
posposition in the filtered type list
Returns
the original indexd given the new pos in the type list