MADNESS  version 0.9
Public Member Functions | List of all members
madness::detail::ForEachRootTask< rangeT, opT > Class Template Reference

Apply an operation to a range of iterators. More...

#include <worldtask.h>

Inheritance diagram for madness::detail::ForEachRootTask< rangeT, opT >:
Inheritance graph
[legend]
Collaboration diagram for madness::detail::ForEachRootTask< rangeT, opT >:
Collaboration graph
[legend]

Public Member Functions

 ForEachRootTask (World &world, const rangeT range, const opT &op)
 Constructor. More...
 
virtual ~ForEachRootTask ()
 Virtual destructor. More...
 
Worldworld () const
 World accessor. More...
 
const Future< bool > & result () const
 Result accessor. More...
 
void complete (const int status)
 Called by child tasks when they are complete. More...
 
virtual void run (const TaskThreadEnv &)
 Task run work. More...
 
- Public Member Functions inherited from madness::TaskInterface
 TaskInterface (int ndepend=0, const TaskAttributes attr=TaskAttributes())
 Create a new task with ndepend dependencies (default 0) and given attributes. More...
 
 TaskInterface (const TaskAttributes &attr)
 Create a new task with zero dependencies and given attributes. More...
 
virtual void run (World &)
 Runs a single-threaded task ... derived classes must implement this. More...
 
virtual void run (World &world, const TaskThreadEnv &env)
 Runs a multi-threaded task. More...
 
Worldget_world () const
 
virtual ~TaskInterface ()
 
- Public Member Functions inherited from madness::PoolTaskInterface
 PoolTaskInterface ()
 
 PoolTaskInterface (const TaskAttributes &attr)
 
void set_nthread (int nthread)
 Call this to reset the number of threads before the task is submitted. More...
 
virtual ~PoolTaskInterface ()
 
- Public Member Functions inherited from madness::TaskAttributes
 TaskAttributes (unsigned long flags=0)
 
 TaskAttributes (const TaskAttributes &attr)
 
virtual ~TaskAttributes ()
 
bool is_generator () const
 
bool is_stealable () const
 
bool is_high_priority () const
 
void set_generator (bool generator_hint)
 
void set_stealable (bool stealable)
 
void set_highpriority (bool hipri)
 
void set_nthread (int nthread)
 Are you sure this is what you want to call? More...
 
int get_nthread () const
 
template<typename Archive >
void serialize (Archive &ar)
 
- Public Member Functions inherited from madness::DependencyInterface
 DependencyInterface (int ndep=0)
 
int ndep () const
 Returns the number of unsatisfied dependencies. More...
 
bool probe () const
 Returns true if ndepend == 0. More...
 
void notify ()
 Invoked by callbacks to notifiy of dependencies being satisfied. More...
 
void register_callback (CallbackInterface *callback)
 Registers a callback for when ndepend==0 , immediately invoked if ndepend==0. More...
 
void inc ()
 Increment the number of dependencies. More...
 
void dec ()
 Decrement the number of dependencies and invoke callback if ndepend=0. More...
 
virtual ~DependencyInterface ()
 
- Public Member Functions inherited from madness::CallbackInterface
virtual ~CallbackInterface ()
 

Additional Inherited Members

- Static Public Member Functions inherited from madness::PoolTaskInterface
static void operator delete (void *p, std::size_t size) throw ()
 Destroy task object. More...
 
- Static Public Member Functions inherited from madness::TaskAttributes
static TaskAttributes generator ()
 
static TaskAttributes hipri ()
 
static TaskAttributes multi_threaded (int nthread)
 
- Static Public Attributes inherited from madness::TaskInterface
static bool debug = false
 
- Static Public Attributes inherited from madness::TaskAttributes
static const unsigned long NTHREAD = 0xff
 
static const unsigned long GENERATOR = 1ul<<8
 
static const unsigned long STEALABLE = GENERATOR<<1
 
static const unsigned long HIGHPRIORITY = GENERATOR<<2
 
- Static Protected Member Functions inherited from madness::PoolTaskInterface
template<typename fnT >
static enable_if_c
< detail::function_traits< fnT >
::value||detail::memfunc_traits
< fnT >::value >::type 
make_id (std::pair< void *, unsigned short > &id, fnT fn)
 
template<typename fnobjT >
static disable_if_c
< detail::function_traits
< fnobjT >::value||detail::memfunc_traits
< fnobjT >::value >::type 
make_id (std::pair< void *, unsigned short > &id, const fnobjT &)
 

Detailed Description

template<typename rangeT, typename opT>
class madness::detail::ForEachRootTask< rangeT, opT >

Apply an operation to a range of iterators.

Template Parameters
rangeTThe range of iterators type
opTThe operation type This task spawns for each tasks and collects information on the results of those tasks. Once all tasks have completed it will set the result future.

Constructor & Destructor Documentation

template<typename rangeT, typename opT>
madness::detail::ForEachRootTask< rangeT, opT >::ForEachRootTask ( World world,
const rangeT  range,
const opT &  op 
)
inline

Constructor.

Parameters
worldThe world where the tasks will run
rangeThe range of iterators
opThe oeration that will be applied to the range of iterators
template<typename rangeT, typename opT>
virtual madness::detail::ForEachRootTask< rangeT, opT >::~ForEachRootTask ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

template<typename rangeT, typename opT>
void madness::detail::ForEachRootTask< rangeT, opT >::complete ( const int  status)
inline

Called by child tasks when they are complete.

Parameters
statusThe number of iterations that returned true

References madness::DependencyInterface::notify().

Referenced by madness::detail::ForEachTask< rangeT, opT >::run().

template<typename rangeT, typename opT>
const Future<bool>& madness::detail::ForEachRootTask< rangeT, opT >::result ( ) const
inline

Result accessor.

Returns
A const reference to the result future

Referenced by madness::WorldTaskQueue::for_each().

template<typename rangeT, typename opT>
virtual void madness::detail::ForEachRootTask< rangeT, opT >::run ( const TaskThreadEnv )
inlinevirtual

Task run work.

Sets the result future based on the status of all iterations

Reimplemented from madness::TaskInterface.

template<typename rangeT, typename opT>
World& madness::detail::ForEachRootTask< rangeT, opT >::world ( ) const
inline

World accessor.

Returns
A reference to the world

Referenced by madness::detail::ForEachTask< rangeT, opT >::run().


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