# Action::TaskFactory Class Reference

Task factory. More...

`#include <actions.hpp>`

Collaboration diagram for Action::TaskFactory:

[legend]
List of all members.

## Public Member Functions

Task::AutoPtr | create (TaskType type)
| Create a task.
void | registerTask (TaskType type, Task::AutoPtr task)
| Register a task prototype together with its type.

## Static Public Member Functions

static TaskFactory & | instance ()
| Get access to the task factory.

## Detailed Description

Task factory.

Creates an instance of the task of the requested type. The factory is implemented as a singleton, which can be accessed only through the static member function instance().

## Member Function Documentation

Task::AutoPtr Action::TaskFactory::create | ( | TaskType | type | ) |

Create a task.

Parameters:

  | type | Identifies the type of task to create.

Returns:
  An auto pointer that owns a task of the requested type. If the task type is not supported, the pointer is 0.

Remarks:
  The caller of the function should check the content of the returned auto pointer and take appropriate action (e.g., throw an exception) if it is 0.

TaskFactory & Action::TaskFactory::instance | ( |  | ) | `[static]`

| Get access to the task factory. Clients access the task factory exclusively through this method.

void Action::TaskFactory::registerTask | ( | TaskType | type,
|  | Task::AutoPtr | task
| ) |

Register a task prototype together with its type.

The task factory creates new tasks of a given type by cloning its associated prototype. Additional tasks can be registered. If called for a type which already exists in the list, the corresponding prototype is replaced.

Parameters:

  | type | Task type.
  | task | Pointer to the prototype. Ownership is transfered to the task factory. That's what the auto pointer indicates.

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

- actions.hpp
- actions.cpp