gatb.core-API-1.4.2
ICommand Class Referenceabstract

Interface of what a command is. More...

#include <ICommand.hpp>

Inheritance diagram for ICommand:
Inheritance graph

Public Member Functions

virtual void execute ()=0
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 
virtual void use ()=0
 
virtual void forget ()=0
 

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().

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.

Sample of use:

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

Member Function Documentation

virtual void execute ( )
pure virtual

Method that executes some job.


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