libpsynth 0.2.1
Classes | Public Types | Public Member Functions | Friends
psynth::sound::buffer_range< Iterator > Class Template Reference

A lightweight object that interprets memory as a 1D array of frames. More...

#include <buffer_range.hpp>

List of all members.

Classes

struct  add_deref

Public Types

typedef std::iterator_traits
< Iterator >::value_type 
value_type
typedef std::iterator_traits
< Iterator >::reference 
reference
typedef std::iterator_traits
< Iterator >::difference_type 
difference_type
typedef buffer_range< typename
const_iterator_type< Iterator >
::type
const_type
typedef Iterator iterator
typedef std::reverse_iterator
< iterator
reverse_iterator
typedef std::ptrdiff_t size_type

Public Member Functions

 buffer_range ()
 buffer_range (const buffer_range &bv)
template<typename Range >
 buffer_range (Range &&bv)
template<typename Range >
 buffer_range (const Range &bv)
template<typename I2 >
 buffer_range (size_type sz, I2 it)
template<typename Range >
buffer_rangeoperator= (const Range &bv)
buffer_rangeoperator= (const buffer_range &bv)
template<typename Range >
bool operator== (const Range &v) const
template<typename Range >
bool operator!= (const Range &v) const
size_type size () const
const iteratorframes () const
std::size_t frame_size () const
std::size_t num_samples () const
iterator begin () const
iterator end () const
reverse_iterator rbegin () const
reverse_iterator rend () const
reference operator[] (difference_type i) const
iterator at (difference_type i) const

Friends

class buffer_range
template<typename L2 >
void swap (buffer_range< L2 > &x, buffer_range< L2 > &y)

Detailed Description

template<typename Iterator>
class psynth::sound::buffer_range< Iterator >

A lightweight object that interprets memory as a 1D array of frames.

Models BufferRangeConcept, FrameBasedConcept, HasDynamicXStepTypeConcept, HasDynamicYStepTypeConcept, HasTransposedTypeConcept

Buffer range consists of a frame iterator and the buffer size.

Buffer ranges to buffers are what ranges are to STL containers. They are lightweight objects, that don't own the frames. It is the user's responsibility that the underlying data remains valid for the lifetime of the buffer range.

Similar to iterators and ranges, constness of ranges does not extend to constness of frames. A const buffer_range does not allow changing its location in memory (resizing, moving) but does not prevent one from changing the frames. The latter requires an buffer range whose value_type is const.

Buffers have interfaces consistent with STL 1D random access containers, so they can be used directly in STL algorithms like:

   std::fill (buf.begin(), buf.end (), zero_frame);

In addition, horizontal, vertical and 2D random access iterators are provided.

Note also that buffer_range does not require that its element type be a frame. It could be instantiated with a locator whose value_type models only Regular. In this case the buffer range models the weaker RandomAccess2DBufferRangeConcept, and does not model FrameBasedConcept. Many generic algorithms don't require the elements to be frames.


Member Typedef Documentation

template<typename Iterator>
typedef buffer_range<typename const_iterator_type<Iterator>::type> psynth::sound::buffer_range< Iterator >::const_type
template<typename Iterator>
typedef std::iterator_traits<Iterator>::difference_type psynth::sound::buffer_range< Iterator >::difference_type
template<typename Iterator>
typedef Iterator psynth::sound::buffer_range< Iterator >::iterator
template<typename Iterator>
typedef std::iterator_traits<Iterator>::reference psynth::sound::buffer_range< Iterator >::reference
template<typename Iterator>
typedef std::reverse_iterator<iterator> psynth::sound::buffer_range< Iterator >::reverse_iterator
template<typename Iterator>
typedef std::ptrdiff_t psynth::sound::buffer_range< Iterator >::size_type
template<typename Iterator>
typedef std::iterator_traits<Iterator>::value_type psynth::sound::buffer_range< Iterator >::value_type
Todo:
Use iterator_traits ??

Constructor & Destructor Documentation

template<typename Iterator>
psynth::sound::buffer_range< Iterator >::buffer_range ( ) [inline]
template<typename Iterator>
psynth::sound::buffer_range< Iterator >::buffer_range ( const buffer_range< Iterator > &  bv)
template<typename Iterator>
template<typename Range >
psynth::sound::buffer_range< Iterator >::buffer_range ( Range &&  bv) [inline]
template<typename Iterator>
template<typename Range >
psynth::sound::buffer_range< Iterator >::buffer_range ( const Range &  bv) [inline]
template<typename Iterator>
template<typename I2 >
psynth::sound::buffer_range< Iterator >::buffer_range ( size_type  sz,
I2  it 
) [inline]

Member Function Documentation

template<typename Iterator>
iterator psynth::sound::buffer_range< Iterator >::at ( difference_type  i) const [inline]
template<typename Iterator>
iterator psynth::sound::buffer_range< Iterator >::begin ( ) const [inline]
template<typename Iterator>
iterator psynth::sound::buffer_range< Iterator >::end ( ) const [inline]
template<typename Iterator>
std::size_t psynth::sound::buffer_range< Iterator >::frame_size ( ) const [inline]
template<typename Iterator>
const iterator& psynth::sound::buffer_range< Iterator >::frames ( ) const [inline]
template<typename Iterator>
std::size_t psynth::sound::buffer_range< Iterator >::num_samples ( ) const [inline]
template<typename Iterator>
template<typename Range >
bool psynth::sound::buffer_range< Iterator >::operator!= ( const Range &  v) const [inline]
template<typename Iterator>
buffer_range& psynth::sound::buffer_range< Iterator >::operator= ( const buffer_range< Iterator > &  bv) [inline]
template<typename Iterator>
template<typename Range >
buffer_range& psynth::sound::buffer_range< Iterator >::operator= ( const Range &  bv) [inline]
template<typename Iterator>
template<typename Range >
bool psynth::sound::buffer_range< Iterator >::operator== ( const Range &  v) const [inline]
template<typename Iterator>
reference psynth::sound::buffer_range< Iterator >::operator[] ( difference_type  i) const [inline]
template<typename Iterator>
reverse_iterator psynth::sound::buffer_range< Iterator >::rbegin ( ) const [inline]
template<typename Iterator>
reverse_iterator psynth::sound::buffer_range< Iterator >::rend ( ) const [inline]
template<typename Iterator>
size_type psynth::sound::buffer_range< Iterator >::size ( ) const [inline]

Friends And Related Function Documentation

template<typename Iterator>
friend class buffer_range [friend]
template<typename Iterator>
template<typename L2 >
void swap ( buffer_range< L2 > &  x,
buffer_range< L2 > &  y 
) [friend]

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