ork::TaskGraph Class Reference
[taskgraph]

A task made of several sub tasks that may depend on each other. More...

#include <TaskGraph.h>

Inheritance diagram for ork::TaskGraph:
ork::Task ork::TaskListener ork::Object

List of all members.

Public Types

typedef SetIterator< ptr< Task > > TaskIterator
 An iterator to iterate over a set of tasks.

Public Member Functions

 TaskGraph ()
 Creates a new, empty task graph.
 TaskGraph (ptr< Task >)
 Creates a new task graph that encapsulates the given task.
virtual ~TaskGraph ()
 Deletes this tak graph.
virtual void init (set< Task * > &initialized)
 Calls init recursively on all sub tasks of this task graph.
virtual void setIsDone (bool done, unsigned int t, reason r)
 Calls setIsDone recursively on all sub tasks of this task graph.
virtual void setPredecessorsCompletionDate (unsigned int t)
 Calls setPredecessorsCompletionDate on the sub tasks of this task without predecessors.
bool isEmpty ()
 Returns true if this task graph does not contain any sub task.
TaskIterator getAllTasks ()
 Returns all the sub tasks of this task.
TaskIterator getFirstTasks ()
 Returns the sub tasks that do not have any predecessor.
TaskIterator getLastTasks ()
 Returns the sub tasks that do not have any successor.
TaskIterator getDependencies (ptr< Task > t)
 Returns the predecessor tasks of the given task.
TaskIterator getInverseDependencies (ptr< Task > t)
 Returns the successor tasks of the given task.
void addTask (ptr< Task > t)
 Adds a sub task to this task graph.
void removeTask (ptr< Task > t)
 Removes a sub task from this task graph.
void addDependency (ptr< Task > src, ptr< Task > dst)
 Adds a dependency between two sub tasks of this task graph.
void removeDependency (ptr< Task > src, ptr< Task > dst)
 Removes a dependency between two sub tasks of this task graph.
void removeAndGetDependencies (ptr< Task > src, set< ptr< Task > > &deletedDependencies)
 Removes all dependencies of the given subtask.
void clearDependencies ()
 Removes all the dependencies between the sub tasks of this task graph.
virtual void taskStateChanged (ptr< Task > t, bool done, Task::reason r)
 Notifies the listeners of this task that its execution state has changed.
virtual void completionDateChanged (ptr< Task > t, unsigned int date)
 Notifies the listeners of this task that the completion date of a sub task without successors has changed.

Protected Member Functions

void cleanup ()
 Clears the temporary data structures in this task graph that are used by schedulers.

Detailed Description

A task made of several sub tasks that may depend on each other.

A dependency between two tasks means that one task must be executed before the other. More precisely a dependency from task src to task dst means that dst must be executed before src. We say that dst is a predecessor task for src, and that src is a successor task for dst. Likewise, we say that src has a predecessor task (dst), and that dst has a successor task (src). A task graph is completed when all its sub tasks are executed.


Member Typedef Documentation

An iterator to iterate over a set of tasks.


Constructor & Destructor Documentation

ork::TaskGraph::TaskGraph (  ) 

Creates a new, empty task graph.

ork::TaskGraph::TaskGraph ( ptr< Task  ) 

Creates a new task graph that encapsulates the given task.

virtual ork::TaskGraph::~TaskGraph (  )  [virtual]

Deletes this tak graph.


Member Function Documentation

void ork::TaskGraph::addDependency ( ptr< Task src,
ptr< Task dst 
)

Adds a dependency between two sub tasks of this task graph.

Parameters:
src a sub task of this graph that must be executed after dst.
dst a sub task of this graph that must be executed before src.
void ork::TaskGraph::addTask ( ptr< Task t  ) 

Adds a sub task to this task graph.

Note that a task can be added to several task graphs at the same time.

Parameters:
t the task to be added to this sub graph. This task can be a task graph itself.
void ork::TaskGraph::cleanup (  )  [protected]

Clears the temporary data structures in this task graph that are used by schedulers.

void ork::TaskGraph::clearDependencies (  ) 

Removes all the dependencies between the sub tasks of this task graph.

virtual void ork::TaskGraph::completionDateChanged ( ptr< Task t,
unsigned int  date 
) [virtual]

Notifies the listeners of this task that the completion date of a sub task without successors has changed.

Implements ork::TaskListener.

TaskIterator ork::TaskGraph::getAllTasks (  ) 

Returns all the sub tasks of this task.

The returned iterator does not iterate recursively in the sub sub tasks, if any.

TaskIterator ork::TaskGraph::getDependencies ( ptr< Task t  ) 

Returns the predecessor tasks of the given task.

Parameters:
t a sub task of this task graph.
TaskIterator ork::TaskGraph::getFirstTasks (  ) 

Returns the sub tasks that do not have any predecessor.

These tasks are executed first. The returned iterator does not iterate recursively in the sub sub tasks, if any.

TaskIterator ork::TaskGraph::getInverseDependencies ( ptr< Task t  ) 

Returns the successor tasks of the given task.

Parameters:
t a sub task of this task graph.
TaskIterator ork::TaskGraph::getLastTasks (  ) 

Returns the sub tasks that do not have any successor.

These tasks are executed last. The returned iterator does not iterate recursively in the sub sub tasks, if any.

virtual void ork::TaskGraph::init ( set< Task * > &  initialized  )  [virtual]

Calls init recursively on all sub tasks of this task graph.

bool ork::TaskGraph::isEmpty (  ) 

Returns true if this task graph does not contain any sub task.

void ork::TaskGraph::removeAndGetDependencies ( ptr< Task src,
set< ptr< Task > > &  deletedDependencies 
)

Removes all dependencies of the given subtask.

All deleted dependencies are stored in deletedDependencies.

Parameters:
src a sub task of this graph.
[out] deletedDependencies the dependencies that src had.
void ork::TaskGraph::removeDependency ( ptr< Task src,
ptr< Task dst 
)

Removes a dependency between two sub tasks of this task graph.

Parameters:
src a sub task of this graph that must be executed after dst.
dst a sub task of this graph that must be executed before src.
void ork::TaskGraph::removeTask ( ptr< Task t  ) 

Removes a sub task from this task graph.

This sub task must not have any dependencies or inverse dependencies.

Parameters:
t the task to be removed from this sub graph.
virtual void ork::TaskGraph::setIsDone ( bool  done,
unsigned int  t,
reason  r 
) [virtual]

Calls setIsDone recursively on all sub tasks of this task graph.

Reimplemented from ork::Task.

virtual void ork::TaskGraph::setPredecessorsCompletionDate ( unsigned int  t  )  [virtual]

Calls setPredecessorsCompletionDate on the sub tasks of this task without predecessors.

Reimplemented from ork::Task.

virtual void ork::TaskGraph::taskStateChanged ( ptr< Task t,
bool  done,
Task::reason  r 
) [virtual]

Notifies the listeners of this task that its execution state has changed.

This method is called when the execution state of a sub task of this graph has changed. Indeed a TaskGraph is a TaskListener that listens to state changes in all its sub tasks.

Implements ork::TaskListener.


Generated on Mon Oct 18 09:36:12 2010 for ork by  doxygen 1.6.1