The concepts of the Intel(R) Concurrent Collections (CnC) are described in the CnC documentation.
The API presented here provides a natural way to program in C++ using the CnC design methodology. The API provides classes representing item collections (CnC::item_collection) and tag collections (CnC::tag_collection) and the context (CnC::context) which brings together the collections and steps.
A tag collection is a set of tags of the same type. The type can be any C++ type, specified as a template argument to CnC:tag_collection. By default, a tag collection is not stored, but used only to prescribe steps.
An item collection is a mapping from tags to items. The type of the tags and the type of the items can be any C++ type, specified as template arguments to CnC:item_collection.
Tags and items are stored and retrieved through the 'put' and 'get' methods within CnC::tag_collection and CnC::item_collection.
Step collections are represented by user-provided classes having an 'execute' method. They are prescribed by tag collections through CnC::context.
Additionally, a debug interface is provided (CnC::debug) as well as a tuning interface (CnC::default_tuner).
For example, the primes example presented in the CnC samples could be written as follows.
struct my_context; struct FindPrimes // class representing the FindPrimes step { int execute( int n, my_context & c ) const; }; struct my_context : public CnC::context< my_context > { CnC::tag_collection<int> oddNums; CnC::item_collection<int,int> primes; my_context() : CnC::context< my_context >(), oddNums( this ), primes( this ) { prescribe( oddNums, FindPrimes() ); } }; int FindPrimes::execute( int n, my_context & c ) const { int factor = 3; while ( n % factor ) factor += 2; if (factor == n) c.m_primes.put(n, n); return CnC::CNC_Success; } int main(int argc, char* argv[]) { /* body not included */ }
1.5.6