DS
PSR
Ask a Question
Search DS
PSR
:
powered by
FreeFind
Home
Install
Use
Develop
Support
News
Credits
hosted by
Kernel
Classes
dsp
StepIterator.h
1
//-*-C++-*-
2
/***************************************************************************
3
*
4
* Copyright (C) 2008 by Willem van Straten
5
* Licensed under the Academic Free License version 2.1
6
*
7
***************************************************************************/
8
9
// dspsr/Kernel/Classes/dsp/StepIterator.h
10
11
#ifndef __dsp_StepIterator_h
12
#define __dsp_StepIterator_h
13
15
template
<
typename
T>
16
class
StepIterator
17
{
18
public
:
19
21
inline
StepIterator
(T* start)
22
{
23
current = start;
24
increment = 1;
25
}
26
27
inline
StepIterator
(
const
StepIterator
& copy)
28
{
29
operator = (copy);
30
increment = copy.increment;
31
}
32
33
inline
const
StepIterator
& operator = (
const
StepIterator
& copy)
34
{
35
// increment is set only by copy constructor
36
current = copy.current;
37
return
*
this
;
38
}
39
40
void
set_increment (
unsigned
step)
41
{
42
increment = step;
43
}
44
45
const
void
* ptr ()
46
{
47
return
current;
48
}
49
50
inline
void
operator ++ ()
51
{
52
current += increment;
53
}
54
55
inline
T operator * ()
56
{
57
return
*current;
58
}
59
60
protected
:
61
62
T* current;
63
unsigned
increment;
64
65
};
66
67
#endif
StepIterator
An iterator through contiguous data.
Definition:
StepIterator.h:16
StepIterator::StepIterator
StepIterator(T *start)
Construct from base pointer.
Definition:
StepIterator.h:26
Generated using
doxygen
1.8.17