Hummingbird Framework
 All Classes Functions Variables Modules Pages
hb::DataComponent< T > Class Template Reference

A GameObject::Component for storing an instance of T into a GameObject. More...

#include <DataComponent.h>

Inheritance diagram for hb::DataComponent< T >:
Collaboration diagram for hb::DataComponent< T >:

Public Member Functions

 DataComponent ()
 Class default constructor.
 
 DataComponent (const T &data)
 Class constructor. More...
 
virtual ~DataComponent () override
 Class destructor.
 
void setData (const T &data)
 Data setter. More...
 
T & getData ()
 Data getter. More...
 
const T & getData () const
 Data getter. More...
 
- Public Member Functions inherited from hb::GameObject::Component
 Component ()
 Default constructor. More...
 
virtual ~Component ()
 Default destructor.
 
virtual void init ()
 Function called once after the Component has been added to a GameObject. More...
 
virtual void preUpdate ()
 Function called in the pre-update step.
 
virtual void update ()
 Function called in the update step.
 
virtual void postUpdate ()
 Function called in the post-update step.
 
GameObjectgetGameObject () const
 Get the GameObject instance composed by this Component. More...
 
void setActive (bool active)
 Set if Component is active. More...
 
bool isActive () const
 Get if Component is active. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hb::GameObject::Component
void addListenerToGameObject (const std::string &name, std::function< void(DataRepository &)> &&listener)
 
void ignoreToGameObject (const GameObjectMessageManager::ListenerId< DataRepository > &listener_id)
 

Detailed Description

template<typename T>
class hb::DataComponent< T >

A GameObject::Component for storing an instance of T into a GameObject.

Constructor & Destructor Documentation

template<typename T >
hb::DataComponent< T >::DataComponent ( const T &  data)
inline

Class constructor.

Parameters
dataT instance to store in the component

Makes a copy of data and stores it.

Member Function Documentation

template<typename T >
T& hb::DataComponent< T >::getData ( )
inline

Data getter.

Returns
Reference to stored T instance
template<typename T >
const T& hb::DataComponent< T >::getData ( ) const
inline

Data getter.

Returns
Constant reference to stored T instance
template<typename T >
void hb::DataComponent< T >::setData ( const T &  data)
inline

Data setter.

Parameters
dataT instance to store in the component

Makes a copy of data and stores it.


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