Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::component::ComponentList< Entity, ComponentType > Class Template Reference

Component holder that can be bound to an entity. More...

#include <OxygenEngine/scene/component/component.h>

Public Member Functions

 ComponentList (Entity &entity)
 
template<typename T = ComponentType, typename ... Args>
std::shared_ptr< T > addNamed (const std::string &name, Args &&...args)
 Add a new a component.
 
template<typename T = ComponentType, typename ... Args>
std::shared_ptr< T > add (Args &&...args)
 Add a new a component.
 
template<typename T = ComponentType>
const T * getComponentByName (const std::string &name) const noexcept
 Fetch a component when you know its name (const version)
 
template<typename T = ComponentType>
T * getComponentByName (const std::string &name) noexcept
 Fetch a component when you know its name.
 
template<typename T >
const T * getComponentByType () const noexcept
 Fetch a component by its type (const version)
 
template<typename T >
T * getComponentByType () noexcept
 Fetch a component by its type.
 
void remove (const std::string &name)
 Remove a component.
 
void update (const double delta, const int8_t flags=0) const
 Update all components.
 
ComponentContainer::iterator begin () noexcept
 
ComponentContainer::iterator end () noexcept
 
const ComponentContainer::const_iterator begin () const noexcept
 
const ComponentContainer::const_iterator end () const noexcept
 
const ComponentContainer::const_iterator cbegin () const noexcept
 
const ComponentContainer::const_iterator cend () const noexcept
 

Detailed Description

template<typename Entity, typename ComponentType = EntityComponent<Entity>>
class oe::component::ComponentList< Entity, ComponentType >

Component holder that can be bound to an entity.

Member Function Documentation

◆ begin() [1/2]

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
const ComponentContainer::const_iterator oe::component::ComponentList< Entity, ComponentType >::begin ( ) const
inlinenoexcept
Returns
constant iterator at begining of components list

◆ begin() [2/2]

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
ComponentContainer::iterator oe::component::ComponentList< Entity, ComponentType >::begin ( )
inlinenoexcept
Returns
iterator at begining of components list

◆ cbegin()

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
const ComponentContainer::const_iterator oe::component::ComponentList< Entity, ComponentType >::cbegin ( ) const
inlinenoexcept
Returns
constant iterator at begining of components list

◆ cend()

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
const ComponentContainer::const_iterator oe::component::ComponentList< Entity, ComponentType >::cend ( ) const
inlinenoexcept
Returns
constant iterator at end of components list

◆ end() [1/2]

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
const ComponentContainer::const_iterator oe::component::ComponentList< Entity, ComponentType >::end ( ) const
inlinenoexcept
Returns
constant iterator at end of components list

◆ end() [2/2]

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
ComponentContainer::iterator oe::component::ComponentList< Entity, ComponentType >::end ( )
inlinenoexcept
Returns
iterator at end of components list

◆ update()

template<typename Entity , typename ComponentType = EntityComponent<Entity>>
void oe::component::ComponentList< Entity, ComponentType >::update ( const double  delta,
const int8_t  flags = 0 
) const
inline

Update all components.

The flags value is not used by OxygenEngine, but you can use it to implement differents levels of update For example, other engines uses functions such as BeforeUpdate, PreUpdate, PostUpdate, LateUpdate, etc Here, it would translates to using custom flags values

Parameters
deltaseconds since last call of this function
flagscustom flags

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