IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
ice::HashMap< Type, Logic > Struct Template Reference

A Map container designed for storing values using hashed values. More...

#include <ice/hashmap.hxx>

Inheritance diagram for ice::HashMap< Type, Logic >:
ice::container::AssociativeResizableContainer ice::container::ResizableContainer ice::container::AssociativeContainer ice::container::BasicContainer ice::MultiHashMap< Type, Logic >

Classes

struct  EntryType
struct  ConstIterator

Public Types

using KeyType = ice::u64
using ValueType = Type
using ConstContainerValueType = Type const
using Iterator = ConstIterator
using SizeType = ice::ncount

Public Member Functions

 HashMap (ice::Allocator &alloc) noexcept
 ~HashMap () noexcept
 HashMap (HashMap &&other) noexcept
 HashMap (HashMap const &other) noexcept
auto operator= (HashMap &&other) noexcept -> HashMap &
auto operator= (HashMap const &other) noexcept -> HashMap &
constexpr auto size () const noexcept -> SizeType
template<typename Self>
constexpr auto find (this Self &&self, KeyType key) noexcept -> ice::container::ValuePtr< Self >
template<typename Self>
constexpr bool remove (this Self &self, KeyType key) noexcept
template<typename Self, typename InValueType = Type>
constexpr auto store (this Self &self, KeyType key, InValueType &&in_value) noexcept -> ice::container::ValueRef< Self >
template<typename Self>
constexpr auto values (this Self &&self) noexcept -> ice::container::SpanType< Self >
constexpr auto capacity () const noexcept -> SizeType
constexpr void set_capacity (ice::ncount new_capacity) noexcept
constexpr void clear () noexcept
template<typename Self>
constexpr auto begin (this Self &&self) noexcept -> ice::container::Iterator< Self >
template<typename Self>
constexpr auto end (this Self &&self) noexcept -> ice::container::Iterator< Self >
constexpr auto memory_view () noexcept -> ice::Memory
constexpr auto entries_memory_view () noexcept -> ice::Memory
constexpr auto values_data_view () const noexcept -> ice::Data
constexpr auto entries_data_view () const noexcept -> ice::Data
Public Member Functions inherited from ice::container::AssociativeResizableContainer
template<ice::concepts::AssociativeResizableContainer Self, ice::concepts::HashableKeyType KeyType, typename InValueType = typename std::remove_reference_t<Self>::ValueType>
requires (std::convertible_to<InValueType, typename Self::ValueType>)
auto set (this Self &self, KeyType const &key, InValueType &&in_value) noexcept -> ice::container::ValueRef< Self >
template<ice::concepts::AssociativeResizableContainer Self, ice::concepts::HashableKeyType KeyType, typename InValueType = typename std::remove_reference_t<Self>::ValueType>
requires (std::convertible_to<InValueType, typename Self::ValueType>)
void set_if_missing (this Self &self, KeyType const &key, InValueType &&in_value) noexcept
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType, typename InValueType = typename std::remove_reference_t<Self>::ValueType>
auto get_or_set (this Self &&self, KeyType const &key, InValueType &&in_value) noexcept -> ice::container::ValueRef< Self >
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType>
bool remove (this Self &&self, KeyType const &key) noexcept
Public Member Functions inherited from ice::container::AssociativeContainer
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType>
bool has (this Self const &self, KeyType const &key) noexcept
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType>
bool missing (this Self const &self, KeyType const &key) noexcept
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType, typename InValueType = typename std::remove_reference_t<Self>::ValueType>
auto get (this Self const &self, KeyType const &key, InValueType const &fallback_value) noexcept -> ice::container::ValueRef< Self const >
template<ice::concepts::AssociativeContainer Self, ice::concepts::HashableKeyType KeyType>
auto try_get (this Self &&self, KeyType const &key) noexcept -> ice::container::ValuePtr< Self >
Public Member Functions inherited from ice::container::BasicContainer
template<ice::concepts::Container Self>
constexpr bool is_empty (this Self const &self) noexcept
template<ice::concepts::Container Self>
constexpr bool not_empty (this Self const &self) noexcept
Public Member Functions inherited from ice::container::ResizableContainer
template<ice::concepts::ResizableContainer Self>
constexpr bool is_full (this Self const &self) noexcept
template<ice::concepts::ResizableContainer Self>
constexpr bool not_full (this Self const &self) noexcept
template<ice::concepts::ResizableContainer Self>
constexpr void reserve (this Self &self, ice::ncount min_capacity) noexcept
template<ice::concepts::ResizableContainer Self>
constexpr void grow (this Self &self, ice::ncount min_capacity=ice::ncount_none) noexcept
template<ice::concepts::ResizableContainer Self>
constexpr void shrink (this Self &self) noexcept

Public Attributes

ice::Allocator_allocator
ice::u32 _capacity
ice::u32 _count
ice::u32_hashes
EntryType_entries
ValueType_data

Static Public Attributes

static constexpr ContainerLogic OperationLogic = Logic

Detailed Description

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
struct ice::HashMap< Type, Logic >

A Map container designed for storing values using hashed values.

Note
This implementation only allows u64 keys but provides some utility to calculate hashes from well-known engine types like ice::StringID.

Manages single block of memory big enough to hold all data. The implementation seperates the storage of values and internal data into different blocks allowing to access values separately as continous data.

Template Parameters
LogicThe operation logic used during memory operations for the given type. This value can be forced by the user for specific behavior requirements.

Member Typedef Documentation

◆ ConstContainerValueType

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
using ice::HashMap< Type, Logic >::ConstContainerValueType = Type const

◆ Iterator

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
using ice::HashMap< Type, Logic >::Iterator = ConstIterator

◆ KeyType

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
using ice::HashMap< Type, Logic >::KeyType = ice::u64

◆ SizeType

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
using ice::HashMap< Type, Logic >::SizeType = ice::ncount

◆ ValueType

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
using ice::HashMap< Type, Logic >::ValueType = Type

Constructor & Destructor Documentation

◆ HashMap() [1/3]

template<typename Type, ice::ContainerLogic Logic>
ice::HashMap< Type, Logic >::HashMap ( ice::Allocator & alloc)
inlineexplicitnoexcept

◆ ~HashMap()

template<typename Type, ice::ContainerLogic Logic>
ice::HashMap< Type, Logic >::~HashMap ( )
inlinenoexcept

◆ HashMap() [2/3]

template<typename Type, ice::ContainerLogic Logic>
ice::HashMap< Type, Logic >::HashMap ( HashMap< Type, Logic > && other)
inlinenoexcept

◆ HashMap() [3/3]

template<typename Type, ice::ContainerLogic Logic>
requires std::copy_constructible<Type>
ice::HashMap< Type, Logic >::HashMap ( HashMap< Type, Logic > const & other)
inlinenoexcept

Member Function Documentation

◆ begin()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self>
auto ice::HashMap< Type, Logic >::begin ( this Self && self) -> ice::container::Iterator< Self >
inlineconstexprnoexcept

◆ capacity()

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
auto ice::HashMap< Type, Logic >::capacity ( ) const -> SizeType
inlineconstexprnoexcept

◆ clear()

template<typename Type, ice::ContainerLogic Logic>
void ice::HashMap< Type, Logic >::clear ( )
inlineconstexprnoexcept

◆ end()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self>
auto ice::HashMap< Type, Logic >::end ( this Self && self) -> ice::container::Iterator< Self >
inlineconstexprnoexcept

◆ entries_data_view()

template<typename Type, ice::ContainerLogic Logic>
auto ice::HashMap< Type, Logic >::entries_data_view ( ) const -> ice::Data
inlineconstexprnoexcept

◆ entries_memory_view()

template<typename Type, ice::ContainerLogic Logic>
auto ice::HashMap< Type, Logic >::entries_memory_view ( ) -> ice::Memory
inlineconstexprnoexcept

◆ find()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self>
auto ice::HashMap< Type, Logic >::find ( this Self && self,
KeyType key ) -> ice::container::ValuePtr< Self >
inlineconstexprnoexcept

◆ memory_view()

template<typename Type, ice::ContainerLogic Logic>
auto ice::HashMap< Type, Logic >::memory_view ( ) -> ice::Memory
inlineconstexprnoexcept

◆ operator=() [1/2]

template<typename Type, ice::ContainerLogic Logic>
auto ice::HashMap< Type, Logic >::operator= ( HashMap< Type, Logic > && other) -> HashMap &
inlinenoexcept

◆ operator=() [2/2]

template<typename Type, ice::ContainerLogic Logic>
requires std::copy_constructible<Type>
auto ice::HashMap< Type, Logic >::operator= ( HashMap< Type, Logic > const & other) -> HashMap &
inlinenoexcept

◆ remove()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self>
bool ice::HashMap< Type, Logic >::remove ( this Self & self,
KeyType key )
inlineconstexprnoexcept

◆ set_capacity()

template<typename Type, ice::ContainerLogic Logic>
void ice::HashMap< Type, Logic >::set_capacity ( ice::ncount new_capacity)
inlineconstexprnoexcept

◆ size()

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
auto ice::HashMap< Type, Logic >::size ( ) const -> SizeType
inlineconstexprnoexcept

◆ store()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self, typename InValueType>
auto ice::HashMap< Type, Logic >::store ( this Self & self,
KeyType key,
InValueType && in_value ) -> ice::container::ValueRef< Self >
inlineconstexprnoexcept

◆ values()

template<typename Type, ice::ContainerLogic Logic>
template<typename Self>
auto ice::HashMap< Type, Logic >::values ( this Self && self) -> ice::container::SpanType< Self >
inlineconstexprnoexcept

◆ values_data_view()

template<typename Type, ice::ContainerLogic Logic>
auto ice::HashMap< Type, Logic >::values_data_view ( ) const -> ice::Data
inlineconstexprnoexcept

Member Data Documentation

◆ _allocator

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ice::Allocator* ice::HashMap< Type, Logic >::_allocator

◆ _capacity

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ice::u32 ice::HashMap< Type, Logic >::_capacity

◆ _count

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ice::u32 ice::HashMap< Type, Logic >::_count

◆ _data

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ValueType* ice::HashMap< Type, Logic >::_data

◆ _entries

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
EntryType* ice::HashMap< Type, Logic >::_entries

◆ _hashes

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ice::u32* ice::HashMap< Type, Logic >::_hashes

◆ OperationLogic

template<typename Type, ice::ContainerLogic Logic = ice::Constant_DefaultContainerLogic<Type>>
ContainerLogic ice::HashMap< Type, Logic >::OperationLogic = Logic
staticconstexpr

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