tag_collection Class Template Reference

A tag collection is a set of tags of the same type. It is used to prescribe steps. By default, it is not stored. More...

List of all members.

Public Types

typedef Tag tag_type
 the tag type

Public Member Functions

template<class Derived>
 tag_collection (context< Derived > *ctxt, bool preserveTags=false)
 constructor which registers collection with given context
void put (const Tag &t)
 prescribe the associated step. If we are preserving tags for this collection, make a copy of the tag and store it in the collection.
void put_range (const Range &r)
 prescribe an entire range of tags
template<typename Step, typename Tuner, typename Arg>
error_type prescribe (const Step &s, const Tuner &t, Arg &arg)
 Declare the prescription relationship between a tag collection and a step collection.
const_iterator begin () const
 returns begin() as in STL containers
const_iterator end () const
 returns end() as in STL containers
void reset ()
 removes all of the tag instances from the collection
size_t size ()
 returns number of elements in collection
bool empty ()
 returns true if size()==0, false otherwise


Detailed Description

template<typename Tag, typename Range = Internal::no_range, typename hash_compare = cnc_tag_hash_compare< Tag >>
class CnC::tag_collection< Tag, Range, hash_compare >

A tag collection is a set of tags of the same type. It is used to prescribe steps. By default, it is not stored.

Tag must provide copy and default constructors and the assigment operator.

If Tag is not convertable into size_t, a suitable hash_compare class must be provided which satisifies the requirements for tbb::concurrent_hash_map. The default cnc_tag_hash_compare works for types that can be converted to size_t and have an operator==. You can provide a specialized template for cnc_tag_hash_compare or specify and implement your own compatible class.

Definition at line 62 of file cnc.h.


Constructor & Destructor Documentation

tag_collection ( context< Derived > *  ctxt,
bool  preserveTags = false 
) [inline]

constructor which registers collection with given context

Parameters:
ctxt the context this collection belongs to
preserveTags when requested, the tag collection can preserve tags, by default tags are not stored


Member Function Documentation

void put ( const Tag &  t  ) 

prescribe the associated step. If we are preserving tags for this collection, make a copy of the tag and store it in the collection.

Parameters:
t the tag to be put

void put_range ( const Range &  r  ) 

prescribe an entire range of tags

Parameters:
r A range, which is potentially splittible through a partitioner. Following the TBB range/splittable concept, extended by STL container requirements, a range R must provide the following interface:
  • R::R( const R& ) : Copy constructor.
  • bool R::empty() const : true if range is empty.
  • bool R::is_divisible() const : true if range can be partitioned into two subranges.
  • R::R( R& r, tbb::split ) : Split r into two subranges.
  • const_iterator : forward iterator (operator++, operator tag_type() const) to make it work with tbb::blocked_range, the cast operator is used instead of operator*().
  • const_iterator begin() : first member of range
  • const_iterator end() : Exclusive upper bound on range
part optionally a partitioner can be specified,
See also:
default_partitioner for the expected interface

error_type prescribe ( const Step &  s,
const Tuner &  t,
Arg &  arg 
) [inline]

Declare the prescription relationship between a tag collection and a step collection.

Parameters:
s class representing step collection. s is required to provide the following const method, where Arg a is the optional parameter described below.
   int execute( const Tag & tag, Arg & a ) const;
A copy of s will be created by calling its copy constructor.
tuner You can use default_tuner or define your own tuner to specify the scheduling priority for the excution of a step, and also the data dependencies for the step.
arg This argument will be the parameter passed to Step::execute and the tuner methods. The object must exist as long as instances of the given step might be executed. Usually arg will be the containing context.
Returns:
0 if succeeded, error code otherwise

const_iterator begin (  )  const

returns begin() as in STL containers

Note:
iteration through collections is not thread safe, use it only between calls to CnC::context::wait() and putting tags

const_iterator end (  )  const

returns end() as in STL containers

Note:
iteration through collections is not thread safe, use it only between calls to CnC::context::wait() and putting tags


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

Generated on Tue Aug 31 15:30:28 2010 for CnC by  doxygen 1.5.6