CompoundTask Class Reference
[PEARL.replay]

Maintains a set of tasks and executes them in sequence. More...

#include <CompoundTask.h>

Inheritance diagram for CompoundTask:

Task

List of all members.

Public Member Functions

Constructors & destructor
 CompoundTask ()
virtual ~CompoundTask ()
Executing the subtasks
virtual bool execute ()
Task handling
void add_task (Task *task)

Protected Member Functions

Execution control
virtual bool prepare ()
virtual bool finish ()


Detailed Description

A CompoundTask maintains a list of subtasks and executes them in the order they were added. Subtasks can be added with CompoundTask::add_task().

CompoundTask takes ownership of the task objects associated with it and will automatically free them on destruction.


Constructor & Destructor Documentation

CompoundTask (  ) 

Default constructor. Creates a new compound task without subtasks.

~CompoundTask (  )  [virtual]

Destructor. Deletes all subtasks associated with this compound task and destroys the instance.


Member Function Documentation

void add_task ( Task task  ) 

Add a subtask. The compound task will take ownership of the given task and release it on destruction.

Note that a single task can not be added to multiple CompoundTasks. However, it is save to append a task object to a single CompoundTask multiple times.

Parameters:
task Task object to be added

bool execute (  )  [virtual]

Executes the prepare() method to perform necessary initialitions, followed by all associated subtasks in the order they were added, and finally the finish() method to clean up. If any of these steps fail (indicated by returning false), execution is aborted immediately.

Returns:
True if all subtasks (including prepare() and finish() were successful, false otherwise.

Implements Task.

bool finish (  )  [protected, virtual]

The finish() callback method is called after the execution of the subtasks finishes. It can be overwritten in derived classes to perform necessary postprocessing after execution. It will only be called if all subtasks executed successfully.

The default implementation does nothing and returns successfully.

Returns:
Always true
See also:
execute()

bool prepare (  )  [protected, virtual]

The prepare() callback method is called before execution of the subtasks starts. It can be overwritten in derived classes to perform any necessary initialization steps before executing the subtasks.

The default implementation does nothing and returns successfully.

Returns:
Always true
See also:
execute()


SCALASCA    Copyright © 1998–2009 Forschungszentrum Jülich, Jülich Supercomputing Centre