EnTT: entt::basic_reactive_mixin< Type, Registry > Class Template Reference

EnTT 3.16.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 >:
[legend]
Collaboration diagram for entt::basic_reactive_mixin< Type, Registry >:
[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_mixin & | operator= (const basic_reactive_mixin &)=delete
| Default copy assignment operator, deleted on purpose.
basic_reactive_mixin & | operator= (basic_reactive_mixin &&other) noexcept
| Move assignment operator.
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
basic_reactive_mixin & | on_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_mixin & | on_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_mixin & | on_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_type & | registry () const noexcept
| Returns a pointer to the underlying registry, if any.
registry_type & | registry () 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

  Type | Underlying storage type.
  Registry | Basic registry type.

Definition at line 390 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 426 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 428 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 430 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 433 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

  allocator | The allocator to use.

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

  other | The instance to move from.

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

  other | The instance to move from.
  allocator | The allocator to use.

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

  Clazz | Type of element to react to.
  Candidate | Function to use to react to the event.

Parameters

  id | Optional name used to map the storage within the registry.

Returns
  This mixin.

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

  Clazz | Type of element to react to.
  Candidate | Function to use to react to the event.

Parameters

  id | Optional name used to map the storage within the registry.

Returns
  This mixin.

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

  Clazz | Type of element to react to.
  Candidate | Function to use to react to the event.

Parameters

  id | Optional name used to map the storage within the registry.

Returns
  This mixin.

Definition at line 511 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 535 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

  other | The instance to move from.

Returns
  This mixin.

Definition at line 484 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 543 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 548 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 576 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

  Get | Types of elements used to construct the view.
  Exclude | Types of elements used to filter the view.

Returns
  A newly created view.

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

  Get | Types of elements used to construct the view.
  Exclude | Types of elements used to filter the view.

Returns
  A newly created view.

Definition at line 560 of file mixin.hpp.

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

- src/entt/entity/fwd.hpp
- src/entt/entity/mixin.hpp