GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::Registry< T, ElementID, Container > Class Template Reference

Tightly packed set of elements with stable IDs, supporting fast iteration as well as amortized O(1) insertion, removal and lookup. More...

#include <GREM/core/data/Registry.hpp>

Public Types

using iterator = Iterator<false>
using const_iterator = Iterator<true>
using value_type = typename iterator::value_type
using allocator_type = typename Container::allocator_type
using size_type = typename Container::size_type
using difference_type = typename iterator::difference_type
using reference = typename iterator::reference
using const_reference = typename const_iterator::reference
using pointer = typename iterator::pointer
using const_pointer = typename const_iterator::pointer
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>

Public Member Functions

constexpr Registry () noexcept(noexcept(allocator_type()))
constexpr Registry (const allocator_type &allocator) noexcept
constexpr ~Registry ()=default
constexpr Registry (const Registry &other)
constexpr Registry (Registry &&other) noexcept
constexpr Registry (const Registry &other, const allocator_type &allocator)
constexpr Registry (Registry &&other, const allocator_type &allocator) noexcept
constexpr Registry & operator= (const Registry &other)=default
constexpr Registry & operator= (Registry &&) noexcept(std::allocator_traits< allocator_type >::propagate_on_container_move_assignment::value||//NOLINT(cppcoreguidelines-noexcept-move-operations, performance-noexcept-move-constructor) std::allocator_traits< allocator_type >::is_always_equal::value)=default
constexpr ElementID setFlags (ElementID key, ElementID::Flags newFlags)
constexpr const Container & getElements () const noexcept
constexpr allocator_type get_allocator () const noexcept
constexpr T * data () noexcept
constexpr const T * data () const noexcept
constexpr iterator begin () noexcept
constexpr const_iterator begin () const noexcept
constexpr const_iterator cbegin () const noexcept
constexpr iterator end () noexcept
constexpr const_iterator end () const noexcept
constexpr const_iterator cend () const noexcept
constexpr reverse_iterator rbegin () noexcept
constexpr const_reverse_iterator rbegin () const noexcept
constexpr const_reverse_iterator crbegin () const noexcept
constexpr reverse_iterator rend () noexcept
constexpr const_reverse_iterator rend () const noexcept
constexpr const_reverse_iterator crend () const noexcept
constexpr bool empty () const noexcept
constexpr size_type size () const noexcept
constexpr size_type max_size () const noexcept
constexpr bool contains (ElementID key) const noexcept
constexpr iterator find (ElementID key) noexcept
constexpr const_iterator find (ElementID key) const noexcept
constexpr ElementID id (size_type pos) const
constexpr ElementID id (const_iterator pos) const
constexpr T & at (ElementID key)
constexpr const T & at (ElementID key) const
constexpr T & operator[] (ElementID key)
constexpr const T & operator[] (ElementID key) const
constexpr reference at (size_type pos)
constexpr const_reference at (size_type pos) const
constexpr reference operator[] (size_type pos)
constexpr const_reference operator[] (size_type pos) const
template<typename ColumnType>
requires (requires(Container c) { c.template column<ColumnType>(); })
constexpr decltype(auto) column ()
template<typename ColumnType>
requires (requires(const Container c) { c.template column<ColumnType>(); })
constexpr decltype(auto) column () const
template<size_t ColumnIndex>
requires (requires(Container c) { c.template column<ColumnIndex>(); })
constexpr decltype(auto) column ()
template<size_t ColumnIndex>
requires (requires(const Container c) { c.template column<ColumnIndex>(); })
constexpr decltype(auto) column () const
constexpr void reserve (size_type newCapacity)
constexpr size_type capacity () const noexcept
constexpr void shrink_to_fit ()
constexpr void clear () noexcept
constexpr iterator insert (const T &value)
constexpr iterator insert (T &&value)
template<typename... Args>
constexpr iterator emplace (Args &&... args)
template<typename... Args>
constexpr iterator emplaceWithFlags (Flags flags, Args &&... args)
constexpr size_type erase (ElementID key)
constexpr iterator erase (const_iterator pos)
constexpr void swap (Registry &other) noexcept(noexcept(elements.swap(other.elements)) &&noexcept(elementIDs.swap(other.elementIDs)))

Friends

template<typename Predicate>
constexpr size_type erase_if (Registry &c, Predicate predicate)

Detailed Description

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
class grem::Registry< T, ElementID, Container >

Tightly packed set of elements with stable IDs, supporting fast iteration as well as amortized O(1) insertion, removal and lookup.

Template Parameters
Telement type.
ElementIDelement handle type. Must be derived from a specialization of RegistryElementIDBase with itself as the template argument.
Containerelement container type. Must provide an API similar to std::vector.

Member Typedef Documentation

◆ iterator

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::iterator = Iterator<false>

◆ const_iterator

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::const_iterator = Iterator<true>

◆ value_type

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::value_type = typename iterator::value_type

◆ allocator_type

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::allocator_type = typename Container::allocator_type

◆ size_type

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::size_type = typename Container::size_type

◆ difference_type

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::difference_type = typename iterator::difference_type

◆ reference

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::reference = typename iterator::reference

◆ const_reference

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::const_reference = typename const_iterator::reference

◆ pointer

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::pointer = typename iterator::pointer

◆ const_pointer

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::const_pointer = typename const_iterator::pointer

◆ reverse_iterator

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::reverse_iterator = std::reverse_iterator<iterator>

◆ const_reverse_iterator

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
using grem::Registry< T, ElementID, Container >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Constructor & Destructor Documentation

◆ Registry() [1/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( )
inlineconstexprnoexcept

◆ Registry() [2/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( const allocator_type & allocator)
inlineexplicitconstexprnoexcept

◆ ~Registry()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::~Registry ( )
constexprdefault

◆ Registry() [3/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( const Registry< T, ElementID, Container > & other)
inlineconstexpr

◆ Registry() [4/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( Registry< T, ElementID, Container > && other)
inlineconstexprnoexcept

◆ Registry() [5/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( const Registry< T, ElementID, Container > & other,
const allocator_type & allocator )
inlineconstexpr

◆ Registry() [6/6]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
grem::Registry< T, ElementID, Container >::Registry ( Registry< T, ElementID, Container > && other,
const allocator_type & allocator )
inlineconstexprnoexcept

Member Function Documentation

◆ operator=() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
Registry & grem::Registry< T, ElementID, Container >::operator= ( const Registry< T, ElementID, Container > & other)
constexprdefault

◆ operator=() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
Registry & grem::Registry< T, ElementID, Container >::operator= ( Registry< T, ElementID, Container > && ) const
constexprdefaultnoexcept

◆ setFlags()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
ElementID grem::Registry< T, ElementID, Container >::setFlags ( ElementID key,
ElementID::Flags newFlags )
inlineconstexpr

◆ getElements()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const Container & grem::Registry< T, ElementID, Container >::getElements ( ) const
inlinenodiscardconstexprnoexcept

◆ get_allocator()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
allocator_type grem::Registry< T, ElementID, Container >::get_allocator ( ) const
inlinenodiscardconstexprnoexcept

◆ data() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
T * grem::Registry< T, ElementID, Container >::data ( )
inlinenodiscardconstexprnoexcept

◆ data() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const T * grem::Registry< T, ElementID, Container >::data ( ) const
inlinenodiscardconstexprnoexcept

◆ begin() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::begin ( )
inlinenodiscardconstexprnoexcept

◆ begin() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_iterator grem::Registry< T, ElementID, Container >::begin ( ) const
inlinenodiscardconstexprnoexcept

◆ cbegin()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_iterator grem::Registry< T, ElementID, Container >::cbegin ( ) const
inlinenodiscardconstexprnoexcept

◆ end() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::end ( )
inlinenodiscardconstexprnoexcept

◆ end() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_iterator grem::Registry< T, ElementID, Container >::end ( ) const
inlinenodiscardconstexprnoexcept

◆ cend()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_iterator grem::Registry< T, ElementID, Container >::cend ( ) const
inlinenodiscardconstexprnoexcept

◆ rbegin() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
reverse_iterator grem::Registry< T, ElementID, Container >::rbegin ( )
inlinenodiscardconstexprnoexcept

◆ rbegin() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reverse_iterator grem::Registry< T, ElementID, Container >::rbegin ( ) const
inlinenodiscardconstexprnoexcept

◆ crbegin()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reverse_iterator grem::Registry< T, ElementID, Container >::crbegin ( ) const
inlinenodiscardconstexprnoexcept

◆ rend() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
reverse_iterator grem::Registry< T, ElementID, Container >::rend ( )
inlinenodiscardconstexprnoexcept

◆ rend() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reverse_iterator grem::Registry< T, ElementID, Container >::rend ( ) const
inlinenodiscardconstexprnoexcept

◆ crend()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reverse_iterator grem::Registry< T, ElementID, Container >::crend ( ) const
inlinenodiscardconstexprnoexcept

◆ empty()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
bool grem::Registry< T, ElementID, Container >::empty ( ) const
inlinenodiscardconstexprnoexcept

◆ size()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
size_type grem::Registry< T, ElementID, Container >::size ( ) const
inlinenodiscardconstexprnoexcept

◆ max_size()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
size_type grem::Registry< T, ElementID, Container >::max_size ( ) const
inlinenodiscardconstexprnoexcept

◆ contains()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
bool grem::Registry< T, ElementID, Container >::contains ( ElementID key) const
inlinenodiscardconstexprnoexcept

◆ find() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::find ( ElementID key)
inlinenodiscardconstexprnoexcept

◆ find() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_iterator grem::Registry< T, ElementID, Container >::find ( ElementID key) const
inlinenodiscardconstexprnoexcept

◆ id() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
ElementID grem::Registry< T, ElementID, Container >::id ( size_type pos) const
inlinenodiscardconstexpr

◆ id() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
ElementID grem::Registry< T, ElementID, Container >::id ( const_iterator pos) const
inlinenodiscardconstexpr

◆ at() [1/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
T & grem::Registry< T, ElementID, Container >::at ( ElementID key)
inlinenodiscardconstexpr

◆ at() [2/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const T & grem::Registry< T, ElementID, Container >::at ( ElementID key) const
inlinenodiscardconstexpr

◆ operator[]() [1/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
T & grem::Registry< T, ElementID, Container >::operator[] ( ElementID key)
inlinenodiscardconstexpr

◆ operator[]() [2/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const T & grem::Registry< T, ElementID, Container >::operator[] ( ElementID key) const
inlinenodiscardconstexpr

◆ at() [3/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
reference grem::Registry< T, ElementID, Container >::at ( size_type pos)
inlinenodiscardconstexpr

◆ at() [4/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reference grem::Registry< T, ElementID, Container >::at ( size_type pos) const
inlinenodiscardconstexpr

◆ operator[]() [3/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
reference grem::Registry< T, ElementID, Container >::operator[] ( size_type pos)
inlinenodiscardconstexpr

◆ operator[]() [4/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
const_reference grem::Registry< T, ElementID, Container >::operator[] ( size_type pos) const
inlinenodiscardconstexpr

◆ column() [1/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<typename ColumnType>
requires (requires(Container c) { c.template column<ColumnType>(); })
decltype(auto) grem::Registry< T, ElementID, Container >::column ( )
inlinenodiscardconstexpr

◆ column() [2/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<typename ColumnType>
requires (requires(const Container c) { c.template column<ColumnType>(); })
decltype(auto) grem::Registry< T, ElementID, Container >::column ( ) const
inlinenodiscardconstexpr

◆ column() [3/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<size_t ColumnIndex>
requires (requires(Container c) { c.template column<ColumnIndex>(); })
decltype(auto) grem::Registry< T, ElementID, Container >::column ( )
inlinenodiscardconstexpr

◆ column() [4/4]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<size_t ColumnIndex>
requires (requires(const Container c) { c.template column<ColumnIndex>(); })
decltype(auto) grem::Registry< T, ElementID, Container >::column ( ) const
inlinenodiscardconstexpr

◆ reserve()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
void grem::Registry< T, ElementID, Container >::reserve ( size_type newCapacity)
inlineconstexpr

◆ capacity()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
size_type grem::Registry< T, ElementID, Container >::capacity ( ) const
inlinenodiscardconstexprnoexcept

◆ shrink_to_fit()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
void grem::Registry< T, ElementID, Container >::shrink_to_fit ( )
inlineconstexpr

◆ clear()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
void grem::Registry< T, ElementID, Container >::clear ( )
inlineconstexprnoexcept

◆ insert() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::insert ( const T & value)
inlineconstexpr

◆ insert() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::insert ( T && value)
inlineconstexpr

◆ emplace()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<typename... Args>
iterator grem::Registry< T, ElementID, Container >::emplace ( Args &&... args)
inlineconstexpr

◆ emplaceWithFlags()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<typename... Args>
iterator grem::Registry< T, ElementID, Container >::emplaceWithFlags ( Flags flags,
Args &&... args )
inlineconstexpr

◆ erase() [1/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
size_type grem::Registry< T, ElementID, Container >::erase ( ElementID key)
inlineconstexpr

◆ erase() [2/2]

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
iterator grem::Registry< T, ElementID, Container >::erase ( const_iterator pos)
inlineconstexpr

◆ swap()

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
void grem::Registry< T, ElementID, Container >::swap ( Registry< T, ElementID, Container > & other)
inlineconstexprnoexcept

◆ erase_if

template<typename T, typename ElementID = RegistryElementID, typename Container = ArrayList<T>>
template<typename Predicate>
size_type erase_if ( Registry< T, ElementID, Container > & c,
Predicate predicate )
friend

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