Exiv2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Action::TaskFactory Class Reference

Task factory. More...

#include <actions.hpp>

Public Member Functions

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

Static Public Member Functions

static TaskFactoryinstance ()
 Get access to the task factory. More...
 

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
typeIdentifies 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.

References Action::Task::clone().

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
typeTask type.
taskPointer 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: