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
3413  :
3414  _Workers(static_cast<task_handle<_Worker_class> *>(::Concurrency::Alloc(sizeof(task_handle<_Worker_class>) * _Default_worker_size)))
3415  {
3416  _Worker_size = 0;
3417  while (_Worker_size < _Default_worker_size && _First != _Last)
3418  {
3419  // Copy the range _Head
3420  _Forward_iterator _Head = _First;
3421 
3422  // Read from forward iterator
3423  for (size_t _I = 0; _I < _Default_chunk_size && _First != _Last; ++_I, ++_First)
3424  {
3425  // Body is empty
3426  }
3427 
3428  // _First will be the end of current chunk
3429  new (_Workers.get() + _Worker_size++) task_handle<_Worker_class>(_Worker_class(_Head, _First, _Func));
3430  }
3431  }
_CONCRTIMP void *__cdecl Alloc(size_t _NumBytes)
Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator...
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3410
_Parallel_reduce_fixed_worker< _Forward_iterator, _Function > _Worker_class
Definition: ppl.h:3409
_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
3433  :
3434  _Workers(_Other._Workers), _Worker_size(_Other._Worker_size)
3435  {
3436  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3410
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
3449  {
3450  if (_Workers.get())
3451  {
3452  for (int _I = 0; _I < _Worker_size; _I++)
3453  {
3454  _Workers.get()[_I].~task_handle<_Worker_class>();
3455  }
3456  ::Concurrency::Free(_Workers.release());
3457  }
3458  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3410
_CONCRTIMP 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...
_Parallel_reduce_fixed_worker< _Forward_iterator, _Function > _Worker_class
Definition: ppl.h:3409

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
3439  {
3440  structured_task_group _Tg;
3441  for(int _I = 0; _I < _Worker_size; _I++)
3442  {
3443  _Tg.run(_Workers.get()[_I]);
3444  }
3445  _Tg.wait();
3446  }
std::auto_ptr< task_handle< _Worker_class > > _Workers
Definition: ppl.h:3410

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: