ComponentManager Class Referenceabstract

#include <ComponentManager.h>

Inheritance diagram for ComponentManager:
ListenerObject BehaviorManager BodyManager ColliderManager MutatorManager SpriteManager WireframeManager

# Public Member Functions

void constructor ()
 Class' constructor.
void destroyAllComponents ()
 Destroy all the manager's components.
virtual uint32 getType ()=0
virtual void enable ()
 Enable the manager.
virtual void disable ()
 Disable the manager.
virtual Component create (Entity owner, const ComponentSpec *componentSpec)=0
virtual void purgeComponents ()
 Force the purging of deleted components.
virtual bool areComponentsVisual ()

# Static Public Member Functions

static Component createComponent (Entity owner, const ComponentSpec *componentSpec)
static void destroyComponent (Entity owner, Component component)
static Component addComponent (Entity owner, const ComponentSpec *componentSpec)
static void removeComponent (Entity owner, Component component)
static void addComponents (Entity owner, ComponentSpec **componentSpecs, uint32 componentType)
static void removeComponents (Entity owner, uint32 componentType)
static void createComponents (Entity owner, ComponentSpec **componentSpecs)
static void destroyComponents (Entity owner)
static Component getComponentAtIndex (Entity owner, uint32 componentType, int16 componentIndex)
static void getComponents (Entity owner, uint32 componentType, VirtualList components)
static bool getComponentsOfClass (Entity owner, ClassPointer classPointer, VirtualList components, uint32 componentType)
static uint16 getComponentsCount (Entity owner, uint32 componentType)
static void propagateCommand (int32 command, Entity owner, uint32 componentType,...)
static bool calculateRightBox (Entity owner, RightBox *rightBox)

# Protected Attributes

VirtualList components
 List of components.
bool locked
 Flag to prevent the manipulation of the components list.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool onEvent (ListenerObject eventFirer, uint16 eventCode)
virtual bool handleMessage (Telegram telegram)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class ComponentManager

Inherits from Object

Manages component instances.

Definition at line 38 of file ComponentManager.h.

# Member Function Documentation

# addComponent()

static Component ComponentManager::addComponent ( Entity owner,
const ComponentSpec * componentSpec )
static

Add a component to the specified owner.

Parameters
ownerObject to which the components attach to
componentSpecSpec to initialize the new component
Returns
Added component

Definition at line 113 of file ComponentManager.c.

# addComponents()

static void ComponentManager::addComponents ( Entity owner,
ComponentSpec ** componentSpecs,
uint32 componentType )
static

Add components to the specified owner.

Parameters
ownerObject to which the components attach to
componentSpecsSpecs to initialize the new components
componentTypeType of components to add

Definition at line 142 of file ComponentManager.c.

# areComponentsVisual()

bool ComponentManager::areComponentsVisual ( )
virtual

Retrieve information regarding if the components are visile.

Returns
True if the components managed are visual; false otherwise

Reimplemented in SpriteManager, and WireframeManager.

Definition at line 746 of file ComponentManager.c.

# calculateRightBox()

static bool ComponentManager::calculateRightBox ( Entity owner,
RightBox * rightBox )
static

Compute the rightbox for the owner in base of its visual components.

Parameters
ownerEntity that the components attaches to
rightBoxRightbox to configure
Returns
True if the owner has visual components; false otherwise

Definition at line 453 of file ComponentManager.c.

# constructor()

void ComponentManager::constructor ( )

Class' constructor.

Definition at line 639 of file ComponentManager.c.

# create()

virtual Component ComponentManager::create ( Entity owner,
const ComponentSpec * componentSpec )
pure virtual

Create a component with the provided spec.

Parameters
ownerObject to which the component will attach to
componentSpecSpec to use to initialize the component
Returns
Created component

# createComponent()

static Component ComponentManager::createComponent ( Entity owner,
const ComponentSpec * componentSpec )
static

Create a component with the specified owner.

Parameters
ownerOwner of the component (can be NULL)
componentSpecSpec to initialize the new component
Returns
Created component

Definition at line 47 of file ComponentManager.c.

# createComponents()

static void ComponentManager::createComponents ( Entity owner,
ComponentSpec ** componentSpecs )
static

Create all the components from the specified specs array and attache to the provided owner.

Parameters
ownerObject to which the components attach to
componentSpecsSpecs to initialize the new components

Definition at line 203 of file ComponentManager.c.

# destroyAllComponents()

void ComponentManager::destroyAllComponents ( )

Destroy all the manager's components.

Definition at line 668 of file ComponentManager.c.

# destroyComponent()

static void ComponentManager::destroyComponent ( Entity owner,
Component component )
static

Destroy a component from the specified owner.

Parameters
ownerOwner of the component (can be NULL), must match the component's owner
componentComponent to destroy

Definition at line 73 of file ComponentManager.c.

# destroyComponents()

static void ComponentManager::destroyComponents ( Entity owner)
static

Destroy all the components from the specified owner.

Parameters
ownerObject to which the components attach to

Definition at line 224 of file ComponentManager.c.

# disable()

void ComponentManager::disable ( )
virtual

Disable the manager.

Reimplemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, WireframeManager, and WireframeManager.

Definition at line 708 of file ComponentManager.c.

# enable()

void ComponentManager::enable ( )
virtual

Enable the manager.

Reimplemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, WireframeManager, and WireframeManager.

Definition at line 701 of file ComponentManager.c.

# getComponentAtIndex()

static Component ComponentManager::getComponentAtIndex ( Entity owner,
uint32 componentType,
int16 componentIndex )
static

Retrieve a component of the given type at the desired position.

Parameters
ownerObject to which the components attach to
componentTypeType of components to add
componentIndexComponent's index according to their order of creation
Returns
Component at the provided index position

Definition at line 258 of file ComponentManager.c.

# getComponents()

static void ComponentManager::getComponents ( Entity owner,
uint32 componentType,
VirtualList components )
static

Retrieve a list with the components of the provided type belonging to the provided owner.

Parameters
ownerObject to which the components attach to
componentTypeType of components to add
componentsList to populate with the owner's compontents

Definition at line 290 of file ComponentManager.c.

# getComponentsCount()

static uint16 ComponentManager::getComponentsCount ( Entity owner,
uint32 componentType )
static

Retrieve the number of components belonging to the provided owner.

Parameters
ownerObject to which the components attach to
componentTypeType of components to count
Returns
Number of components belonging to the provided owner

Definition at line 356 of file ComponentManager.c.

# getComponentsOfClass()

static bool ComponentManager::getComponentsOfClass ( Entity owner,
ClassPointer classPointer,
VirtualList components,
uint32 componentType )
static

Retrieve the linked list of components that are instances of the provided class.

Parameters
ownerObject to which the components attach to
classPointerPointer to the class to use as search criteria. Usage: typeofclass(ClassName)
componentsLinked list to be filled with the components that meed the search criteria (it is externally allocated and must be externally deleted)
componentTypeType of components to retrieve
Returns
True if one or more components met the search criteria; false otherwise

Definition at line 317 of file ComponentManager.c.

# getType()

virtual uint32 ComponentManager::getType ( )
pure virtual

Retrieve the compoment type that the manager manages.

Returns
Component type

Implemented in BehaviorManager, BodyManager, ColliderManager, MutatorManager, SpriteManager, and WireframeManager.

# propagateCommand()

static void ComponentManager::propagateCommand ( int32 command,
Entity owner,
uint32 componentType,
... )
static

Propagate a command to the components of the provided type.

Parameters
commandCommand to propagate to all the components of the provided tyep
ownerOwner of the components to command (all if NULL)
componentTypeType of components towards which to propagate the command
...Variable arguments list depending on the command

Definition at line 401 of file ComponentManager.c.

# purgeComponents()

void ComponentManager::purgeComponents ( )
virtual

Force the purging of deleted components.

Reimplemented in SpriteManager.

Definition at line 715 of file ComponentManager.c.

# removeComponent()

static void ComponentManager::removeComponent ( Entity owner,
Component component )
static

Remove a component from the specified owner.

Parameters
ownerObject to which the components attach to
componentComponent to remove

Definition at line 125 of file ComponentManager.c.

# removeComponents()

static void ComponentManager::removeComponents ( Entity owner,
uint32 componentType )
static

Remove components from the specified owner.

Parameters
ownerObject to which the components attach to
componentTypeType of components to remove

Definition at line 166 of file ComponentManager.c.

# Member Data Documentation

# components

VirtualList ComponentManager::components
protected

List of components.

Definition at line 43 of file ComponentManager.h.

# locked

bool ComponentManager::locked
protected

Flag to prevent the manipulation of the components list.

Definition at line 46 of file ComponentManager.h.


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