PFUNC  1.0
Public Types | Public Member Functions | Private Attributes | Friends
pfunc::detail::task< Attribute, Functor > Struct Template Reference

An implementation of a task structure. More...

#include <pfunc/task.hpp>

Inheritance diagram for pfunc::detail::task< Attribute, Functor >:
pfunc::detail::no_copy

List of all members.

Public Types

typedef Attribute attribute
typedef Functor functor

Public Member Functions

const attributeget_attr () const
groupget_group () const
unsigned int get_size () const
unsigned int get_rank () const
void set_attr (const attribute &at)
void set_group (group *gp)
void set_func (functor *fn)
void reset_completion (const unsigned int &nwait=1)
void run ()
template<typename TaskManager >
void wait (TaskManager &taskmgr)
template<typename TaskManager >
bool test (TaskManager &taskmgr)
void notify ()
template<typename TaskManager >
void barrier (TaskManager &taskmgr)
 task ()
 task (const attribute &attr, group *grp, functor *func)
 ~task ()
void shallow_copy (const task &other)

Private Attributes

attribute attr
groupgrp
unsigned int gsize
unsigned int grank
functorfunc
event< testable_eventtesting_compl
event< waitable_eventwaiting_compl

Friends

bool operator< (const task &one, const task &two)

Detailed Description

template<typename Attribute, typename Functor>
struct pfunc::detail::task< Attribute, Functor >

An implementation of a task structure.

Parameters:
AttributeThe type of the Attribute.
FunctorThe type of the function object to be used.

Implements the task structure. Main intention is to enable communication of not only the task that a thread has to perform but also to provide the executing thread with attributes that are related to a particular task.


Member Typedef Documentation

template<typename Attribute , typename Functor >
typedef Attribute pfunc::detail::task< Attribute, Functor >::attribute
template<typename Attribute , typename Functor >
typedef Functor pfunc::detail::task< Attribute, Functor >::functor

Constructor & Destructor Documentation

template<typename Attribute , typename Functor >
pfunc::detail::task< Attribute, Functor >::task ( ) [inline]

Default constructor.

template<typename Attribute , typename Functor >
pfunc::detail::task< Attribute, Functor >::task ( const attribute attr,
group grp,
functor func 
) [inline]

Parameterized constructor.

Parameters:
[in]attrThe attribute for this task.
[in]grpThe group for this task.
[in]funcThe work function for this task.
template<typename Attribute , typename Functor >
pfunc::detail::task< Attribute, Functor >::~task ( ) [inline]

Destructor.


Member Function Documentation

template<typename Attribute , typename Functor >
template<typename TaskManager >
void pfunc::detail::task< Attribute, Functor >::barrier ( TaskManager &  taskmgr) [inline]

Execute a barrier across all the tasks in this task's group.

Parameters:
[in]taskmgrThe task manager that is controlling the execution.
template<typename Attribute , typename Functor >
const attribute& pfunc::detail::task< Attribute, Functor >::get_attr ( ) const [inline]
Returns:
Attribute that governs the execution of the function.
template<typename Attribute , typename Functor >
group* pfunc::detail::task< Attribute, Functor >::get_group ( ) const [inline]
Returns:
Group that the task is associated with.
template<typename Attribute , typename Functor >
unsigned int pfunc::detail::task< Attribute, Functor >::get_rank ( ) const [inline]
Returns:
Rank of the querying task in this grp
template<typename Attribute , typename Functor >
unsigned int pfunc::detail::task< Attribute, Functor >::get_size ( ) const [inline]
Returns:
Size of the group associated with the task.
template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::notify ( ) [inline]

Notify a job's completion. If there are more than one waiters on this particular task, then broadcast. Else, a simple signal will do.

template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::reset_completion ( const unsigned int &  nwait = 1) [inline]
Parameters:
[in]nwaitNumber of waiters to receive notification
template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::run ( ) [inline]

Run the work function

template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::set_attr ( const attribute at) [inline]
Parameters:
[in]atAttribute that governs execution of the task
template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::set_func ( functor fn) [inline]
Parameters:
[in]fnWork function to be executed by the executing thread.
template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::set_group ( group gp) [inline]
Parameters:
[in]gpThe group that is associated with the task.
template<typename Attribute , typename Functor >
void pfunc::detail::task< Attribute, Functor >::shallow_copy ( const task< Attribute, Functor > &  other) [inline]
template<typename Attribute , typename Functor >
template<typename TaskManager >
bool pfunc::detail::task< Attribute, Functor >::test ( TaskManager &  taskmgr) [inline]

Test for the current job to complete.

Parameters:
[in]taskmgrThe task manager that is controlling the execution.
template<typename Attribute , typename Functor >
template<typename TaskManager >
void pfunc::detail::task< Attribute, Functor >::wait ( TaskManager &  taskmgr) [inline]

Wait for the current job to complete.

Parameters:
[in]taskmgrThe task manager that is controlling the execution.

Friends And Related Function Documentation

template<typename Attribute , typename Functor >
bool operator< ( const task< Attribute, Functor > &  one,
const task< Attribute, Functor > &  two 
) [friend]

operator< to compare two tasks.

Parameters:
[in]oneThe first task.
[in]twoThe second task.
Returns:
true If the first task has a lower priority than the second.

Member Data Documentation

template<typename Attribute , typename Functor >
attribute pfunc::detail::task< Attribute, Functor >::attr [private]

Attribute that describes the task

template<typename Attribute , typename Functor >
functor* pfunc::detail::task< Attribute, Functor >::func [private]

Function object that represents the task

template<typename Attribute , typename Functor >
unsigned int pfunc::detail::task< Attribute, Functor >::grank [private]

Rank of the task in the group

template<typename Attribute , typename Functor >
group* pfunc::detail::task< Attribute, Functor >::grp [private]

The group for the task

template<typename Attribute , typename Functor >
unsigned int pfunc::detail::task< Attribute, Functor >::gsize [private]

Size of the group

template<typename Attribute , typename Functor >
event<testable_event> pfunc::detail::task< Attribute, Functor >::testing_compl [private]

testable event

template<typename Attribute , typename Functor >
event<waitable_event> pfunc::detail::task< Attribute, Functor >::waiting_compl [private]

waitable event


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