EnTT 3.15.0
Loading...
Searching...
No Matches
entt::basic_reactive_mixin< Type, Registry > Class Template Reference

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

#include <mixin.hpp>

Inheritance diagram for entt::basic_reactive_mixin< Type, Registry >:
Collaboration diagram for entt::basic_reactive_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_reactive_mixin ()
 Default constructor.
 
 basic_reactive_mixin (const allocator_type &allocator)
 Constructs an empty storage with a given allocator.
 
 basic_reactive_mixin (const basic_reactive_mixin &)=delete
 Default copy constructor, deleted on purpose.
 
 basic_reactive_mixin (basic_reactive_mixin &&other) noexcept
 Move constructor.
 
 basic_reactive_mixin (basic_reactive_mixin &&other, const allocator_type &allocator)
 Allocator-extended move constructor.
 
 ~basic_reactive_mixin () override=default
 Default destructor.
 
basic_reactive_mixinoperator= (const basic_reactive_mixin &)=delete
 Default copy assignment operator, deleted on purpose.
 
basic_reactive_mixinoperator= (basic_reactive_mixin &&other) noexcept
 Move assignment operator.
 
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixinon_construct (const id_type id=type_hash< Clazz >::value())
 Makes storage react to creation of objects of the given type.
 
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixinon_update (const id_type id=type_hash< Clazz >::value())
 Makes storage react to update of objects of the given type.
 
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixinon_destroy (const id_type id=type_hash< Clazz >::value())
 Makes storage react to destruction of objects of the given type.
 
 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.
 
template<typename... Get, typename... Exclude>
basic_view< get_t< const basic_reactive_mixin, typename basic_registry_type::template storage_for_type< const Get >... >, exclude_t< typename basic_registry_type::template storage_for_type< const Exclude >... > > view (exclude_t< Exclude... >=exclude_t{}) const
 Returns a view that is filtered by the underlying storage.
 
template<typename... Get, typename... Exclude>
basic_view< get_t< const basic_reactive_mixin, typename basic_registry_type::template storage_for_type< Get >... >, exclude_t< typename basic_registry_type::template storage_for_type< Exclude >... > > view (exclude_t< Exclude... >=exclude_t{})
 Returns a view that is filtered by the underlying storage.
 
void reset ()
 Releases all connections to the underlying registry, if any.
 

Detailed Description

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

Mixin type used to add reactive support to storage types.

Template Parameters
TypeUnderlying storage type.
RegistryBasic registry type.

Definition at line 394 of file mixin.hpp.

Member Typedef Documentation

◆ allocator_type

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

Allocator type.

Definition at line 430 of file mixin.hpp.

◆ entity_type

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

Underlying entity identifier.

Definition at line 432 of file mixin.hpp.

◆ registry_type

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

Expected registry type.

Definition at line 434 of file mixin.hpp.

Constructor & Destructor Documentation

◆ basic_reactive_mixin() [1/4]

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

Default constructor.

Definition at line 437 of file mixin.hpp.

◆ basic_reactive_mixin() [2/4]

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

Constructs an empty storage with a given allocator.

Parameters
allocatorThe allocator to use.

Definition at line 444 of file mixin.hpp.

◆ basic_reactive_mixin() [3/4]

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

Move constructor.

Parameters
otherThe instance to move from.

Definition at line 458 of file mixin.hpp.

◆ basic_reactive_mixin() [4/4]

template<typename Type, typename Registry>
entt::basic_reactive_mixin< Type, Registry >::basic_reactive_mixin ( basic_reactive_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 471 of file mixin.hpp.

Member Function Documentation

◆ on_construct()

template<typename Type, typename Registry>
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin & entt::basic_reactive_mixin< Type, Registry >::on_construct ( const id_type id = type_hash<Clazz>::value())
inline

Makes storage react to creation of objects of the given type.

Template Parameters
ClazzType of element to react to.
CandidateFunction to use to react to the event.
Parameters
idOptional name used to map the storage within the registry.
Returns
This mixin.

Definition at line 505 of file mixin.hpp.

◆ on_destroy()

template<typename Type, typename Registry>
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin & entt::basic_reactive_mixin< Type, Registry >::on_destroy ( const id_type id = type_hash<Clazz>::value())
inline

Makes storage react to destruction of objects of the given type.

Template Parameters
ClazzType of element to react to.
CandidateFunction to use to react to the event.
Parameters
idOptional name used to map the storage within the registry.
Returns
This mixin.

Definition at line 533 of file mixin.hpp.

◆ on_update()

template<typename Type, typename Registry>
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin & entt::basic_reactive_mixin< Type, Registry >::on_update ( const id_type id = type_hash<Clazz>::value())
inline

Makes storage react to update of objects of the given type.

Template Parameters
ClazzType of element to react to.
CandidateFunction to use to react to the event.
Parameters
idOptional name used to map the storage within the registry.
Returns
This mixin.

Definition at line 519 of file mixin.hpp.

◆ operator bool()

template<typename Type, typename Registry>
entt::basic_reactive_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 543 of file mixin.hpp.

◆ operator=() [1/2]

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

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This mixin.

Definition at line 492 of file mixin.hpp.

◆ operator=() [2/2]

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

Default copy assignment operator, deleted on purpose.

Returns
This mixin.

◆ registry() [1/2]

template<typename Type, typename Registry>
const registry_type & entt::basic_reactive_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 551 of file mixin.hpp.

◆ registry() [2/2]

template<typename Type, typename Registry>
registry_type & entt::basic_reactive_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 556 of file mixin.hpp.

◆ reset()

template<typename Type, typename Registry>
void entt::basic_reactive_mixin< Type, Registry >::reset ( )
inline

Releases all connections to the underlying registry, if any.

Definition at line 584 of file mixin.hpp.

◆ view() [1/2]

template<typename Type, typename Registry>
template<typename... Get, typename... Exclude>
basic_view< get_t< const basic_reactive_mixin, typename basic_registry_type::template storage_for_type< Get >... >, exclude_t< typename basic_registry_type::template storage_for_type< Exclude >... > > entt::basic_reactive_mixin< Type, Registry >::view ( exclude_t< Exclude... > = exclude_t{})
inlinenodiscard

Returns a view that is filtered by the underlying storage.

Template Parameters
GetTypes of elements used to construct the view.
ExcludeTypes of elements used to filter the view.
Returns
A newly created view.

Definition at line 578 of file mixin.hpp.

◆ view() [2/2]

template<typename Type, typename Registry>
template<typename... Get, typename... Exclude>
basic_view< get_t< const basic_reactive_mixin, typename basic_registry_type::template storage_for_type< const Get >... >, exclude_t< typename basic_registry_type::template storage_for_type< const Exclude >... > > entt::basic_reactive_mixin< Type, Registry >::view ( exclude_t< Exclude... > = exclude_t{}) const
inlinenodiscard

Returns a view that is filtered by the underlying storage.

Template Parameters
GetTypes of elements used to construct the view.
ExcludeTypes of elements used to filter the view.
Returns
A newly created view.

Definition at line 568 of file mixin.hpp.


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