Public Member Functions | Protected Attributes | List of all members
ion::IEntity< TComponent > Class Template Reference

Base class for Component-Entity design pattern implementation driven by typesBasic Usage: Derive your entity class from IEntity<T> where T is the base class of your Entity class. More...

#include <IEntity.h>

Public Member Functions

template<typename T >
TAddComponent (T *Component)
 Add a component to this entity. More...
 
template<typename T >
pair< typename std::multimap< Type, TComponent * >::iterator, typename std::multimap< Type, TComponent * >::iterator > GetComponents ()
 Get an iterator range of all components of a given type Note: Does not return elemtns of a type derived from T. More...
 
template<typename T >
size_t GetComponentCount () const
 Get the number of components of a given type Note: Does not count elements of a type derived from T. More...
 
template<typename T >
size_t ExpectSingleComponent (T *&Component)
 
template<typename T >
TRequireSingleComponent ()
 

Protected Attributes

std::multimap< Type, TComponent * > Components
 

Detailed Description

template<typename TComponent>
class ion::IEntity< TComponent >

Base class for Component-Entity design pattern implementation driven by types

Basic Usage: Derive your entity class from IEntity<T> where T is the base class of your Entity class.

Member Function Documentation

template<typename TComponent >
template<typename T >
T* ion::IEntity< TComponent >::AddComponent ( T Component)
inline

Add a component to this entity.

Parameters
ComponentThe component to add
Template Parameters
TThe actual type of the component added (assumed derived from TComponent)
Returns
The component that was added by this operation
template<typename TComponent >
template<typename T >
size_t ion::IEntity< TComponent >::ExpectSingleComponent ( T *&  Component)
inline
template<typename TComponent >
template<typename T >
size_t ion::IEntity< TComponent >::GetComponentCount ( ) const
inline

Get the number of components of a given type Note: Does not count elements of a type derived from T.

Template Parameters
TType of matched components
template<typename TComponent >
template<typename T >
pair<typename std::multimap<Type, TComponent *>::iterator, typename std::multimap<Type, TComponent *>::iterator> ion::IEntity< TComponent >::GetComponents ( )
inline

Get an iterator range of all components of a given type Note: Does not return elemtns of a type derived from T.

Template Parameters
TType of matched components
template<typename TComponent >
template<typename T >
T* ion::IEntity< TComponent >::RequireSingleComponent ( )
inline

Member Data Documentation

template<typename TComponent >
std::multimap<Type, TComponent *> ion::IEntity< TComponent >::Components
protected

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