DustyEngine::Task Class Reference

Task class represents a task in the engine which automates a task on a time-based basis. More...

#include <dustytask.h>

Inheritance diagram for DustyEngine::Task:

DustyEngine::DummyTask DustyEngine::AABBCollisionTask DustyEngine::CounterTask DustyEngine::EntityParentTask DustyEngine::InterpolatedTask DustyEngine::IntervalCounterTask DustyEngine::MoveTask DustyEngine::NodeGeneratorTask DustyEngine::RotateTask DustyEngine::ScaleTask List of all members.

Public Member Functions

 Task ()
 The constructor sets the default values for all task variables.
virtual ~Task ()
virtual void OnCreation ()=0
 OnCreation() is called by the TaskTree when the task is added to the tree using the AddTask() function of the tree.
virtual void OnDestruction ()=0
 OnDestruction() is called by the TaskTree when the task is removed from the tree.
virtual void OnPause ()=0
 OnPause() is called when the task has been paused by the TaskTree.
virtual void OnUnpause ()=0
 OnUnpause() is called when the task has been unpaused by the TaskTree.
virtual void OnUpdate ()=0
 OnUpdate() is called by the TaskTree when the time has come to execute the task's code.
virtual void OnAddChild (Task *child)=0
virtual void OnRemoveChild (Task *child)=0
virtual void OnLifetimeExpired ()=0
 OnLifetimeExpired() is called by the TaskTree when the task's lifetime on the tree has expired, either number of executions or amount of time.
virtual void OnChildrenPaused ()=0
 OnChildrenPaused() is called by the TaskTree when PauseChildren has been called on this task, pausing all the task's children.
virtual void OnChildrenUnpaused ()=0
 OnChildrenUnpaused() is called by the TaskTree when UnpauseChildren has been called on this task, unpausing all the task's children.
void SetDustyDriver (DustyDriver *dd)
DustyDriverGetDustyDriver ()
void SetIrrlichtDevice (irr::IrrlichtDevice *device)
irr::IrrlichtDevice * GetIrrlichtDevice ()
void SetPriority (irr::u32 p)
irr::u32 GetPriority ()
void SetPaused (bool p)
bool IsPaused ()
void SetParent (Task *p)
TaskGetParent ()
void SetExecuteMultiple (bool execute)
bool GetExecuteMultiple ()
void SetNumExecutions (irr::u32 n)
irr::u32 GetNumExecutions ()
void SetDeltaTimer (DeltaTimer *entry)
DeltaTimerGetDeltaTimer ()
void SetPauseDelta (irr::u32 pd)
irr::u32 GetPauseDelta ()
void SetLifetimeExecutions (irr::u32 lt)
irr::u32 GetLifetimeExecutions ()
void SetLifetimeMS (irr::u32 lt)
irr::u32 GetLifetimeMS ()
void SetCreationTime (irr::u32 ct)
irr::u32 GetCreationTime ()
void SetTotalTimeDelta (irr::u32 ttd)
irr::u32 GetTotalTimeDelta ()
void SetPauseUnpauseTime (irr::u32 t)
irr::u32 GetPauseUnpauseTime ()
void SetTimeToStayPaused (irr::u32 t)
 Sets the amount of time that this task should stay paused when it is paused by the task tree. If this value is not 0, then it represents the number of milliseconds the task will stay paused. After that time has passed, the task tree will automatically unpause it. If the value is 0, the task stays paused until manually unpaused.
irr::u32 GetTimeToStayPaused ()
 Returns the amount of time this task will stay paused when it is paused by the task tree.
void SetTimeToStayUnpaused (irr::u32 t)
 Sets the amount of time this task should be allowed to run when it has been unpaused by the task tree. If this value is not 0, then the task tree will automatically pause the task after this time in milliseconds has passed. If the value is 0, then the task will stay paused until manually unpaused.
irr::u32 GetTimeToStayUnpaused ()
 Returns the amount of time this task will stay unpaused when it is unpaused by the task tree.
void AddChild (Task *child)
void ClearChildren ()
 ClearChildren() will remove all the children from this task.
void RemoveChild (Task *child)
irr::core::list< Task * > * GetChildren ()
irr::u32 NumChildren ()
void SetTag (irr::core::stringc t)
 Sets the string tag associated with this task. The tag is for external use only, it is not used by Dusty Engine.
irr::core::stringc GetTag ()
 Gets the string tag associated with this task.

Protected Attributes

irr::IrrlichtDevice * irrlichtDevice
DustyDriverdustyDriver
irr::core::stringc tag
irr::u32 priority
irr::u32 numExecutions
irr::u32 pauseDelta
irr::u32 lifetimeExecutions
irr::u32 lifetimeMS
irr::u32 creationTime
irr::u32 totalTimeDelta
irr::u32 pauseUnpauseTime
irr::u32 timeToStayPaused
irr::u32 timeToStayUnpaused
bool paused
bool executeMultiple
Taskparent
DeltaTimerdeltaTimer
irr::core::list< Task * > children

Detailed Description

Task class represents a task in the engine which automates a task on a time-based basis.

The Task class is the backbone of Dusty Engine. A task is a logical collection of code which accomplishes a certain task. This task may be as simple as moving an object on screen or as complex as updating the entire game logic. A task is executed by the TaskTree either every time TaskTree's DoUpdates() function is called or after a certain amount of time has passed. When a task is paused, it is seamless; unpausing it causes the task to pick right up exactly where it left off as though no time had passed at all.

ALL Update/Pause/Unpause/Destroy operations on tasks should be performed by the TaskTree to maintain consistency!

Definition at line 51 of file dustytask.h.


Constructor & Destructor Documentation

DustyEngine::Task::Task  ) 
 

The constructor sets the default values for all task variables.

virtual DustyEngine::Task::~Task  )  [virtual]
 


Member Function Documentation

void DustyEngine::Task::AddChild Task child  ) 
 

AddChild() adds a child to the task. This is called automatically by TaskTree's AddTask() function.

Parameters:
child,: The child task to add to this task.

void DustyEngine::Task::ClearChildren  ) 
 

ClearChildren() will remove all the children from this task.

irr::core::list<Task*>* DustyEngine::Task::GetChildren  ) 
 

GetChildren() returns a pointer to the list of children this task has.

Returns:
Returns a pointer to this task's list of children.

irr::u32 DustyEngine::Task::GetCreationTime  ) 
 

GetCreationTime() returns the time this task was created.

Returns:
Returns the time the task was created.

DeltaTimer* DustyEngine::Task::GetDeltaTimer  ) 
 

GetTimeServerEntry() returns the time server entry used by this task.

Returns:
Returns a pointer to this task's time server entry.

DustyDriver* DustyEngine::Task::GetDustyDriver  ) 
 

GetDustyDriver() returns a pointer to the DustyDriver used by this task.

Returns:
Returns a pointer to this task's DustyDriver.

bool DustyEngine::Task::GetExecuteMultiple  ) 
 

GetExecuteMultiple() returns whether this task will update more than once if enough time has passed.

Returns:
Returns true if the task will update multiple times, and false if not.

irr::IrrlichtDevice* DustyEngine::Task::GetIrrlichtDevice  ) 
 

GetIrrlichtDevice() returns the IrrlichtDevice this task uses.

Returns:
Returns a pointer to the IrrlichtDevice.

irr::u32 DustyEngine::Task::GetLifetimeExecutions  ) 
 

GetLifetimeExecutions() returns the amount of times the task will execute before being destroyed.

Returns:
Returns the total number of executions this task should execute.

irr::u32 DustyEngine::Task::GetLifetimeMS  ) 
 

GetLifetimeMS() returns the number of milliseconds this task should exist on the task tree.

Returns:
Returns the amount of time this task should exist.

irr::u32 DustyEngine::Task::GetNumExecutions  ) 
 

GetNumExecutions() returns the number of times the task has been updated.

Returns:
Returns the number of times the task has updated.

Task* DustyEngine::Task::GetParent  ) 
 

GetParent() returns the parent of this task.

Returns:
Returns a pointer to this task's parent.

irr::u32 DustyEngine::Task::GetPauseDelta  ) 
 

GetPauseDelta() returns the time-delta of the task at the moment it was paused by TaskTree.

Returns:
Returns the paused time-delta.

irr::u32 DustyEngine::Task::GetPauseUnpauseTime  ) 
 

irr::u32 DustyEngine::Task::GetPriority  ) 
 

GetPriority() returns the amount of time (in milliseconds) between executions of the task. This is called automatically by TaskTree's AddTask() function.

Returns:
Returns the priority of the task.

irr::core::stringc DustyEngine::Task::GetTag  ) 
 

Gets the string tag associated with this task.

irr::u32 DustyEngine::Task::GetTimeToStayPaused  ) 
 

Returns the amount of time this task will stay paused when it is paused by the task tree.

irr::u32 DustyEngine::Task::GetTimeToStayUnpaused  ) 
 

Returns the amount of time this task will stay unpaused when it is unpaused by the task tree.

irr::u32 DustyEngine::Task::GetTotalTimeDelta  ) 
 

GetTotalTimeDelta() returns the total amount of time-delta time this task has had.

Returns:
Returns the total amount of time-delta time that has elapsed since the task was created. (Not necessarily the total time this task has existed!)

bool DustyEngine::Task::IsPaused  ) 
 

IsPaused() returns whether or not this task has been flagged as paused.

Returns:
Returns true if the task is paused and false if it is unpaused.

irr::u32 DustyEngine::Task::NumChildren  ) 
 

NumChildren() returns the number of children of this task.

Returns:
Returns the number of children this task has.

virtual void DustyEngine::Task::OnAddChild Task child  )  [pure virtual]
 

OnAddChild() is called by the TaskTree when a child task has been added to this task.

Parameters:
child,: A pointer to the task that is now a child of this one.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnChildrenPaused  )  [pure virtual]
 

OnChildrenPaused() is called by the TaskTree when PauseChildren has been called on this task, pausing all the task's children.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnChildrenUnpaused  )  [pure virtual]
 

OnChildrenUnpaused() is called by the TaskTree when UnpauseChildren has been called on this task, unpausing all the task's children.

Implemented in DustyEngine::DummyTask, and DustyEngine::EntityParentTask.

virtual void DustyEngine::Task::OnCreation  )  [pure virtual]
 

OnCreation() is called by the TaskTree when the task is added to the tree using the AddTask() function of the tree.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnDestruction  )  [pure virtual]
 

OnDestruction() is called by the TaskTree when the task is removed from the tree.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnLifetimeExpired  )  [pure virtual]
 

OnLifetimeExpired() is called by the TaskTree when the task's lifetime on the tree has expired, either number of executions or amount of time.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnPause  )  [pure virtual]
 

OnPause() is called when the task has been paused by the TaskTree.

Implemented in DustyEngine::DummyTask, and DustyEngine::EntityParentTask.

virtual void DustyEngine::Task::OnRemoveChild Task child  )  [pure virtual]
 

OnRemoveChild() is called by the TaskTree when a child has been removed from this task.

Parameters:
child,: A pointer to the task which has been removed.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnUnpause  )  [pure virtual]
 

OnUnpause() is called when the task has been unpaused by the TaskTree.

Implemented in DustyEngine::DummyTask.

virtual void DustyEngine::Task::OnUpdate  )  [pure virtual]
 

OnUpdate() is called by the TaskTree when the time has come to execute the task's code.

OnUpdate is typically the most important function. OnUpdate is only called when enough time has passed or every frame, depending upon what the priority of the task is. If you want code to execute on a time-based basis, put that code here and add the task to the tree.

Implemented in DustyEngine::AABBCollisionTask, DustyEngine::ColorInterpolatedTask, DustyEngine::CountDownTask, DustyEngine::CounterTask, DustyEngine::DummyTask, DustyEngine::InterpolatedTask, DustyEngine::IntervalCounterTask, DustyEngine::MoveBoundedTask, DustyEngine::MoveInterpolatedTask, DustyEngine::MoveTask, DustyEngine::NodeGeneratorTask, DustyEngine::RotateBoundedTask, DustyEngine::RotateInterpolatedTask, DustyEngine::RotateTask, DustyEngine::ScaleBoundedTask, DustyEngine::ScaleInterpolatedTask, DustyEngine::ScaleTask, DustyEngine::VectorInterpolatedTask, DustyEngine::WaypointMoveInterpolatedTask, DustyEngine::WaypointRotateInterpolatedTask, and DustyEngine::WaypointScaleInterpolatedTask.

void DustyEngine::Task::RemoveChild Task child  ) 
 

RemoveChild() removes a child from this task's list of children. This is called automatically when the TaskTree destroys a child.

Parameters:
child,: The child to remove from the list.

void DustyEngine::Task::SetCreationTime irr::u32  ct  ) 
 

SetCreationTime() sets the time at which this task was created. It is called automatically by the TaskTree's AddTask() function.

Parameters:
ct,: The creation time of the task.

void DustyEngine::Task::SetDeltaTimer DeltaTimer entry  ) 
 

SetTimeServerEntry() sets a pointer to the time server entry that this task should use for all its time-delta functions. This is called automatically by TaskTree's AddTask() function.

Parameters:
entry,: A pointer to the time server entry this task should use.

void DustyEngine::Task::SetDustyDriver DustyDriver dd  ) 
 

SetDustyDriver() tells the task a pointer to the DustyDriver. This is called automatically by TaskTree in the AddTask() function.

Parameters:
dd,: A pointer to the Dusty Engine driver.

void DustyEngine::Task::SetExecuteMultiple bool  execute  ) 
 

Say you have a task whose priority is 100 milliseconds. Then the TaskTree tries to update, and it turns out that 1000 milliseconds have passed since the task was last updated. This allows you to have the task update 10 times to make up the slack, or to only update once no matter how much time has passed.

void DustyEngine::Task::SetIrrlichtDevice irr::IrrlichtDevice *  device  ) 
 

SetIrrlichtDevice() tells the task the irrlicht device it should use. This is called automatically by TaskTree() in the AddTask() function.

Parameters:
device,: A pointer to the IrrlichtDevice this task should use.

void DustyEngine::Task::SetLifetimeExecutions irr::u32  lt  ) 
 

SetLifeTimeExecutions() will set the number of times this task should be executed by the TaskTree before it is destroyed. This is called automatically by TaskTree's AddTask() function.

Parameters:
lt,: The number of executions this task should execute. If lt is 0, then the task will not be subject to a certain number of executions.

void DustyEngine::Task::SetLifetimeMS irr::u32  lt  ) 
 

SetLifetimeMS() will set the number of milliseconds this task should exist before being destroyed by the TaskTree. This is called automatically by TaskTree's AddTask() function.

Parameters:
lt,: The number of milliseconds this task should exist. If lt is 0, then the task will not be subject to lifetime in milliseconds.

void DustyEngine::Task::SetNumExecutions irr::u32  n  ) 
 

SetNumExecutions() allows you to set the number of times this task has executed. This is set to 0 by TaskTree's AddTask() function.

Parameters:
n,: The new number of times it has been executed.

void DustyEngine::Task::SetParent Task p  ) 
 

SetParent() sets the parent task of this task. This is called automatically by TaskTree's AddTask() function.

Parameters:
p,: A pointer to the task that is this task's parent.

void DustyEngine::Task::SetPaused bool  p  ) 
 

SetPaused() will set whether or not the task is paused. This does NOT correctly pause the task. Pausing should be done by the TaskTree. This is called automatically by TaskTree's Pause()/UnPause()/AddTask() functions.

Parameters:
p,: If p is true, then the task is flagged as paused. If p is false, the task is flagged as unpaused.

void DustyEngine::Task::SetPauseDelta irr::u32  pd  ) 
 

SetPausedDelta() is used by TaskTree to set the time-delta of the task at the moment the task was paused. This is what allows for seamless unpausing, because the task will be restored to the same time-delta after it's unpaused. This is called automatically by TaskTree's PauseTask() function.

Parameters:
pd,: The delta-time of the task at the moment of being paused.

void DustyEngine::Task::SetPauseUnpauseTime irr::u32  t  ) 
 

void DustyEngine::Task::SetPriority irr::u32  p  ) 
 

SetPriority() sets the amount of time (in milliseconds) between executions of the task. This is called automatically by TaskTree's AddTask() function.

Parameters:
p,: The number of milliseconds between executions of the task. If p is 0, the task will execute every time TaskTree's DoUpdates() is called.

void DustyEngine::Task::SetTag irr::core::stringc  t  ) 
 

Sets the string tag associated with this task. The tag is for external use only, it is not used by Dusty Engine.

void DustyEngine::Task::SetTimeToStayPaused irr::u32  t  ) 
 

Sets the amount of time that this task should stay paused when it is paused by the task tree. If this value is not 0, then it represents the number of milliseconds the task will stay paused. After that time has passed, the task tree will automatically unpause it. If the value is 0, the task stays paused until manually unpaused.

void DustyEngine::Task::SetTimeToStayUnpaused irr::u32  t  ) 
 

Sets the amount of time this task should be allowed to run when it has been unpaused by the task tree. If this value is not 0, then the task tree will automatically pause the task after this time in milliseconds has passed. If the value is 0, then the task will stay paused until manually unpaused.

void DustyEngine::Task::SetTotalTimeDelta irr::u32  ttd  ) 
 

SetTotalTimeDelta() sets the total amount of time-delta time this task has had. This is called automatically by TaskTree()'s OnUpdate() function.

Parameters:
ttd,: The new total time delta.


Member Data Documentation

irr::core::list<Task *> DustyEngine::Task::children [protected]
 

Definition at line 271 of file dustytask.h.

irr::u32 DustyEngine::Task::creationTime [protected]
 

Definition at line 256 of file dustytask.h.

DeltaTimer* DustyEngine::Task::deltaTimer [protected]
 

Definition at line 269 of file dustytask.h.

DustyDriver* DustyEngine::Task::dustyDriver [protected]
 

Definition at line 247 of file dustytask.h.

bool DustyEngine::Task::executeMultiple [protected]
 

Definition at line 265 of file dustytask.h.

irr::IrrlichtDevice* DustyEngine::Task::irrlichtDevice [protected]
 

Definition at line 246 of file dustytask.h.

irr::u32 DustyEngine::Task::lifetimeExecutions [protected]
 

Definition at line 254 of file dustytask.h.

irr::u32 DustyEngine::Task::lifetimeMS [protected]
 

Definition at line 255 of file dustytask.h.

irr::u32 DustyEngine::Task::numExecutions [protected]
 

Definition at line 252 of file dustytask.h.

Task* DustyEngine::Task::parent [protected]
 

Definition at line 267 of file dustytask.h.

bool DustyEngine::Task::paused [protected]
 

Definition at line 264 of file dustytask.h.

irr::u32 DustyEngine::Task::pauseDelta [protected]
 

Definition at line 253 of file dustytask.h.

irr::u32 DustyEngine::Task::pauseUnpauseTime [protected]
 

Definition at line 259 of file dustytask.h.

irr::u32 DustyEngine::Task::priority [protected]
 

Definition at line 251 of file dustytask.h.

irr::core::stringc DustyEngine::Task::tag [protected]
 

Definition at line 249 of file dustytask.h.

irr::u32 DustyEngine::Task::timeToStayPaused [protected]
 

Definition at line 261 of file dustytask.h.

irr::u32 DustyEngine::Task::timeToStayUnpaused [protected]
 

Definition at line 262 of file dustytask.h.

irr::u32 DustyEngine::Task::totalTimeDelta [protected]
 

Definition at line 257 of file dustytask.h.


The documentation for this class was generated from the following file:
Generated on Fri Jan 27 17:32:04 2006 for Dusty Engine by  doxygen 1.4.6-NO