A tag collection is a set of tags of the same type. It is used to prescribe steps. By default, tags are not stored. More...
Public Types | |
typedef Tag | tag_type |
the tag type | |
typedef Tuner::tag_table_type::const_iterator | const_iterator |
const forward iterator as in STL | |
typedef Internal::tag_collection_base < Tag, Tuner >::callback_type | callback_type |
Public Member Functions | |
template<class Derived > | |
tag_collection (context< Derived > &ctxt, const std::string &name, const Tuner &tnr) | |
constructor which registers collection with given context | |
template<typename UserStep , typename STuner , typename Arg > | |
error_type | prescribes (const step_collection< UserStep, STuner > &s, Arg &arg) |
Declare the prescription relationship between the tag collection and a step collection. | |
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 typename Tuner::range_type &r) |
prescribe an entire range of tags | |
const_iterator | begin () const |
returns begin() as in STL containers | |
const_iterator | end () const |
returns end() as in STL containers | |
void | unsafe_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 | |
void | on_put (callback_type *cb) |
A tag collection is a set of tags of the same type. It is used to prescribe steps. By default, tags are 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 specialized templates for cnc_hash and/or cnc_equal or cnc_tag_hash_compare or specify and implement your own compatible class.
typedef Internal::tag_collection_base< Tag, Tuner >::callback_type callback_type |
tag_collection | ( | context< Derived > & | ctxt, |
const std::string & | name, | ||
const Tuner & | tnr | ||
) |
constructor which registers collection with given context
ctxt | the context this collection belongs to |
name | an optional name, used for debug output and tracing |
tnr | an optional tuner object which must persist throughout the lifetime of the tag-collection by default a default-constructed tuner will be used. |
const_iterator begin | ( | ) | const |
returns begin() as in STL containers
const_iterator end | ( | ) | const |
returns end() as in STL containers
void on_put | ( | callback_type * | cb | ) |
Call this to register a on-put-callback for the tag-collection. When registered, callback.on_put( tag ) gets called when a tag was put successfully. e.g. it will not get called a second time on a second put if memoization is enabled. The call is blocking, e.g. the triggering/calling "put" will not return to its caller until the callback has terminated. The provided object will be deleted when the collection is deleted.
error_type prescribes | ( | const step_collection< UserStep, STuner > & | s, |
Arg & | arg | ||
) |
Declare the prescription relationship between the tag collection and a step collection.
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.
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. |
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.
t | the tag to be put |
void put_range | ( | const typename Tuner::range_type & | r | ) |
prescribe an entire range of tags
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:
|
void unsafe_reset | ( | ) |
removes all of the tag instances from the collection