Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::TSequentialExecutor Class Reference

Definition at line 25 of file TSequentialExecutor.hxx.

Public Member Functions

 TSequentialExecutor ()=default
 
 TSequentialExecutor (const TSequentialExecutor &)=delete
 
template<class F , class T >
void Foreach (F func, const std::vector< T > &args)
 Execute a function over the elements of an immutable vector, dividing the execution in nChunks.
 
template<class F , class INTEGER >
void Foreach (F func, ROOT::TSeq< INTEGER > args)
 Execute a function over a sequence of indexes, dividing the execution in nChunks.
 
template<class F , class T >
void Foreach (F func, std::initializer_list< T > args)
 Execute a function over the elements of an initializer_list, dividing the execution in nChunks.
 
template<class F , class T >
void Foreach (F func, std::vector< T > &args)
 Execute a function over the elements of a vector, dividing the execution in nChunks.
 
template<class F >
void Foreach (F func, unsigned nTimes)
 Execute a function without arguments several times, dividing the execution in nChunks.
 
unsigned GetPoolSize () const
 Return the number of workers in the sequential executor: a single one.
 
auto Map (F func, const std::vector< T > &args) -> std::vector< InvokeResult_t< F, T > >
 Execute a function over the elements of an immutable vector.
 
auto Map (F func, ROOT::TSeq< INTEGER > args) -> std::vector< InvokeResult_t< F, INTEGER > >
 Execute a function over a sequence of indexes.
 
auto Map (F func, std::initializer_list< T > args) -> std::vector< InvokeResult_t< F, T > >
 Execute a function over the elements of an initializer_list.
 
auto Map (F func, std::vector< T > &args) -> std::vector< InvokeResult_t< F, T > >
 Execute a function over the elements of a vector.
 
auto Map (F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
 Execute a function without arguments several times.
 
T * MapReduce (F func, const std::vector< T * > &args)
 Execute a function over the TObject-inheriting elements of an immutable vector (Map) and merge the objects into a single one (Reduce).
 
auto MapReduce (F func, const std::vector< T > &args, R redfunc) -> InvokeResult_t< F, T >
 Execute a function over the elements of an immutable vector (Map) and accumulate the results into a single value (Reduce).
 
auto MapReduce (F func, ROOT::TSeq< INTEGER > args, R redfunc) -> InvokeResult_t< F, INTEGER >
 Execute a function over a sequence of indexes (Map) and accumulate the results into a single value (Reduce).
 
auto MapReduce (F func, std::initializer_list< T > args, R redfunc) -> InvokeResult_t< F, T >
 Execute a function over the elements of an initializer_list (Map) and accumulate the results into a single value (Reduce).
 
T * MapReduce (F func, std::vector< T * > &args)
 Execute a function over the TObject-inheriting elements of a vector (Map) and merge the objects into a single one (Reduce).
 
auto MapReduce (F func, std::vector< T > &args, R redfunc) -> InvokeResult_t< F, T >
 Execute a function over the elements of a vector (Map) and accumulate the results into a single value (Reduce).
 
auto MapReduce (F func, unsigned nTimes, R redfunc) -> InvokeResult_t< F >
 Execute a function without arguments several times (Map) and accumulate the results into a single value (Reduce).
 
TSequentialExecutoroperator= (const TSequentialExecutor &)=delete
 
T * Reduce (const std::vector< T * > &mergeObjs)
 "Reduce" an std::vector into a single object by using the object's Merge method.
 
auto Reduce (const std::vector< T > &objs, R redfunc) -> decltype(redfunc(objs))
 "Reduce" an std::vector into a single object by passing a function as the second argument defining the reduction operation.
 

Protected Types

using InvokeResult_t
 
using validMapReturnCond
 type definition used in templated functions for not allowing mapping functions that return references or void.
 

Private Member Functions

TSequentialExecutorDerived ()
 
template<class F , class T , class Cond = validMapReturnCond<F, T>>
auto MapImpl (F func, const std::vector< T > &args) -> std::vector< InvokeResult_t< F, T > >
 Execute a function over the elements of an immutable vector.
 
template<class F , class INTEGER , class Cond = validMapReturnCond<F, INTEGER>>
auto MapImpl (F func, ROOT::TSeq< INTEGER > args) -> std::vector< InvokeResult_t< F, INTEGER > >
 Execute a function over a sequence of indexes.
 
template<class F , class T , class Cond = validMapReturnCond<F, T>>
auto MapImpl (F func, std::vector< T > &args) -> std::vector< InvokeResult_t< F, T > >
 Execute a function over the elements of a vector in parallel Implementation of the Map method.
 
template<class F , class Cond = validMapReturnCond<F>>
auto MapImpl (F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
 Execute a function without arguments several times.
 

Private Attributes

friend TExecutorCRTP
 

#include <ROOT/TSequentialExecutor.hxx>

Inheritance diagram for ROOT::TSequentialExecutor:
ROOT::TExecutorCRTP< TSequentialExecutor >

Member Typedef Documentation

◆ InvokeResult_t

using ROOT::TExecutorCRTP< TSequentialExecutor >::InvokeResult_t
protectedinherited

Definition at line 107 of file TExecutorCRTP.hxx.

◆ validMapReturnCond

using ROOT::TExecutorCRTP< TSequentialExecutor >::validMapReturnCond
protectedinherited

type definition used in templated functions for not allowing mapping functions that return references or void.

The resulting vector elements must be assignable, references aren't.

Definition at line 112 of file TExecutorCRTP.hxx.

Constructor & Destructor Documentation

◆ TSequentialExecutor() [1/2]

ROOT::TSequentialExecutor::TSequentialExecutor ( )
default

◆ TSequentialExecutor() [2/2]

ROOT::TSequentialExecutor::TSequentialExecutor ( const TSequentialExecutor & )
delete

Member Function Documentation

◆ Derived()

TSequentialExecutor & ROOT::TExecutorCRTP< TSequentialExecutor >::Derived ( )
inlineprivateinherited

Definition at line 156 of file TExecutorCRTP.hxx.

◆ Foreach() [1/5]

template<class F , class T >
void ROOT::TSequentialExecutor::Foreach ( F func,
const std::vector< T > & args )

Execute a function over the elements of an immutable vector, dividing the execution in nChunks.

Parameters
funcFunction to be executed on the elements of the immutable vector passed as second parameter.
argsImmutable vector of elements passed as an argument to func.

Definition at line 131 of file TSequentialExecutor.hxx.

◆ Foreach() [2/5]

template<class F , class INTEGER >
void ROOT::TSequentialExecutor::Foreach ( F func,
ROOT::TSeq< INTEGER > args )

Execute a function over a sequence of indexes, dividing the execution in nChunks.

Parameters
funcFunction to be executed. Must take an element of the sequence passed assecond argument as a parameter.
argsSequence of indexes to execute func on.

Definition at line 98 of file TSequentialExecutor.hxx.

◆ Foreach() [3/5]

template<class F , class T >
void ROOT::TSequentialExecutor::Foreach ( F func,
std::initializer_list< T > args )

Execute a function over the elements of an initializer_list, dividing the execution in nChunks.

Parameters
funcFunction to be executed on the elements of the initializer_list passed as second parameter.
argsinitializer_list for a vector to apply func on.

Definition at line 108 of file TSequentialExecutor.hxx.

◆ Foreach() [4/5]

template<class F , class T >
void ROOT::TSequentialExecutor::Foreach ( F func,
std::vector< T > & args )

Execute a function over the elements of a vector, dividing the execution in nChunks.

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.

Definition at line 119 of file TSequentialExecutor.hxx.

◆ Foreach() [5/5]

template<class F >
void ROOT::TSequentialExecutor::Foreach ( F func,
unsigned nTimes )

Execute a function without arguments several times, dividing the execution in nChunks.

Parameters
funcFunction to be executed.
nTimesNumber of times function should be called.

Definition at line 88 of file TSequentialExecutor.hxx.

◆ GetPoolSize()

unsigned ROOT::TSequentialExecutor::GetPoolSize ( ) const
inline

Return the number of workers in the sequential executor: a single one.

Returns
The number of workers in the pool, one.

Definition at line 65 of file TSequentialExecutor.hxx.

◆ Map() [1/5]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Map ( F func,
const std::vector< T > & args )-> std::vector<InvokeResult_t<F, T>>
inherited

Execute a function over the elements of an immutable vector.

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
Returns
A vector with the results of the function calls.

Definition at line 131 of file TExecutorCRTP.hxx.

◆ Map() [2/5]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Map ( F func,
ROOT::TSeq< INTEGER > args )-> std::vector<InvokeResult_t<F, INTEGER>>
inherited

Execute a function over a sequence of indexes.

Parameters
funcFunction to be executed. Must take an element of the sequence passed assecond argument as a parameter.
argsSequence of indexes to execute func on.
Returns
A vector with the results of the function calls.

Definition at line 125 of file TExecutorCRTP.hxx.

◆ Map() [3/5]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Map ( F func,
std::initializer_list< T > args )-> std::vector<InvokeResult_t<F, T>>
inherited

Execute a function over the elements of an initializer_list.

Parameters
funcFunction to be executed on the elements of the initializer_list passed as second parameter.
argsinitializer_list for a vector to apply func on.
Returns
A vector with the results of the function calls.

Definition at line 127 of file TExecutorCRTP.hxx.

◆ Map() [4/5]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Map ( F func,
std::vector< T > & args )-> std::vector<InvokeResult_t<F, T>>
inherited

Execute a function over the elements of a vector.

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
Returns
A vector with the results of the function calls.

Definition at line 129 of file TExecutorCRTP.hxx.

◆ Map() [5/5]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Map ( F func,
unsigned nTimes )-> std::vector<InvokeResult_t<F>>
inherited

Execute a function without arguments several times.

Parameters
funcFunction to be executed.
nTimesNumber of times function should be called.
Returns
A vector with the results of the function calls. Functions that take arguments can be executed (with fixed arguments) by wrapping them in a lambda or with std::bind.

Definition at line 123 of file TExecutorCRTP.hxx.

◆ MapImpl() [1/4]

template<class F , class T , class Cond >
auto ROOT::TSequentialExecutor::MapImpl ( F func,
const std::vector< T > & args ) -> std::vector<InvokeResult_t<F, T>>
private

Execute a function over the elements of an immutable vector.

Implementation of the Map method.

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
Returns
A vector with the results of the function calls.

Definition at line 191 of file TSequentialExecutor.hxx.

◆ MapImpl() [2/4]

template<class F , class INTEGER , class Cond >
auto ROOT::TSequentialExecutor::MapImpl ( F func,
ROOT::TSeq< INTEGER > args ) -> std::vector<InvokeResult_t<F, INTEGER>>
private

Execute a function over a sequence of indexes.

Implementation of the Map method.

Parameters
funcFunction to be executed. Must take an element of the sequence passed assecond argument as a parameter.
argsSequence of indexes to execute func on.
Returns
A vector with the results of the function calls.

Definition at line 159 of file TSequentialExecutor.hxx.

◆ MapImpl() [3/4]

template<class F , class T , class Cond >
auto ROOT::TSequentialExecutor::MapImpl ( F func,
std::vector< T > & args ) -> std::vector<InvokeResult_t<F, T>>
private

Execute a function over the elements of a vector in parallel Implementation of the Map method.

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
Returns
A vector with the results of the function calls.

Definition at line 174 of file TSequentialExecutor.hxx.

◆ MapImpl() [4/4]

template<class F , class Cond >
auto ROOT::TSequentialExecutor::MapImpl ( F func,
unsigned nTimes ) -> std::vector<InvokeResult_t<F>>
private

Execute a function without arguments several times.

Implementation of the Map method.

Parameters
funcFunction to be executed.
nTimesNumber of times function should be called.
Returns
A vector with the results of the function calls. Functions that take arguments can be executed (with fixed arguments) by wrapping them in a lambda or with std::bind.

Definition at line 143 of file TSequentialExecutor.hxx.

◆ MapReduce() [1/7]

T * ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
const std::vector< T * > & args )
inherited

Execute a function over the TObject-inheriting elements of an immutable vector (Map) and merge the objects into a single one (Reduce).

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsImmutable vector of elements passed as an argument to func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 149 of file TExecutorCRTP.hxx.

◆ MapReduce() [2/7]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
const std::vector< T > & args,
R redfunc )-> InvokeResult_t<F, T>
inherited

Execute a function over the elements of an immutable vector (Map) and accumulate the results into a single value (Reduce).

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsImmutable vector of elements passed as an argument to func.
redfuncReduction function to combine the results of the calls to func. Must return the same type as func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 143 of file TExecutorCRTP.hxx.

◆ MapReduce() [3/7]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
ROOT::TSeq< INTEGER > args,
R redfunc )-> InvokeResult_t<F, INTEGER>
inherited

Execute a function over a sequence of indexes (Map) and accumulate the results into a single value (Reduce).

Parameters
funcFunction to be executed. Must take an element of the sequence passed assecond argument as a parameter.
argsSequence of indexes to execute func on.
redfuncReduction function to combine the results of the calls to func. Must return the same type as func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 139 of file TExecutorCRTP.hxx.

◆ MapReduce() [4/7]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
std::initializer_list< T > args,
R redfunc )-> InvokeResult_t<F, T>
inherited

Execute a function over the elements of an initializer_list (Map) and accumulate the results into a single value (Reduce).

Parameters
funcFunction to be executed on the elements of the initializer_list passed as second parameter.
argsinitializer_list for a vector to apply func on.
redfuncReduction function to combine the results of the calls to func. Must return the same type as func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 141 of file TExecutorCRTP.hxx.

◆ MapReduce() [5/7]

T * ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
std::vector< T * > & args )
inherited

Execute a function over the TObject-inheriting elements of a vector (Map) and merge the objects into a single one (Reduce).

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 147 of file TExecutorCRTP.hxx.

◆ MapReduce() [6/7]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
std::vector< T > & args,
R redfunc )-> InvokeResult_t<F, T>
inherited

Execute a function over the elements of a vector (Map) and accumulate the results into a single value (Reduce).

Parameters
funcFunction to be executed on the elements of the vector passed as second parameter.
argsVector of elements passed as an argument to func.
redfuncReduction function to combine the results of the calls to func. Must return the same type as func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 145 of file TExecutorCRTP.hxx.

◆ MapReduce() [7/7]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::MapReduce ( F func,
unsigned nTimes,
R redfunc )-> InvokeResult_t<F>
inherited

Execute a function without arguments several times (Map) and accumulate the results into a single value (Reduce).

Parameters
funcFunction to be executed.
nTimesNumber of times function should be called.
Returns
A vector with the results of the function calls.
Parameters
redfuncReduction function to combine the results of the calls to func. Must return the same type as func.
Returns
A value result of "reducing" the vector returned by the Map operation into a single object.

Definition at line 137 of file TExecutorCRTP.hxx.

◆ operator=()

TSequentialExecutor & ROOT::TSequentialExecutor::operator= ( const TSequentialExecutor & )
delete

◆ Reduce() [1/2]

T * ROOT::TExecutorCRTP< TSequentialExecutor >::Reduce ( const std::vector< T * > & mergeObjs)
inherited

"Reduce" an std::vector into a single object by using the object's Merge method.

Parameters
mergeObjsA vector of ROOT objects implementing the Merge method
Returns
An object result of merging the vector elements into one.

Definition at line 151 of file TExecutorCRTP.hxx.

◆ Reduce() [2/2]

auto ROOT::TExecutorCRTP< TSequentialExecutor >::Reduce ( const std::vector< T > & objs,
R redfunc )-> decltype(redfunc(objs))
inherited

"Reduce" an std::vector into a single object by passing a function as the second argument defining the reduction operation.

Parameters
objsA vector of elements to combine.
redfuncReduction function to combine the elements of the vector objs
Returns
A value result of combining the vector elements into a single object of the same type.

Definition at line 152 of file TExecutorCRTP.hxx.

Member Data Documentation

◆ TExecutorCRTP

friend ROOT::TSequentialExecutor::TExecutorCRTP
private

Definition at line 26 of file TSequentialExecutor.hxx.


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