NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Methods | List of all members
nvbio::cached_iterator< InputStream > Struct Template Reference

Detailed description

template< typename InputStream>
struct nvbio::cached_iterator< InputStream >

A simple class to cache accesses to a stream into a register. For example, this iterator can be useful to wrap the underlying (uint32 or uint4) storage of PackedStream's, so as to avoid repeated accesses to long latency memories.

Example

void write_stream(uint32* gmem_storage)
{
typedef nvbio::cached_iterator<const uint32*> cached_storage_type;
packed_stream[0] = 1;
packed_stream[5] = 0;
packed_stream[10] = 1;
packed_stream[15] = 0; // all the writes above, which happen to hit the same word
// gmem_storage[0], will be cached.
packed_stream[20] = 1; // this write will trigger a new memory access to gmem_storage[1].
return packed_stream[25]; // this read will be cached.
}

Definition at line 69 of file cached_iterator.h.

#include <cached_iterator.h>

Public Types

typedef std::iterator_traits
< InputStream >::value_type 
value_type
 
typedef std::iterator_traits
< InputStream >::reference 
reference
 
typedef std::iterator_traits
< InputStream >::pointer 
pointer
 
typedef std::iterator_traits
< InputStream >
::difference_type 
difference_type
 
typedef
std::random_access_iterator_tag 
iterator_category
 

Public Methods

NVBIO_FORCEINLINE NVBIO_HOST_DEVICE cached_iterator ()
 
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE cached_iterator (InputStream stream)
 
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE ~cached_iterator ()
 
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE value_type
operator[] (const uint32 i)
 

Member Typedef Documentation

template<typename InputStream >
typedef std::iterator_traits<InputStream>::difference_type nvbio::cached_iterator< InputStream >::difference_type

Definition at line 74 of file cached_iterator.h.

template<typename InputStream >
typedef std::random_access_iterator_tag nvbio::cached_iterator< InputStream >::iterator_category

Definition at line 76 of file cached_iterator.h.

template<typename InputStream >
typedef std::iterator_traits<InputStream>::pointer nvbio::cached_iterator< InputStream >::pointer

Definition at line 73 of file cached_iterator.h.

template<typename InputStream >
typedef std::iterator_traits<InputStream>::reference nvbio::cached_iterator< InputStream >::reference

Definition at line 72 of file cached_iterator.h.

template<typename InputStream >
typedef std::iterator_traits<InputStream>::value_type nvbio::cached_iterator< InputStream >::value_type

Definition at line 71 of file cached_iterator.h.

Constructor & Destructor Documentation

template<typename InputStream >
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE nvbio::cached_iterator< InputStream >::cached_iterator ( )
inline

constructor

Definition at line 80 of file cached_iterator.h.

template<typename InputStream >
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE nvbio::cached_iterator< InputStream >::cached_iterator ( InputStream  stream)
inline

constructor

Definition at line 85 of file cached_iterator.h.

template<typename InputStream >
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE nvbio::cached_iterator< InputStream >::~cached_iterator ( )
inline

destructor

Definition at line 90 of file cached_iterator.h.

Member Function Documentation

template<typename InputStream >
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE value_type& nvbio::cached_iterator< InputStream >::operator[] ( const uint32  i)
inline

indexing operator

Parameters
irequested value

Definition at line 99 of file cached_iterator.h.


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