EnTT 3.13.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_view< get_t< Get... >, exclude_t< Exclude... > > Class Template Reference

General purpose view. More...

#include <view.hpp>

Inheritance diagram for entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >:
Inheritance graph
[legend]
Collaboration diagram for entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >:
Collaboration graph
[legend]

Public Types

using common_type = typename base_type::common_type
 Common type among all storage types.
 
using entity_type = typename base_type::entity_type
 Underlying entity identifier.
 
using size_type = typename base_type::size_type
 Unsigned integer type.
 
using iterator = typename base_type::iterator
 Bidirectional iterator type.
 
using iterable = iterable_adaptor< internal::extended_view_iterator< iterator, Get... > >
 Iterable view type.
 
- Public Types inherited from entt::basic_common_view< std::common_type_t< Get::base_type..., Exclude::base_type... >, sizeof...(Get), sizeof...(Exclude)>
using common_type = std::common_type_t< Get::base_type..., Exclude::base_type... >
 Common type among all storage types.
 
using entity_type = typename Type::entity_type
 Underlying entity identifier.
 
using size_type = std::size_t
 Unsigned integer type.
 
using iterator = internal::view_iterator< common_type, Get, Exclude >
 Bidirectional iterator type.
 

Public Member Functions

 basic_view () noexcept
 Default constructor to use to create empty, invalid views.
 
 basic_view (Get &...value, Exclude &...excl) noexcept
 Constructs a view from a set of storage classes.
 
 basic_view (std::tuple< Get &... > value, std::tuple< Exclude &... > excl={}) noexcept
 Constructs a view from a set of storage classes.
 
template<typename Type >
void use () noexcept
 Forces a view to use a given component to drive iterations.
 
template<std::size_t Index>
void use () noexcept
 Forces a view to use a given component to drive iterations.
 
template<typename Type >
auto * storage () const noexcept
 Returns the storage for a given component type, if any.
 
template<std::size_t Index>
auto * storage () const noexcept
 Returns the storage for a given index, if any.
 
template<typename Type >
void storage (Type &elem) noexcept
 Assigns a storage to a view.
 
template<std::size_t Index, typename Type >
void storage (Type &elem) noexcept
 Assigns a storage to a view.
 
decltype(auto) operator[] (const entity_type entt) const
 Returns the components assigned to the given entity.
 
template<typename Type , typename... Other>
decltype(auto) get (const entity_type entt) const
 Returns the components assigned to the given entity.
 
template<std::size_t... Index>
decltype(auto) get (const entity_type entt) const
 Returns the components assigned to the given entity.
 
template<typename Func >
void each (Func func) const
 Iterates entities and components and applies the given function object to them.
 
iterable each () const noexcept
 Returns an iterable object to use to visit a view.
 
template<typename... OGet, typename... OExclude>
auto operator| (const basic_view< get_t< OGet... >, exclude_t< OExclude... > > &other) const noexcept
 Combines two views in a more specific one.
 
- Public Member Functions inherited from entt::basic_common_view< std::common_type_t< Get::base_type..., Exclude::base_type... >, sizeof...(Get), sizeof...(Exclude)>
void refresh () noexcept
 Updates the internal leading view if required.
 
const common_typehandle () const noexcept
 Returns the leading storage of a view, if any.
 
size_type size_hint () const noexcept
 Estimates the number of entities iterated by the view.
 
iterator begin () const noexcept
 Returns an iterator to the first entity of the view.
 
iterator end () const noexcept
 Returns an iterator that is past the last entity of the view.
 
entity_type front () const noexcept
 Returns the first entity of the view, if any.
 
entity_type back () const noexcept
 Returns the last entity of the view, if any.
 
iterator find (const entity_type entt) const noexcept
 Finds an entity.
 
 operator bool () const noexcept
 Checks if a view is fully initialized.
 
bool contains (const entity_type entt) const noexcept
 Checks if a view contains an entity.
 

Detailed Description

template<typename... Get, typename... Exclude>
class entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >

General purpose view.

This view visits all entities that are at least in the given storage. During initialization, it also looks at the number of elements available for each storage and uses the smallest set in order to get a performance boost.

See also
basic_view
Template Parameters
GetTypes of storage iterated by the view.
ExcludeTypes of storage used to filter the view.

Definition at line 388 of file view.hpp.

Member Typedef Documentation

◆ common_type

template<typename... Get, typename... Exclude>
using entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::common_type = typename base_type::common_type

Common type among all storage types.

Definition at line 428 of file view.hpp.

◆ entity_type

template<typename... Get, typename... Exclude>
using entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::entity_type = typename base_type::entity_type

Underlying entity identifier.

Definition at line 430 of file view.hpp.

◆ iterable

template<typename... Get, typename... Exclude>
using entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::iterable = iterable_adaptor<internal::extended_view_iterator<iterator, Get...> >

Iterable view type.

Definition at line 436 of file view.hpp.

◆ iterator

template<typename... Get, typename... Exclude>
using entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::iterator = typename base_type::iterator

Bidirectional iterator type.

Definition at line 434 of file view.hpp.

◆ size_type

template<typename... Get, typename... Exclude>
using entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::size_type = typename base_type::size_type

Unsigned integer type.

Definition at line 432 of file view.hpp.

Constructor & Destructor Documentation

◆ basic_view() [1/3]

template<typename... Get, typename... Exclude>
entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::basic_view ( )
inlinenoexcept

Default constructor to use to create empty, invalid views.

Definition at line 439 of file view.hpp.

◆ basic_view() [2/3]

template<typename... Get, typename... Exclude>
entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::basic_view ( Get &...  value,
Exclude &...  excl 
)
inlinenoexcept

Constructs a view from a set of storage classes.

Parameters
valueThe storage for the types to iterate.
exclThe storage for the types used to filter the view.

Definition at line 447 of file view.hpp.

◆ basic_view() [3/3]

template<typename... Get, typename... Exclude>
entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::basic_view ( std::tuple< Get &... >  value,
std::tuple< Exclude &... >  excl = {} 
)
inlinenoexcept

Constructs a view from a set of storage classes.

Parameters
valueThe storage for the types to iterate.
exclThe storage for the types used to filter the view.

Definition at line 456 of file view.hpp.

Member Function Documentation

◆ each() [1/2]

template<typename... Get, typename... Exclude>
iterable entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::each ( ) const
inlinenoexcept

Returns an iterable object to use to visit a view.

The iterable object returns a tuple that contains the current entity and a set of references to its non-empty components. The constness of the components is as requested.

Returns
An iterable object to use to visit the view.

Definition at line 600 of file view.hpp.

◆ each() [2/2]

template<typename... Get, typename... Exclude>
template<typename Func >
void entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::each ( Func  func) const
inline

Iterates entities and components and applies the given function object to them.

The signature of the function must be equivalent to one of the following (non-empty types only, constness as requested):

void(const entity_type, Type &...);
void(Type &...);
typename base_type::entity_type entity_type
Underlying entity identifier.
Definition view.hpp:430
Template Parameters
FuncType of the function object to invoke.
Parameters
funcA valid function object.

Definition at line 585 of file view.hpp.

◆ get() [1/2]

template<typename... Get, typename... Exclude>
template<typename Type , typename... Other>
decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::get ( const entity_type  entt) const
inline

Returns the components assigned to the given entity.

Template Parameters
TypeType of the component to get.
OtherOther types of components to get.
Parameters
enttA valid identifier.
Returns
The components assigned to the entity.

Definition at line 548 of file view.hpp.

◆ get() [2/2]

template<typename... Get, typename... Exclude>
template<std::size_t... Index>
decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::get ( const entity_type  entt) const
inline

Returns the components assigned to the given entity.

Template Parameters
IndexIndexes of the components to get.
Parameters
enttA valid identifier.
Returns
The components assigned to the entity.

Definition at line 559 of file view.hpp.

◆ operator[]()

template<typename... Get, typename... Exclude>
decltype(auto) entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::operator[] ( const entity_type  entt) const
inline

Returns the components assigned to the given entity.

Parameters
enttA valid identifier.
Returns
The components assigned to the given entity.

Definition at line 536 of file view.hpp.

◆ operator|()

template<typename... Get, typename... Exclude>
template<typename... OGet, typename... OExclude>
auto entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::operator| ( const basic_view< get_t< OGet... >, exclude_t< OExclude... > > &  other) const
inlinenoexcept

Combines two views in a more specific one.

Template Parameters
OGetComponent list of the view to combine with.
OExcludeFilter list of the view to combine with.
Parameters
otherThe view to combine with.
Returns
A more specific view.

Definition at line 613 of file view.hpp.

◆ storage() [1/4]

template<typename... Get, typename... Exclude>
template<typename Type >
auto * entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::storage ( ) const
inlinenoexcept

Returns the storage for a given component type, if any.

Template Parameters
TypeType of component of which to return the storage.
Returns
The storage for the given component type.

Definition at line 483 of file view.hpp.

◆ storage() [2/4]

template<typename... Get, typename... Exclude>
template<std::size_t Index>
auto * entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::storage ( ) const
inlinenoexcept

Returns the storage for a given index, if any.

Template Parameters
IndexIndex of the storage to return.
Returns
The storage for the given index.

Definition at line 493 of file view.hpp.

◆ storage() [3/4]

template<typename... Get, typename... Exclude>
template<typename Type >
void entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::storage ( Type &  elem)
inlinenoexcept

Assigns a storage to a view.

Template Parameters
TypeType of storage to assign to the view.
Parameters
elemA storage to assign to the view.

Definition at line 509 of file view.hpp.

◆ storage() [4/4]

template<typename... Get, typename... Exclude>
template<std::size_t Index, typename Type >
void entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::storage ( Type &  elem)
inlinenoexcept

Assigns a storage to a view.

Template Parameters
IndexIndex of the storage to assign to the view.
TypeType of storage to assign to the view.
Parameters
elemA storage to assign to the view.

Definition at line 520 of file view.hpp.

◆ use() [1/2]

template<typename... Get, typename... Exclude>
template<typename Type >
void entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::use ( )
inlinenoexcept

Forces a view to use a given component to drive iterations.

Template Parameters
TypeType of component to use to drive iterations.

Definition at line 464 of file view.hpp.

◆ use() [2/2]

template<typename... Get, typename... Exclude>
template<std::size_t Index>
void entt::basic_view< get_t< Get... >, exclude_t< Exclude... > >::use ( )
inlinenoexcept

Forces a view to use a given component to drive iterations.

Template Parameters
IndexIndex of the component to use to drive iterations.

Definition at line 473 of file view.hpp.


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