gatb.core-API-1.4.2
SerialDispatcher Class Reference

Launches commands in current thread. More...

#include <Command.hpp>

Inheritance diagram for SerialDispatcher:
Inheritance graph

Public Member Functions

virtual ~SerialDispatcher ()
 
size_t dispatchCommands (std::vector< ICommand * > &commands, ICommand *postTreatment=0)
 
size_t getExecutionUnitsNumber ()
 
void setGroupSize (size_t groupSize)
 
size_t getGroupSize () const
 
- Public Member Functions inherited from IDispatcher
template<typename Item , typename Functor >
Status iterate (Iterator< Item > *iterator, const Functor &functor, size_t groupSize=1000, bool deleteSynchro=false)
 
template<typename Item , typename Functor >
Status iterate (const Iterator< Item > &iterator, const Functor &functor, size_t groupSize=1000, bool deleteSynchro=false)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Additional Inherited Members

- Protected Member Functions inherited from IDispatcher
template<typename Item , typename Functor >
Status iterate (Iterator< Item > *iterator, std::vector< Functor * > &functors, size_t groupSize=1000, bool deleteSynchro=false)
 
- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

Launches commands in current thread.

A dispatcher that uses the calling thread, so no parallelization.

This implementation can be useful to process ICommand instances in an serial way when it is required, while keeping an uniform API (ie. call dispatchCommands) for running ICommand instances.

Constructor & Destructor Documentation

virtual ~SerialDispatcher ( )
inlinevirtual

Destructor (defined because of presence of virtual methods).

Member Function Documentation

size_t dispatchCommands ( std::vector< ICommand * > &  commands,
ICommand postTreatment = 0 
)
virtual

Dispatch commands execution in some separate contexts (threads for instance). Once the commands are launched, this dispatcher waits for the commands finish. Then, it may have to execute a post treatment command (if any).

Parameters
[in]commands: commands to be executed
[in]postTreatment: command to be executed after all the commands are done
Returns
time elapsed in msec

Implements IDispatcher.

size_t getExecutionUnitsNumber ( )
inlinevirtual

Returns the number of execution units for this dispatcher. For instance, it could be the number of cores in a multi cores architecture.

Returns
the number of execution units.

Implements IDispatcher.

size_t getGroupSize ( ) const
inlinevirtual

Get the number of items to be retrieved from the iterator by one thread in a synchronized way.

Returns
the number of items.

Implements IDispatcher.

void setGroupSize ( size_t  groupSize)
inlinevirtual

Set the number of items to be retrieved from the iterator by one thread in a synchronized way.

Parameters
[in]groupSize: number of items to be retrieved.

Implements IDispatcher.


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