Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Private Types | Private Attributes
TreeMaker< use_tbbmalloc >::SubTreeCreationTask Class Reference
Inheritance diagram for TreeMaker< use_tbbmalloc >::SubTreeCreationTask:

List of all members.

Public Member Functions

tbb::taskexecute ()
 SubTreeCreationTask (TreeNode *&root, long number_of_nodes)

Private Types

typedef TreeMaker< use_tbbmalloc > MyTreeMaker

Private Attributes

bool is_continuation
TreeNode *& my_root

Detailed Description

template<class use_tbbmalloc>
class TreeMaker< use_tbbmalloc >::SubTreeCreationTask

Definition at line 60 of file Third Party Tech/TBB/tbb30_20100406oss_win/tbb30_20100406oss/examples/task/tree_sum/main.cpp.


Member Typedef Documentation

template<class use_tbbmalloc>
typedef TreeMaker<use_tbbmalloc> TreeMaker< use_tbbmalloc >::SubTreeCreationTask::MyTreeMaker [private]

Constructor & Destructor Documentation

template<class use_tbbmalloc>
TreeMaker< use_tbbmalloc >::SubTreeCreationTask::SubTreeCreationTask ( TreeNode *&  root,
long  number_of_nodes 
) [inline]

Member Function Documentation

template<class use_tbbmalloc>
tbb::task* TreeMaker< use_tbbmalloc >::SubTreeCreationTask::execute ( ) [inline, virtual]

Implements tbb::task.

Definition at line 72 of file Third Party Tech/TBB/tbb30_20100406oss_win/tbb30_20100406oss/examples/task/tree_sum/main.cpp.

                           {
            tbb::task* next = NULL;
            if( !is_continuation ) {
                long subtree_size = my_root->node_count - 1;
                if( subtree_size<1000 ) { /* grainsize */
                    my_root->left  = MyTreeMaker::do_in_one_thread(subtree_size/2);
                    my_root->right = MyTreeMaker::do_in_one_thread(subtree_size - subtree_size/2);
                } else {
                    // Create tasks before spawning any of them.
                    tbb::task* a = new( allocate_child() ) SubTreeCreationTask(my_root->left,subtree_size/2);
                    tbb::task* b = new( allocate_child() ) SubTreeCreationTask(my_root->right,subtree_size - subtree_size/2);
                    recycle_as_continuation();
                    is_continuation = true;
                    set_ref_count(2);
                    spawn(*b);
                    next = a;
                }
            } 
            return next;
        }

Member Data Documentation

template<class use_tbbmalloc>
bool TreeMaker< use_tbbmalloc >::SubTreeCreationTask::is_continuation [private]
template<class use_tbbmalloc>
TreeNode*& TreeMaker< use_tbbmalloc >::SubTreeCreationTask::my_root [private]

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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net