libes  0.5.3
an Entity System library for C++
Public Member Functions | List of all members
es::ComponentStore< C > Class Template Reference

A type-safe wrapper around a store. More...

#include <es/Store.h>

Public Member Functions

 ComponentStore (Store *store)
 
bool has (Entity e)
 Tell whether an entity is present in this store. More...
 
C * get (Entity e)
 Get the compnent associated to an entity. More...
 
bool add (Entity e, C *c)
 Add a component to an entity. More...
 
bool remove (Entity e)
 Remove a component from an entity. More...
 

Detailed Description

template<typename C>
class es::ComponentStore< C >

A type-safe wrapper around a store.

Constructor & Destructor Documentation

template<typename C >
es::ComponentStore< C >::ComponentStore ( Store store)
inline

Member Function Documentation

template<typename C >
bool es::ComponentStore< C >::add ( Entity  e,
C *  c 
)
inline

Add a component to an entity.

The user is responsible to allocate the component.

Parameters
ethe entity
cthe component
Returns
true if the component was actually added
template<typename C >
C* es::ComponentStore< C >::get ( Entity  e)
inline

Get the compnent associated to an entity.

Parameters
ethe entity
Returns
the component or null if the entity has no component of this type
template<typename C >
bool es::ComponentStore< C >::has ( Entity  e)
inline

Tell whether an entity is present in this store.

Parameters
ethe entity
Returns
true if the store has the entity
template<typename C >
bool es::ComponentStore< C >::remove ( Entity  e)
inline

Remove a component from an entity.

The user is responsible for deleting the component.

Parameters
ethe entity
Returns
true if component was actually removed