Bolt  1.3
C++ template library with support for OpenCL
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
bolt::cl::permutation_iterator< ElementIterator, IndexIterator > Class Template Reference

#include <permutation_iterator.h>

Inheritance diagram for bolt::cl::permutation_iterator< ElementIterator, IndexIterator >:
bolt::cl::iterator_adaptor< permutation_iterator< ElementIterator, IndexIterator >, IndexIterator, bolt::cl::iterator_traits< ElementIterator >::value_type, use_default, bolt::cl::iterator_traits< ElementIterator >::reference, std::ptrdiff_t > bolt::cl::iterator_facade< Derived, Value, CategoryOrTraversal, Reference, Difference >

Classes

struct  Payload
 

Public Types

typedef std::ptrdiff_t difference_type
 
typedef
bolt::cl::iterator_traits
< ElementIterator >
::value_type 
value_type
 
typedef
bolt::cl::iterator_traits
< ElementIterator >
::value_type * 
pointer
 
typedef
bolt::cl::iterator_traits
< IndexIterator >::value_type 
index_type
 
typedef permutation_iterator_tag iterator_category
 
- Public Types inherited from bolt::cl::iterator_adaptor< permutation_iterator< ElementIterator, IndexIterator >, IndexIterator, bolt::cl::iterator_traits< ElementIterator >::value_type, use_default, bolt::cl::iterator_traits< ElementIterator >::reference, std::ptrdiff_t >
typedef IndexIterator base_type
 
- Public Types inherited from bolt::cl::iterator_facade< Derived, Value, CategoryOrTraversal, Reference, Difference >
typedef std::remove_const
< Value >::type 
value_type
 
typedef Reference reference
 
typedef Difference difference_type
 
typedef std::add_pointer
< value_type >::type 
pointer
 
typedef
bolt::cl::detail::facade_iterator_category
< CategoryOrTraversal, Value,
Reference >::type 
iterator_category
 

Public Member Functions

 permutation_iterator (ElementIterator x, IndexIterator y)
 
template<class OtherElementIterator , class OtherIndexIterator >
 permutation_iterator (permutation_iterator< OtherElementIterator, OtherIndexIterator > const &r, typename enable_if_convertible< OtherElementIterator, ElementIterator >::type *=0, typename enable_if_convertible< OtherIndexIterator, IndexIterator >::type *=0)
 
index_type * getIndex_pointer ()
 
value_type * getElement_pointer ()
 
const Payload gpuPayload () const
 
const difference_type gpuPayloadSize () const
 
int setKernelBuffers (int arg_num,::cl::Kernel &kernel) const
 
- Public Member Functions inherited from bolt::cl::iterator_adaptor< permutation_iterator< ElementIterator, IndexIterator >, IndexIterator, bolt::cl::iterator_traits< ElementIterator >::value_type, use_default, bolt::cl::iterator_traits< ElementIterator >::reference, std::ptrdiff_t >
 iterator_adaptor (IndexIteratorconst &iter)
 
IndexIteratorconst & base () const
 
- Public Member Functions inherited from bolt::cl::iterator_facade< Derived, Value, CategoryOrTraversal, Reference, Difference >
reference operator* () const
 
pointer operator-> () const
 
reference operator[] (difference_type n) const
 
Derived & operator++ ()
 
Derived operator++ (int)
 
Derived & operator-- ()
 
Derived operator-- (int)
 
Derived & operator+= (difference_type n)
 
Derived & operator-= (difference_type n)
 
Derived operator- (difference_type x) const
 

Public Attributes

ElementIterator m_elt_iter
 

Friends

class iterator_core_access
 

Additional Inherited Members

- Protected Types inherited from bolt::cl::iterator_adaptor< permutation_iterator< ElementIterator, IndexIterator >, IndexIterator, bolt::cl::iterator_traits< ElementIterator >::value_type, use_default, bolt::cl::iterator_traits< ElementIterator >::reference, std::ptrdiff_t >
typedef
bolt::cl::detail::iterator_adaptor_base
< permutation_iterator
< ElementIterator,
IndexIterator >, IndexIterator,
bolt::cl::iterator_traits
< ElementIterator >
::value_type, use_default,
bolt::cl::iterator_traits
< ElementIterator >::reference,
std::ptrdiff_t >::type 
super_t
 
typedef iterator_adaptor
< permutation_iterator
< ElementIterator,
IndexIterator >, IndexIterator,
bolt::cl::iterator_traits
< ElementIterator >
::value_type, use_default,
bolt::cl::iterator_traits
< ElementIterator >::reference,
std::ptrdiff_t > 
iterator_adaptor_
 
- Protected Member Functions inherited from bolt::cl::iterator_adaptor< permutation_iterator< ElementIterator, IndexIterator >, IndexIterator, bolt::cl::iterator_traits< ElementIterator >::value_type, use_default, bolt::cl::iterator_traits< ElementIterator >::reference, std::ptrdiff_t >
IndexIteratorconst & base_reference () const
 
IndexIterator & base_reference ()
 

Detailed Description

template<class ElementIterator, class IndexIterator>
class bolt::cl::permutation_iterator< ElementIterator, IndexIterator >

permutation_iterator permutes values in a range according to keys.

The following example demonstrates how to use a permutation_iterator.

#include <bolt/cl/iterator/permutation_iterator.h>
//For OpenCL, Permutation Iterator Macro should be created using the macro BOLT_TEMPLATE_REGISTER_NEW_PERMUTATION_ITERATOR
//The example here uses two device_vector iterators.
int main() {
// Create device_vectors
// Fill values
values[ 0 ] = 10 ; values[ 1 ] = 15 ; values[ 2 ] = 20 ;
values[ 3 ] = 25 ; values[ 4 ] = 30 ;
// Fill permutation indices
index[ 0 ] = 3 ; index[ 1 ] = 2 ; index[ 2 ] = 4 ;
index[ 3 ] = 0 ; index[ 4 ] = 1 ;
...
bolt::cl::make_permutation_iterator( values.begin( ), index.begin( ) ),
bolt::cl::make_permutation_iterator( values.end( ), index.end( ) ),
vecEmpty.begin( ),
vecDest.begin( ),
bolt::cl::plus< int >( ) );
// Output:
// vecDest = { 25, 20, 30, 10, 15 }
}

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