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

Detailed description

template< typename InputStream>
struct nvbio::const_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

uint8 read_stream(const uint32* gmem_storage)
{
typedef nvbio::const_cached_iterator<const uint32*> cached_storage_type;
return packed_stream[0] |
packed_stream[5] |
packed_stream[10] |
packed_stream[15] | // all the reads above, which happen to hit the same word
// gmem_storage[0], will be cached.
packed_stream[20]; // this read will trigger a new memory access to gmem_storage[1].
}

Definition at line 140 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 const_cached_iterator ()
 
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_cached_iterator (InputStream stream)
 
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE value_type 
operator[] (const uint32 i) const
 
NVBIO_FORCEINLINE
NVBIO_HOST_DEVICE InputStream 
stream () const
 

Public Members

InputStream m_stream
 
uint32 m_cache_idx
 
value_type m_cache_val
 

Member Typedef Documentation

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

Definition at line 145 of file cached_iterator.h.

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

Definition at line 147 of file cached_iterator.h.

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

Definition at line 144 of file cached_iterator.h.

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

Definition at line 143 of file cached_iterator.h.

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

Definition at line 142 of file cached_iterator.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 151 of file cached_iterator.h.

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

constructor

Definition at line 155 of file cached_iterator.h.

Member Function Documentation

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

indexing operator

Parameters
irequested value

Definition at line 161 of file cached_iterator.h.

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

base stream

Definition at line 174 of file cached_iterator.h.

Member Data Documentation

template<typename InputStream>
uint32 nvbio::const_cached_iterator< InputStream >::m_cache_idx
mutable

Definition at line 177 of file cached_iterator.h.

template<typename InputStream>
value_type nvbio::const_cached_iterator< InputStream >::m_cache_val
mutable

Definition at line 178 of file cached_iterator.h.

template<typename InputStream>
InputStream nvbio::const_cached_iterator< InputStream >::m_stream

Definition at line 176 of file cached_iterator.h.


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