EnTT 3.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_sigh_mixin< Type, Registry > Class Template Reference

Mixin type used to add signal support to storage types. More...

#include <mixin.hpp>

Inheritance diagram for entt::basic_sigh_mixin< Type, Registry >:
Inheritance graph
[legend]
Collaboration diagram for entt::basic_sigh_mixin< Type, Registry >:
Collaboration graph
[legend]

Public Types

using allocator_type = typename underlying_type::allocator_type
 Allocator type.
 
using entity_type = typename underlying_type::entity_type
 Underlying entity identifier.
 
using registry_type = owner_type
 Expected registry type.
 

Public Member Functions

 basic_sigh_mixin ()
 Default constructor.
 
 basic_sigh_mixin (const allocator_type &allocator)
 Constructs an empty storage with a given allocator.
 
 basic_sigh_mixin (const basic_sigh_mixin &)=delete
 Default copy constructor, deleted on purpose.
 
 basic_sigh_mixin (basic_sigh_mixin &&other) noexcept
 Move constructor.
 
 basic_sigh_mixin (basic_sigh_mixin &&other, const allocator_type &allocator)
 Allocator-extended move constructor.
 
 ~basic_sigh_mixin () override=default
 Default destructor.
 
basic_sigh_mixinoperator= (const basic_sigh_mixin &)=delete
 Default copy assignment operator, deleted on purpose.
 
basic_sigh_mixinoperator= (basic_sigh_mixin &&other) noexcept
 Move assignment operator.
 
void swap (basic_sigh_mixin &other) noexcept
 Exchanges the contents with those of a given storage.
 
auto on_construct () noexcept
 Returns a sink object.
 
auto on_update () noexcept
 Returns a sink object.
 
auto on_destroy () noexcept
 Returns a sink object.
 
 operator bool () const noexcept
 Checks if a mixin refers to a valid registry.
 
const registry_typeregistry () const noexcept
 Returns a pointer to the underlying registry, if any.
 
registry_typeregistry () noexcept
 Returns a pointer to the underlying registry, if any.
 
auto emplace ()
 Emplace elements into a storage.
 
template<typename... Args>
std::conditional_t< std::is_same_v< typename underlying_type::element_type, entity_type >, entity_type, decltype(std::declval< underlying_type >().get({}))> emplace (const entity_type hint, Args &&...args)
 Emplace elements into a storage.
 
template<typename... Func>
decltype(autopatch (const entity_type entt, Func &&...func)
 Patches the given instance for an entity.
 
template<typename It , typename... Args>
void insert (It first, It last, Args &&...args)
 Emplace elements into a storage.
 

Detailed Description

template<typename Type, typename Registry>
class entt::basic_sigh_mixin< Type, Registry >

Mixin type used to add signal support to storage types.

The function type of a listener is equivalent to:

Fast and reliable entity-component system.
Definition registry.hpp:234
typename underlying_type::entity_type entity_type
Underlying entity identifier.
Definition mixin.hpp:141
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
Definition memory.hpp:219

This applies to all signals made available.

Template Parameters
TypeUnderlying storage type.
RegistryBasic registry type.

Definition at line 71 of file mixin.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename Type , typename Registry >
using entt::basic_sigh_mixin< Type, Registry >::allocator_type = typename underlying_type::allocator_type

Allocator type.

Definition at line 139 of file mixin.hpp.

◆ entity_type

template<typename Type , typename Registry >
using entt::basic_sigh_mixin< Type, Registry >::entity_type = typename underlying_type::entity_type

Underlying entity identifier.

Definition at line 141 of file mixin.hpp.

◆ registry_type

template<typename Type , typename Registry >
using entt::basic_sigh_mixin< Type, Registry >::registry_type = owner_type

Expected registry type.

Definition at line 143 of file mixin.hpp.

Constructor & Destructor Documentation

◆ basic_sigh_mixin() [1/4]

template<typename Type , typename Registry >
entt::basic_sigh_mixin< Type, Registry >::basic_sigh_mixin ( )
inline

Default constructor.

Definition at line 146 of file mixin.hpp.

◆ basic_sigh_mixin() [2/4]

template<typename Type , typename Registry >
entt::basic_sigh_mixin< Type, Registry >::basic_sigh_mixin ( const allocator_type & allocator)
inlineexplicit

Constructs an empty storage with a given allocator.

Parameters
allocatorThe allocator to use.

Definition at line 153 of file mixin.hpp.

◆ basic_sigh_mixin() [3/4]

template<typename Type , typename Registry >
entt::basic_sigh_mixin< Type, Registry >::basic_sigh_mixin ( basic_sigh_mixin< Type, Registry > && other)
inlinenoexcept

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 179 of file mixin.hpp.

◆ basic_sigh_mixin() [4/4]

template<typename Type , typename Registry >
entt::basic_sigh_mixin< Type, Registry >::basic_sigh_mixin ( basic_sigh_mixin< Type, Registry > && other,
const allocator_type & allocator )
inline

Allocator-extended move constructor.

Parameters
otherThe instance to move from.
allocatorThe allocator to use.

Definition at line 191 of file mixin.hpp.

Member Function Documentation

◆ emplace() [1/2]

template<typename Type , typename Registry >
auto entt::basic_sigh_mixin< Type, Registry >::emplace ( )
inline

Emplace elements into a storage.

The behavior of this operation depends on the underlying storage type (for example, components vs entities).
Refer to the specific documentation for more details.

Returns
Whatever the underlying storage returns.

Definition at line 305 of file mixin.hpp.

◆ emplace() [2/2]

template<typename Type , typename Registry >
template<typename... Args>
std::conditional_t< std::is_same_v< typename underlying_type::element_type, entity_type >, entity_type, decltype(std::declval< underlying_type >().get({}))> entt::basic_sigh_mixin< Type, Registry >::emplace ( const entity_type hint,
Args &&... args )
inline

Emplace elements into a storage.

The behavior of this operation depends on the underlying storage type (for example, components vs entities).
Refer to the specific documentation for more details.

Template Parameters
ArgsTypes of arguments to forward to the underlying storage.
Parameters
hintA valid identifier.
argsParameters to forward to the underlying storage.
Returns
Whatever the underlying storage returns.

Definition at line 325 of file mixin.hpp.

◆ insert()

template<typename Type , typename Registry >
template<typename It , typename... Args>
void entt::basic_sigh_mixin< Type, Registry >::insert ( It first,
It last,
Args &&... args )
inline

Emplace elements into a storage.

The behavior of this operation depends on the underlying storage type (for example, components vs entities).
Refer to the specific documentation for more details.

Template Parameters
ItIterator type (as required by the underlying storage type).
ArgsTypes of arguments to forward to the underlying storage.
Parameters
firstAn iterator to the first element of the range.
lastAn iterator past the last element of the range.
argsParameters to use to forward to the underlying storage.

Definition at line 365 of file mixin.hpp.

◆ on_construct()

template<typename Type , typename Registry >
auto entt::basic_sigh_mixin< Type, Registry >::on_construct ( )
inlinenoexcept

Returns a sink object.

The sink returned by this function can be used to receive notifications whenever a new instance is created and assigned to an entity.
Listeners are invoked after the object has been assigned to the entity.

See also
sink
Returns
A temporary sink object.

Definition at line 241 of file mixin.hpp.

◆ on_destroy()

template<typename Type , typename Registry >
auto entt::basic_sigh_mixin< Type, Registry >::on_destroy ( )
inlinenoexcept

Returns a sink object.

The sink returned by this function can be used to receive notifications whenever an instance is removed from an entity and thus destroyed.
Listeners are invoked before the object has been removed from the entity.

See also
sink
Returns
A temporary sink object.

Definition at line 271 of file mixin.hpp.

◆ on_update()

template<typename Type , typename Registry >
auto entt::basic_sigh_mixin< Type, Registry >::on_update ( )
inlinenoexcept

Returns a sink object.

The sink returned by this function can be used to receive notifications whenever an instance is explicitly updated.
Listeners are invoked after the object has been updated.

See also
sink
Returns
A temporary sink object.

Definition at line 256 of file mixin.hpp.

◆ operator bool()

template<typename Type , typename Registry >
entt::basic_sigh_mixin< Type, Registry >::operator bool ( ) const
inlineexplicitnoexcept

Checks if a mixin refers to a valid registry.

Returns
True if the mixin refers to a valid registry, false otherwise.

Definition at line 279 of file mixin.hpp.

◆ operator=() [1/2]

template<typename Type , typename Registry >
basic_sigh_mixin & entt::basic_sigh_mixin< Type, Registry >::operator= ( basic_sigh_mixin< Type, Registry > && other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This mixin.

Definition at line 212 of file mixin.hpp.

◆ operator=() [2/2]

Default copy assignment operator, deleted on purpose.

Returns
This mixin.

◆ patch()

template<typename Type , typename Registry >
template<typename... Func>
decltype(auto) entt::basic_sigh_mixin< Type, Registry >::patch ( const entity_type entt,
Func &&... func )
inline

Patches the given instance for an entity.

Template Parameters
FuncTypes of the function objects to invoke.
Parameters
enttA valid identifier.
funcValid function objects.
Returns
A reference to the patched instance.

Definition at line 345 of file mixin.hpp.

◆ registry() [1/2]

template<typename Type , typename Registry >
const registry_type & entt::basic_sigh_mixin< Type, Registry >::registry ( ) const
inlinenoexcept

Returns a pointer to the underlying registry, if any.

Returns
A pointer to the underlying registry, if any.

Definition at line 287 of file mixin.hpp.

◆ registry() [2/2]

template<typename Type , typename Registry >
registry_type & entt::basic_sigh_mixin< Type, Registry >::registry ( )
inlinenoexcept

Returns a pointer to the underlying registry, if any.

Returns
A pointer to the underlying registry, if any.

Definition at line 292 of file mixin.hpp.

◆ swap()

template<typename Type , typename Registry >
void entt::basic_sigh_mixin< Type, Registry >::swap ( basic_sigh_mixin< Type, Registry > & other)
inlinenoexcept

Exchanges the contents with those of a given storage.

Parameters
otherStorage to exchange the content with.

Definition at line 221 of file mixin.hpp.


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