dp::ICommand Class Referenceabstract

Interface of what a command is. More...

#include <ICommand.hpp>

Inheritance diagram for dp::ICommand:

Public Member Functions

virtual void execute ()=0
- Public Member Functions inherited from dp::SmartPointer
virtual void use ()
virtual void forget ()

Additional Inherited Members

- Protected Member Functions inherited from dp::SmartPointer
 SmartPointer ()
virtual ~SmartPointer ()

Detailed Description

Interface of what a command is.

This class represents the Design Pattern Command whose purpose is to encapsulate some processing into a uniform calling procedure, a 'execute' method.

The command concept provides a uniform way for running some work. This is achieved by refining the execute() method of the ICommand interface. Doing so makes the actual job encapsulated inside the execute() body; clients that want to use commands only have to know how to launch them: calling execute().

This uniformization also allows to define some interface that know how to manipulate commands instance; we call this interface ICommandInvoker and it merely knows how to run a ICommand instance and wait until the command is finished. From this point of view, the ICommandInvoker can be seen as an oriented object abstraction of the thread concept.

The further step is to introduce an interface that can manage a list of commands. For instance, in a dual core architecture, it is possible to launch two instances of commands in two separated threads, which means we got a parallelization scheme. It is therefore interesting to define an interface that takes a list of commands an dispatch them in different threads; we call such an interface a command dispatcher. Note that an implementation of such a dispatcher can parallelize the commands, but another implementation can only serialize the commands; so, job parallelization or serialization is just a matter of choice in the actual implementation of the dispatcher interface.

PLAST will make a huge use of commands and commands dispatchers; in particular, since it is based on seeds iteration, PLAST will use a list of iterators (each of them iterating a subset of seeds), each one being iterated in a specific command. So using a parallel commands dispatcher on this list of commands will provide a parallelization scheme using the multicore architecture of modern computers.

Sample of use:

class MyCommand : public ICommand
void execute () { printf ("I am doing something there\n"); }
See also

Member Function Documentation

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