STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Public Attributes | List of all members
Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size > Struct Template Reference

#include <ppl.h>

Public Types

typedef _Parallel_reduce_fixed_worker< _Forward_iterator, _Function > _Worker_class
 

Public Member Functions

 _Parallel_reduce_forward_executor_helper (_Forward_iterator &_First, _Forward_iterator _Last, const _Function &_Func)
 
 _Parallel_reduce_forward_executor_helper (const _Parallel_reduce_forward_executor_helper &_Other)
 
void operator() () const
 
 ~_Parallel_reduce_forward_executor_helper ()
 

Public Attributes

std::auto_ptr< task_handle< _Worker_class > > _Workers
 
int _Worker_size
 

Member Typedef Documentation

template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
typedef _Parallel_reduce_fixed_worker<_Forward_iterator, _Function> Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::_Worker_class

Constructor & Destructor Documentation

template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::_Parallel_reduce_forward_executor_helper ( _Forward_iterator &  _First,
_Forward_iterator  _Last,
const _Function &  _Func 
)
inline
3426  :
3427  _Workers(static_cast<task_handle<_Worker_class> *>(Concurrency::Alloc(sizeof(task_handle<_Worker_class>) * _Default_worker_size)))
3428  {
3429  _Worker_size = 0;
3430  while (_Worker_size < _Default_worker_size && _First != _Last)
3431  {
3432  // Copy the range _Head
3433  _Forward_iterator _Head = _First;
3434 
3435  // Read from forward iterator
3436  for (size_t _I = 0; _I < _Default_chunk_size && _First != _Last; ++_I, ++_First)
3437  {
3438  // Body is empty
3439  }
3440 
3441  // _First will be the end of current chunk
3442  new (_Workers.get() + _Worker_size++) task_handle<_Worker_class>(_Worker_class(_Head, _First, _Func));
3443  }
3444  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3423
_CRTIMP void *__cdecl Alloc(size_t _NumBytes)
Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator...
_Parallel_reduce_fixed_worker< _Forward_iterator, _Function > _Worker_class
Definition: ppl.h:3422
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::_Parallel_reduce_forward_executor_helper ( const _Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size > &  _Other)
inline
3446  :
3447  _Workers(_Other._Workers), _Worker_size(_Other._Worker_size)
3448  {
3449  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3423
template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::~_Parallel_reduce_forward_executor_helper ( )
inline
3462  {
3463  if (_Workers.get())
3464  {
3465  for (int _I = 0; _I < _Worker_size; _I++)
3466  {
3467  _Workers.get()[_I].~task_handle<_Worker_class>();
3468  }
3469  Concurrency::Free(_Workers.release());
3470  }
3471  }
_CRTIMP void __cdecl Free(_Pre_maybenull_ _Post_invalid_ void *_PAllocation)
Releases a block of memory previously allocated by the Alloc method to the Concurrency Runtime Cachin...
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3423
_Parallel_reduce_fixed_worker< _Forward_iterator, _Function > _Worker_class
Definition: ppl.h:3422

Member Function Documentation

template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
void Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::operator() ( ) const
inline
3452  {
3453  structured_task_group _Tg;
3454  for(int _I = 0; _I < _Worker_size; _I++)
3455  {
3456  _Tg.run(_Workers.get()[_I]);
3457  }
3458  _Tg.wait();
3459  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3423

Member Data Documentation

template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
int Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::_Worker_size
template<typename _Forward_iterator , typename _Function , int _Default_worker_size, int _Default_chunk_size>
std::auto_ptr<task_handle<_Worker_class> > Concurrency::_Parallel_reduce_forward_executor_helper< _Forward_iterator, _Function, _Default_worker_size, _Default_chunk_size >::_Workers
mutable

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