EnTT 3.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for entt::basic_reactive_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_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.
 
void swap (basic_reactive_mixin &other) noexcept
 Exchanges the contents with those of a given storage.
 
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.
 

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 389 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 416 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 418 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 420 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 423 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 430 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 442 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 451 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 492 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 518 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 505 of file mixin.hpp.

◆ operator bool()

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

◆ operator=() [1/2]

Move assignment operator.

Parameters
otherThe instance to move from.
Returns
This mixin.

Definition at line 469 of file mixin.hpp.

◆ operator=() [2/2]

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
inlinenoexcept

Returns a pointer to the underlying registry, if any.

Returns
A pointer to the underlying registry, if any.

Definition at line 535 of file mixin.hpp.

◆ registry() [2/2]

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

◆ swap()

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

Exchanges the contents with those of a given storage.

Parameters
otherStorage to exchange the content with.

Definition at line 478 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{})
inline

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 562 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
inline

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


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