i6engine  1.0
i6e::api::Component Class Referenceabstract

Component Base Class. All Components must derive from Component. More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/components/Component.h>

Public Member Functions

 Component ()
 Constructor for Component. More...
 
 Component (const int64_t id, const attributeMap &params)
 Constructor for Component. More...
 
virtual ~Component ()
 Destructor of Component. Must be implemented in derived class. More...
 
void setOwnerGO (const WeakGOPtr &objGo)
 Sets the GameObject that owns this Component. More...
 
GOPtr getOwnerGO ()
 Get the GameObject that owns this Component. More...
 
uint32_t getComponentID () const
 Returns the component identification string. More...
 
uint32_t getFamilyID () const
 Returns the family identification string. More...
 
std::string getIdentifier () const
 Returns the family identification string. More...
 
virtual void Tick ()
 Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade. More...
 
void setDie () const
 component will be deleted soon More...
 
int64_t getID () const
 returns the id of the component More...
 
virtual void News (const GameMessage::Ptr &msg)
 Receives messages for this component override this function, if you expect messages. More...
 
virtual void Init ()=0
 initializes the Component More...
 
virtual void Finalize ()
 finalizes the component More...
 
virtual attributeMap synchronize () const =0
 synchronizes the Components state More...
 
void setSync (bool b)
 sets whether this object has to be synchronized or not More...
 
bool getSync () const
 
void enableTicking (bool allowTicking) const
 triggers doEnableTicking threadsafe More...
 
virtual std::pair< AddStrategy, int64_t > howToAdd (const ComPtr &comp) const
 asks, how to handle a new component with the same type More...
 
void setSelf (const WeakComPtr &self)
 sets weak_ptr on self for registration of ticker More...
 
virtual std::string getTemplateName () const =0
 returns the name this template was registered with More...
 
virtual std::vector< componentOptionsgetComponentOptions ()=0
 returns a vector containing all options of the Component being readable and writeable in the editor More...
 
std::vector< ComPtrgetSubComponents () const
 returns all SubComponents attached to this Component More...
 

Static Public Member Functions

template<typename T >
static ComPtr createC (const int64_t id, const attributeMap &params)
 

Protected Member Functions

void addTicker ()
 adds this component to ticklist More...
 
void removeTicker ()
 removes this component from ticklist More...
 
void doEnableTicking (bool allowTicking)
 sets ticking status for this Component per default all Components are allowed to tick and calling addTicker will start ticking, but in some cases, e.g. for level editor, ticking has to be disabled and just a few components are allowed to tick More...
 

Protected Attributes

int64_t _objOwnerID
 ID of the GameObject that owns this Component. More...
 
WeakGOPtr _objOwnerGO
 Owning GameObject. More...
 
uint32_t _objComponentID
 Component ID of the Component. More...
 
uint32_t _objFamilyID
 Family ID of the Component. More...
 
std::vector< ComPtr_subComps
 vector containing the other componetns of the same type if this is the dispatcher component More...
 
std::string _identifier
 identifies the subcomponent More...
 
int64_t _id
 id of this component More...
 
bool _sync
 
WeakComPtr _self
 a weak_ptr on the own shared_ptr More...
 
bool _tickingAllowed
 status if this object is allowed to tick or not More...
 
bool _wantsToTick
 stores if a Component which isn't allowed to tick want to tick, so it can start ticking when ticking will be allowed More...
 
bool _isTicking
 stores whether this Component is actually ticking More...
 

Friends

class GameObject
 

Detailed Description

Component Base Class. All Components must derive from Component.

Definition at line 97 of file Component.h.

Constructor & Destructor Documentation

i6e::api::Component::Component ( )

Constructor for Component.

i6e::api::Component::Component ( const int64_t  id,
const attributeMap params 
)

Constructor for Component.

virtual i6e::api::Component::~Component ( )
virtual

Destructor of Component. Must be implemented in derived class.

Member Function Documentation

void i6e::api::Component::addTicker ( )
protected

adds this component to ticklist

template<typename T >
static ComPtr i6e::api::Component::createC ( const int64_t  id,
const attributeMap params 
)
inlinestatic

Definition at line 117 of file Component.h.

void i6e::api::Component::doEnableTicking ( bool  allowTicking)
protected

sets ticking status for this Component per default all Components are allowed to tick and calling addTicker will start ticking, but in some cases, e.g. for level editor, ticking has to be disabled and just a few components are allowed to tick

void i6e::api::Component::enableTicking ( bool  allowTicking) const

triggers doEnableTicking threadsafe

virtual void i6e::api::Component::Finalize ( )
inlinevirtual

finalizes the component

Reimplemented in i6e::api::LuminousAppearanceComponent, i6e::api::MoverComponent, and i6e::api::MovementComponent.

Definition at line 187 of file Component.h.

uint32_t i6e::api::Component::getComponentID ( ) const
inline

Returns the component identification string.

Returns
name of the component

Definition at line 137 of file Component.h.

uint32_t i6e::api::Component::getFamilyID ( ) const
inline

Returns the family identification string.

Returns
name of the family

Definition at line 145 of file Component.h.

int64_t i6e::api::Component::getID ( ) const
inline

returns the id of the component

Definition at line 169 of file Component.h.

std::string i6e::api::Component::getIdentifier ( ) const
inline

Returns the family identification string.

Returns
name of the family

Definition at line 153 of file Component.h.

GOPtr i6e::api::Component::getOwnerGO ( )

Get the GameObject that owns this Component.

Returns
A pointer to the GameObject
std::vector<ComPtr> i6e::api::Component::getSubComponents ( ) const
inline

returns all SubComponents attached to this Component

Definition at line 230 of file Component.h.

bool i6e::api::Component::getSync ( ) const
inline

Definition at line 198 of file Component.h.

virtual std::pair<AddStrategy, int64_t> i6e::api::Component::howToAdd ( const ComPtr comp) const
virtual

asks, how to handle a new component with the same type

Parameters
[in]compcomponent that shall be added
Returns
pair containing the strategy to use as well as an additional value

Reimplemented in i6e::api::CameraComponent, and i6e::api::MoverComponent.

virtual void i6e::api::Component::News ( const GameMessage::Ptr msg)
virtual

Receives messages for this component override this function, if you expect messages.

Reimplemented in i6e::api::MoverComponent, and i6e::api::ShatterComponent.

void i6e::api::Component::removeTicker ( )
protected

removes this component from ticklist

void i6e::api::Component::setDie ( ) const

component will be deleted soon

void i6e::api::Component::setOwnerGO ( const WeakGOPtr objGo)

Sets the GameObject that owns this Component.

Parameters
[in]objGOtype of GameObject*
void i6e::api::Component::setSelf ( const WeakComPtr self)

sets weak_ptr on self for registration of ticker

void i6e::api::Component::setSync ( bool  b)
inline

sets whether this object has to be synchronized or not

Definition at line 197 of file Component.h.

virtual void i6e::api::Component::Tick ( )
inlinevirtual

Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade.

Reimplemented in i6e::api::MoverComponent, i6e::api::AnimatedLuminousAppearanceComponent, and i6e::api::MovementComponent.

Definition at line 159 of file Component.h.

Friends And Related Function Documentation

friend class GameObject
friend

Definition at line 98 of file Component.h.

Member Data Documentation

int64_t i6e::api::Component::_id
protected

id of this component

Definition at line 268 of file Component.h.

std::string i6e::api::Component::_identifier
protected

identifies the subcomponent

Definition at line 263 of file Component.h.

bool i6e::api::Component::_isTicking
protected

stores whether this Component is actually ticking

Definition at line 290 of file Component.h.

uint32_t i6e::api::Component::_objComponentID
protected

Component ID of the Component.

Definition at line 248 of file Component.h.

uint32_t i6e::api::Component::_objFamilyID
protected

Family ID of the Component.

Definition at line 253 of file Component.h.

WeakGOPtr i6e::api::Component::_objOwnerGO
protected

Owning GameObject.

Definition at line 243 of file Component.h.

int64_t i6e::api::Component::_objOwnerID
protected

ID of the GameObject that owns this Component.

Definition at line 238 of file Component.h.

WeakComPtr i6e::api::Component::_self
protected

a weak_ptr on the own shared_ptr

Definition at line 275 of file Component.h.

std::vector<ComPtr> i6e::api::Component::_subComps
protected

vector containing the other componetns of the same type if this is the dispatcher component

Definition at line 258 of file Component.h.

bool i6e::api::Component::_sync
protected

Definition at line 270 of file Component.h.

bool i6e::api::Component::_tickingAllowed
protected

status if this object is allowed to tick or not

Definition at line 280 of file Component.h.

bool i6e::api::Component::_wantsToTick
protected

stores if a Component which isn't allowed to tick want to tick, so it can start ticking when ticking will be allowed

Definition at line 285 of file Component.h.


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