OpenLexocad  27.1
entt::basic_actor< Entity > Struct Template Reference

Dedicated to those who aren't confident with the entity-component-system architecture. More...

#include <entt.hpp>

Public Types

using registry_type = basic_registry< Entity >
 Type of registry used internally. More...
 
using entity_type = Entity
 Underlying entity identifier. More...
 

Public Member Functions

 basic_actor () ENTT_NOEXCEPT
 
 basic_actor (registry_type &ref)
 Constructs an actor from a given registry. More...
 
 basic_actor (entity_type entity, registry_type &ref)
 Constructs an actor from a given entity. More...
 
virtual ~basic_actor ()
 Default destructor. More...
 
 basic_actor (basic_actor &&other)
 Move constructor. More...
 
basic_actoroperator= (basic_actor &&other)
 Move assignment operator. More...
 
template<typename Component , typename... Args>
decltype(auto) assign (Args &&... args)
 Assigns the given component to an actor. More...
 
template<typename Component >
void remove ()
 Removes the given component from an actor. More...
 
template<typename... Component>
bool has () const ENTT_NOEXCEPT
 Checks if an actor has the given components. More...
 
template<typename... Component>
decltype(auto) get () const ENTT_NOEXCEPT
 Returns references to the given components for an actor. More...
 
template<typename... Component>
decltype(auto) get () ENTT_NOEXCEPT
 Returns references to the given components for an actor. More...
 
template<typename... Component>
auto try_get () const ENTT_NOEXCEPT
 Returns pointers to the given components for an actor. More...
 
template<typename... Component>
auto try_get () ENTT_NOEXCEPT
 Returns pointers to the given components for an actor. More...
 
const registry_typebackend () const ENTT_NOEXCEPT
 Returns a reference to the underlying registry. More...
 
registry_typebackend () ENTT_NOEXCEPT
 Returns a reference to the underlying registry. More...
 
entity_type entity () const ENTT_NOEXCEPT
 Returns the entity associated with an actor. More...
 
 operator bool () const ENTT_NOEXCEPT
 Checks if an actor refers to a valid entity or not. More...
 

Detailed Description

template<typename Entity>
struct entt::basic_actor< Entity >

Dedicated to those who aren't confident with the entity-component-system architecture.

Tiny wrapper around a registry, for all those users that aren't confident with entity-component-system architecture and prefer to iterate objects directly.

Template Parameters
EntityA valid entity type (see entt_traits for more details).

Member Typedef Documentation

◆ entity_type

template<typename Entity >
using entt::basic_actor< Entity >::entity_type = Entity

Underlying entity identifier.

◆ registry_type

template<typename Entity >
using entt::basic_actor< Entity >::registry_type = basic_registry<Entity>

Type of registry used internally.

Constructor & Destructor Documentation

◆ basic_actor() [1/4]

template<typename Entity >
entt::basic_actor< Entity >::basic_actor ( )
inline

◆ basic_actor() [2/4]

template<typename Entity >
entt::basic_actor< Entity >::basic_actor ( registry_type ref)
inlineexplicit

Constructs an actor from a given registry.

Parameters
refAn instance of the registry class.

◆ basic_actor() [3/4]

template<typename Entity >
entt::basic_actor< Entity >::basic_actor ( entity_type  entity,
registry_type ref 
)
inlineexplicit

Constructs an actor from a given entity.

Parameters
entityA valid entity identifier.
refAn instance of the registry class.

◆ ~basic_actor()

template<typename Entity >
virtual entt::basic_actor< Entity >::~basic_actor ( )
inlinevirtual

Default destructor.

◆ basic_actor() [4/4]

template<typename Entity >
entt::basic_actor< Entity >::basic_actor ( basic_actor< Entity > &&  other)
inline

Move constructor.

After actor move construction, instances that have been moved from are placed in a valid but unspecified state. It's highly discouraged to continue using them.

Parameters
otherThe instance to move from.

Member Function Documentation

◆ assign()

template<typename Entity >
template<typename Component , typename... Args>
decltype(auto) entt::basic_actor< Entity >::assign ( Args &&...  args)
inline

Assigns the given component to an actor.

A new instance of the given component is created and initialized with the arguments provided (the component must have a proper constructor or be of aggregate type). Then the component is assigned to the actor.
In case the actor already has a component of the given type, it's replaced with the new one.

Template Parameters
ComponentType of the component to create.
ArgsTypes of arguments to use to construct the component.
Parameters
argsParameters to use to initialize the component.
Returns
A reference to the newly created component.

◆ backend() [1/2]

template<typename Entity >
const registry_type& entt::basic_actor< Entity >::backend ( ) const
inline

Returns a reference to the underlying registry.

Returns
A reference to the underlying registry.

◆ backend() [2/2]

template<typename Entity >
registry_type& entt::basic_actor< Entity >::backend ( )
inline

Returns a reference to the underlying registry.

Returns
A reference to the underlying registry.

◆ entity()

template<typename Entity >
entity_type entt::basic_actor< Entity >::entity ( ) const
inline

Returns the entity associated with an actor.

Returns
The entity associated with the actor.

◆ get() [1/2]

template<typename Entity >
template<typename... Component>
decltype(auto) entt::basic_actor< Entity >::get ( ) const
inline

Returns references to the given components for an actor.

Template Parameters
ComponentTypes of components to get.
Returns
References to the components owned by the actor.

◆ get() [2/2]

template<typename Entity >
template<typename... Component>
decltype(auto) entt::basic_actor< Entity >::get ( )
inline

Returns references to the given components for an actor.

Template Parameters
ComponentTypes of components to get.
Returns
References to the components owned by the actor.

◆ has()

template<typename Entity >
template<typename... Component>
bool entt::basic_actor< Entity >::has ( ) const
inline

Checks if an actor has the given components.

Template Parameters
ComponentComponents for which to perform the check.
Returns
True if the actor has all the components, false otherwise.

◆ operator bool()

template<typename Entity >
entt::basic_actor< Entity >::operator bool ( ) const
inlineexplicit

Checks if an actor refers to a valid entity or not.

Returns
True if the actor refers to a valid entity, false otherwise.

◆ operator=()

template<typename Entity >
basic_actor& entt::basic_actor< Entity >::operator= ( basic_actor< Entity > &&  other)
inline

Move assignment operator.

After actor move assignment, instances that have been moved from are placed in a valid but unspecified state. It's highly discouraged to continue using them.

Parameters
otherThe instance to move from.
Returns
This actor.

◆ remove()

template<typename Entity >
template<typename Component >
void entt::basic_actor< Entity >::remove ( )
inline

Removes the given component from an actor.

Template Parameters
ComponentType of the component to remove.

◆ try_get() [1/2]

template<typename Entity >
template<typename... Component>
auto entt::basic_actor< Entity >::try_get ( ) const
inline

Returns pointers to the given components for an actor.

Template Parameters
ComponentTypes of components to get.
Returns
Pointers to the components owned by the actor.

◆ try_get() [2/2]

template<typename Entity >
template<typename... Component>
auto entt::basic_actor< Entity >::try_get ( )
inline

Returns pointers to the given components for an actor.

Template Parameters
ComponentTypes of components to get.
Returns
Pointers to the components owned by the actor.

The documentation for this struct was generated from the following file: