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::constant_iterator< value_type > Class Template Reference

#include <constant_iterator.h>

Inheritance diagram for bolt::cl::constant_iterator< value_type >:

Classes

struct  Payload
 

Public Types

typedef boost::iterator_facade
< constant_iterator
< value_type >, value_type,
constant_iterator_tag,
value_type, int >
::difference_type 
difference_type
 
typedef constant_iterator_tag iterator_category
 
typedef
std::random_access_iterator_tag 
memory_system
 
typedef value_type * pointer
 

Public Member Functions

 constant_iterator (value_type init, const control &ctl=control::getDefault())
 
template<typename OtherType >
 constant_iterator (const constant_iterator< OtherType > &rhs)
 
constant_iterator< value_type > & operator= (const constant_iterator< value_type > &rhs)
 
value_type * getPointer ()
 
const value_type * getPointer () const
 
constant_iterator< value_type > & operator+= (const difference_type &n)
 
const constant_iterator
< value_type > 
operator+ (const difference_type &n) const
 
const ::cl::Buffer & getBuffer () const
 
const constant_iterator
< value_type > & 
getContainer () const
 
const constant_iterator
< value_type > & 
base () const
 
Payload gpuPayload () const
 
const difference_type gpuPayloadSize () const
 
int setKernelBuffers (int arg_num,::cl::Kernel &kernel) const
 
difference_type distance_to (const constant_iterator< value_type > &rhs) const
 

Public Attributes

difference_type m_Index
 

Friends

class boost::iterator_core_access
 
template<typename >
class constant_iterator
 

Detailed Description

template<typename value_type>
class bolt::cl::constant_iterator< value_type >

constant_iterator iterates a range with a constant value.

The following demonstrates how to use a constant_iterator.

#include <bolt/cl/constant_iterator.h>
...
std::vector<int> vecSrc( 5 );
std::vector<int> vecDest( 5 );
std::fill( vecSrc.begin( ), vecSrc.end( ), 10 );
...
bolt::cl::constant_iterator< int > const5( 5 );
bolt::cl::transform( ctrl, vecSrc.begin( ), vecSrc.end( ), const5, vecDest.begin( ), bolt::cl::plus< int >( ) );
// vecDest is vector filled with the value 15, the sum of vecSrc and the constant value 5 from the iterator
// constant_iterator can save bandwidth when used instead of a range of values.

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