ParallelFor::ForAlignedContext< FORCONTEXT, INDEXTYPE, INIT, FINALIZE > Struct Template Reference
Inheritance diagram for ParallelFor::ForAlignedContext< FORCONTEXT, INDEXTYPE, INIT, FINALIZE >:

Detailed Description

template<typename FORCONTEXT, typename INDEXTYPE, typename INIT, typename FINALIZE>
struct maxon::ParallelFor::ForAlignedContext< FORCONTEXT, INDEXTYPE, INIT, FINALIZE >

Context for complex loops including init and finalize section.

Template Parameters
FORCONTEXTEither DynamicContext<CONTEXT> or StaticContext<CONTEXT>.
INDEXTYPEAn integral type used for the index of the loop.
INITA class containing an operator ()(CONTEXT&) for per-thread initialization before the loop.
FINALIZEA class containing an operator ()(CONTEXT&) for per-thread cleanup after the loop.

Public Member Functions

 ForAlignedContext (INDEXTYPE from, INDEXTYPE to, Int threadIndex, ParallelFor::BreakCondition *breakCondition, const INIT &init, const FINALIZE &finalize)
 
void Init ()
 
Bool Finalize ()
 

Private Attributes

const INIT & _init
 
const FINALIZE & _finalize
 
Bool _isInitialized
 

Constructor & Destructor Documentation

◆ ForAlignedContext()

ForAlignedContext ( INDEXTYPE  from,
INDEXTYPE  to,
Int  threadIndex,
ParallelFor::BreakCondition breakCondition,
const INIT &  init,
const FINALIZE &  finalize 
)
Parameters
[in]fromStart index.
[in]toEnd index (excluded)
[in]threadIndexInitial thread index.
[in]breakConditionPointer to a BreakCondition or nullptr (break not supported by context).
[in]initLambda being called in the thread context before the loop starts.
[in]finalizeLambda being called in the thread context after the loop has finished.

Member Function Documentation

◆ Init()

void Init ( )

Calls INIT method for user data initialization of the context.

◆ Finalize()

Bool Finalize ( )

Calls FINALIZE method to finalize user data of the context. Returns false if Init() hasn't or Finalize() has already been called.

Member Data Documentation

◆ _init

const INIT& _init
private

◆ _finalize

const FINALIZE& _finalize
private

◆ _isInitialized

Bool _isInitialized
private