CnC
 All Classes Namespaces Functions Variables Typedefs Enumerator Friends
Public Member Functions
context< Derived > Class Template Reference

CnC context bringing together collections (for steps, items and tags). More...

List of all members.

Public Member Functions

 context ()
 default constructor
virtual ~context ()
 destructor
error_type wait ()
 wait until all the steps prescribed by this context have completed execution.
void flush_gets ()
 used with the preschedule tuner to finalize 'gets' in the pre-execution of a step
void unsafe_reset ()
virtual void serialize (serializer &)
 (distCnC) overload this if default construction on remote processes is not enough.

Detailed Description

template<class Derived>
class CnC::context< Derived >

CnC context bringing together collections (for steps, items and tags).

The user needs to derive his or her own context from the CnC::context. The template argument to context is the user's context class itself.

For example,

          struct my_context : public CnC::context< my_context >
          {
             CnC::step_collection< FindPrimes > steps;
             CnC::tag_collection< int > oddNums;
             CnC::item_collection< int,int > primes;
             my_context() 
                 : CnC::context< my_context >(),
                   steps( this ),
                   oddNums( this ),
                   primes( this )
             {
                 oddNums.prescribes( steps );
             }
          };

Several contexts can be created and executed simultaneously.

Execution starts as soon as a step(-instance) is prescribed through putting a tag. All ready steps will be executed even if CnC::context::wait() is never be called.

It is recommended to declare collections as members of a context derived from CnC::context. This yields more maintanable code and future versions of CnC may require this convention.

Definition at line 548 of file cnc.h.


Member Function Documentation

void flush_gets ( )

used with the preschedule tuner to finalize 'gets' in the pre-execution of a step

Call this after last call to the non-blocking item_collection::unsafe_get method.

void unsafe_reset ( )

reset all collections of this context

Note:
not thread-safe, to be called in safe state only (between program start or calling context::wait() and putting the first tag or item).
error_type wait ( )

wait until all the steps prescribed by this context have completed execution.

Returns:
0 if succeeded, error code otherwise

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerator Friends