Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::ComponentStorage< T > Class Template Reference

Stores component data for a specific component type. More...

#include <Component.h>

Inherits Raven::ComponentBase.

Public Member Functions

 ComponentStorage ()=default
ComponentBaseCopy () const override
 Deep copy of object.
void Add (const UUID &entity, const T &componentInstance)
 Add a component instance for a given entity.
void Remove (const UUID &entity) override
 Remove the component associated with a given entity.
bool Has (const UUID &entity) const override
 Check if a component exists for a given entity.
T * Get (const UUID &entity)
 Retrieve the component associated with a given entity.
std::vector< UUIDGetEntities () const override
 Get all entities that have the component T.
Public Member Functions inherited from Raven::ComponentBase
virtual ~ComponentBase ()=default

Detailed Description

template<typename T>
class Raven::ComponentStorage< T >

Stores component data for a specific component type.

Template Parameters
TThe type of component being stored.

Each component type has a dedicated ComponentStorage instance that handles storage and retrieval of component data, indexed by entity UUID.

Constructor & Destructor Documentation

◆ ComponentStorage()

template<typename T>
Raven::ComponentStorage< T >::ComponentStorage ( )
default

Member Function Documentation

◆ Add()

template<typename T>
void Raven::ComponentStorage< T >::Add ( const UUID & entity,
const T & componentInstance )
inline

Add a component instance for a given entity.

Parameters
entityUUID of the entity.
componentInstanceThe component instance to store.

◆ Copy()

template<typename T>
ComponentBase * Raven::ComponentStorage< T >::Copy ( ) const
inlineoverridevirtual

Deep copy of object.

Implements Raven::ComponentBase.

◆ Get()

template<typename T>
T * Raven::ComponentStorage< T >::Get ( const UUID & entity)
inline

Retrieve the component associated with a given entity.

Parameters
entityUUID of the entity.
Returns
Pointer to the component, or nullptr if not found.

◆ GetEntities()

template<typename T>
std::vector< UUID > Raven::ComponentStorage< T >::GetEntities ( ) const
inlineoverridevirtual

Get all entities that have the component T.

Returns
List of Entity UUIDs.

Implements Raven::ComponentBase.

◆ Has()

template<typename T>
bool Raven::ComponentStorage< T >::Has ( const UUID & entity) const
inlineoverridevirtual

Check if a component exists for a given entity.

Parameters
entityUUID of the entity.
Returns
True if the component exists, false otherwise.

Implements Raven::ComponentBase.

◆ Remove()

template<typename T>
void Raven::ComponentStorage< T >::Remove ( const UUID & entity)
inlineoverridevirtual

Remove the component associated with a given entity.

Parameters
entityUUID of the entity.

Implements Raven::ComponentBase.


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