EnTT 3.15.0
Loading...
Searching...
No Matches
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 >:
Collaboration diagram for entt::basic_sigh_mixin< Type, Registry >:

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 generate ()
 Creates a new identifier or recycles a destroyed one.
 
entity_type generate (const entity_type hint)
 Creates a new identifier or recycles a destroyed one.
 
template<typename It>
void generate (It first, It last)
 Assigns each element in a range an identifier.
 
template<typename... Args>
decltype(auto) emplace (const entity_type entt, Args &&...args)
 Assigns an entity to a storage and constructs its object.
 
template<typename... Func>
decltype(auto) patch (const entity_type entt, Func &&...func)
 Updates the instance assigned to a given entity in-place.
 
template<typename It, typename... Args>
void insert (It first, It last, Args &&...args)
 Assigns one or more entities to a storage and constructs their objects from a given instance.
 

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:134

This applies to all signals made available.

Template Parameters
TypeUnderlying storage type.
RegistryBasic registry type.

Definition at line 57 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 132 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 134 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 136 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 139 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 146 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 173 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 187 of file mixin.hpp.

Member Function Documentation

◆ emplace()

template<typename Type, typename Registry>
template<typename... Args>
decltype(auto) entt::basic_sigh_mixin< Type, Registry >::emplace ( const entity_type entt,
Args &&... args )
inline

Assigns an entity to a storage and constructs its object.

Template Parameters
ArgsTypes of arguments to forward to the underlying storage.
Parameters
enttA valid identifier.
argsParameters to forward to the underlying storage.
Returns
A reference to the newly created object.

Definition at line 339 of file mixin.hpp.

◆ generate() [1/3]

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

Creates a new identifier or recycles a destroyed one.

Returns
A valid identifier.

Definition at line 297 of file mixin.hpp.

◆ generate() [2/3]

template<typename Type, typename Registry>
entity_type entt::basic_sigh_mixin< Type, Registry >::generate ( const entity_type hint)
inline

Creates a new identifier or recycles a destroyed one.

Parameters
hintRequired identifier.
Returns
A valid identifier.

Definition at line 308 of file mixin.hpp.

◆ generate() [3/3]

template<typename Type, typename Registry>
template<typename It>
void entt::basic_sigh_mixin< Type, Registry >::generate ( It first,
It last )
inline

Assigns each element in a range an identifier.

Template Parameters
ItType of mutable forward iterator.
Parameters
firstAn iterator to the first element of the range to generate.
lastAn iterator past the last element of the range to generate.

Definition at line 321 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

Assigns one or more entities to a storage and constructs their objects from a given instance.

Template Parameters
ItType of input iterator.
ArgsTypes of arguments to forward to the underlying storage.
Parameters
firstAn iterator to the first element of the range of entities.
lastAn iterator past the last element of the range of entities.
argsParameters to use to forward to the underlying storage.

Definition at line 369 of file mixin.hpp.

◆ on_construct()

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

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 238 of file mixin.hpp.

◆ on_destroy()

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

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 268 of file mixin.hpp.

◆ on_update()

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

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 253 of file mixin.hpp.

◆ operator bool()

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

Checks if a mixin refers to a valid registry.

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

Definition at line 276 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 209 of file mixin.hpp.

◆ operator=() [2/2]

template<typename Type, typename Registry>
basic_sigh_mixin & entt::basic_sigh_mixin< Type, Registry >::operator= ( const basic_sigh_mixin< Type, Registry > & )
delete

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

Updates the instance assigned to a given entity in-place.

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 353 of file mixin.hpp.

◆ registry() [1/2]

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

Returns a pointer to the underlying registry, if any.

Returns
A pointer to the underlying registry, if any.

Definition at line 284 of file mixin.hpp.

◆ registry() [2/2]

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

Returns a pointer to the underlying registry, if any.

Returns
A pointer to the underlying registry, if any.

Definition at line 289 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 218 of file mixin.hpp.


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