Nsound  0.9.4
Public Member Functions | Private Attributes | List of all members
Nsound::const_circular_iterator Class Reference

#include <Nsound/CircularIterators.h>

Public Member Functions

 const_circular_iterator (const FloatVector &v)
 
 const_circular_iterator (const const_circular_iterator &copy)
 
const_circular_iteratoroperator= (const const_circular_iterator &rhs)
 
void reset ()
 
bool operator== (const const_circular_iterator &rhs) const
 
bool operator!= (const const_circular_iterator &rhs) const
 
const_circular_iteratoroperator++ ()
 
const_circular_iteratoroperator-- ()
 
const_circular_iterator operator++ (int)
 
const_circular_iteratoroperator+= (int32 i)
 
const_circular_iteratoroperator-= (int32 i)
 
const FloatVector::value_type & operator* ()
 
float64 __float__ () const
 

Private Attributes

FloatVector::const_iterator end_
 
FloatVector::const_iterator itor_
 
FloatVectordata_
 

Detailed Description

Definition at line 212 of file CircularIterators.h.

Constructor & Destructor Documentation

Nsound::const_circular_iterator::const_circular_iterator ( const FloatVector v)
inline

Definition at line 216 of file CircularIterators.h.

217  :
218  end_(v.end()),
219  itor_(v.begin()),
220  data_(const_cast<FloatVector*>(&v))
221  {}
FloatVector::const_iterator itor_
FloatVector::const_iterator end_
Nsound::const_circular_iterator::const_circular_iterator ( const const_circular_iterator copy)
inline

Definition at line 223 of file CircularIterators.h.

224  :
225  end_(copy.end_),
226  itor_(copy.itor_),
227  data_(copy.data_)
228  {}
FloatVector::const_iterator itor_
FloatVector::const_iterator end_

Member Function Documentation

const_circular_iterator& Nsound::const_circular_iterator::operator= ( const const_circular_iterator rhs)
inline

Definition at line 230 of file CircularIterators.h.

References data_, end_, and itor_.

231  {
232  if(this == &rhs) return *this;
233 
234  end_ = rhs.end_;
235  itor_ = rhs.itor_;
236  data_ = rhs.data_;
237 
238  return *this;
239  }
FloatVector::const_iterator itor_
FloatVector::const_iterator end_
void Nsound::const_circular_iterator::reset ( )
inline

Definition at line 241 of file CircularIterators.h.

References data_, and itor_.

241 { itor_ = data_->begin(); }
FloatVector::const_iterator itor_
bool Nsound::const_circular_iterator::operator== ( const const_circular_iterator rhs) const
inline

Definition at line 243 of file CircularIterators.h.

References data_, and itor_.

244  {
245  return
246  data_ == rhs.data_ &&
247  itor_ == rhs.itor_;
248  }
FloatVector::const_iterator itor_
bool Nsound::const_circular_iterator::operator!= ( const const_circular_iterator rhs) const
inline

Definition at line 250 of file CircularIterators.h.

References data_, and itor_.

251  {
252  return
253  data_ != rhs.data_ ||
254  itor_ != rhs.itor_;
255  }
FloatVector::const_iterator itor_
const_circular_iterator& Nsound::const_circular_iterator::operator++ ( )
inline

Definition at line 257 of file CircularIterators.h.

References data_, end_, and itor_.

Referenced by operator++().

258  {
259  ++itor_;
260 
261  if(itor_ == end_) itor_ = data_->begin();
262 
263  return *this;
264  }
FloatVector::const_iterator itor_
FloatVector::const_iterator end_
const_circular_iterator& Nsound::const_circular_iterator::operator-- ( )
inline

Definition at line 266 of file CircularIterators.h.

References data_, and itor_.

267  {
268  if(itor_ == data_->begin()) itor_ = data_->end() - 1;
269  else --itor_;
270 
271  return *this;
272  }
FloatVector::const_iterator itor_
const_circular_iterator Nsound::const_circular_iterator::operator++ ( int  )
inline

Definition at line 274 of file CircularIterators.h.

References operator++().

275  {
276  const_circular_iterator tmp(*this);
277  operator++();
278  return tmp;
279  }
const_circular_iterator & operator++()
const_circular_iterator(const FloatVector &v)
const_circular_iterator& Nsound::const_circular_iterator::operator+= ( int32  i)
inline

Definition at line 281 of file CircularIterators.h.

References data_, and itor_.

282  {
283  if(i < 0) return *this -= -i;
284  auto pos = std::distance(const_cast<const FloatVector *>(data_)->begin(), itor_);
285  pos = (pos + i) % data_->size();
286  itor_ = data_->begin() + pos;
287  return *this;
288  }
FloatVector::const_iterator itor_
const_circular_iterator& Nsound::const_circular_iterator::operator-= ( int32  i)
inline

Definition at line 290 of file CircularIterators.h.

References data_, and itor_.

291  {
292  if(i < 0) return *this += -i;
293  auto pos = std::distance(const_cast<const FloatVector *>(data_)->begin(), itor_);
294  pos -= (i % data_->size());
295  if(pos < 0) pos += data_->size();
296  itor_ = data_->begin() + pos;
297  return *this;
298  }
FloatVector::const_iterator itor_
const FloatVector::value_type& Nsound::const_circular_iterator::operator* ( )
inline

Definition at line 300 of file CircularIterators.h.

References itor_.

301  {
302  return *itor_;
303  }
FloatVector::const_iterator itor_
float64 Nsound::const_circular_iterator::__float__ ( ) const
inline

Definition at line 305 of file CircularIterators.h.

References itor_.

306  {
307  return *itor_;
308  }
FloatVector::const_iterator itor_

Member Data Documentation

FloatVector::const_iterator Nsound::const_circular_iterator::end_
private

Definition at line 312 of file CircularIterators.h.

Referenced by operator++(), and operator=().

FloatVector::const_iterator Nsound::const_circular_iterator::itor_
private
FloatVector* Nsound::const_circular_iterator::data_
private

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