$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Milena
Getting started
API Reference Manual
All Classes
Examples
Demos
Publications
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
p_run_piter.hh
1
// Copyright (C) 2007, 2008, 2009, 2012, 2013 EPITA Research and
2
// Development Laboratory (LRDE)
3
//
4
// This file is part of Olena.
5
//
6
// Olena is free software: you can redistribute it and/or modify it under
7
// the terms of the GNU General Public License as published by the Free
8
// Software Foundation, version 2 of the License.
9
//
10
// Olena is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
17
//
18
// As a special exception, you may use this file as part of a free
19
// software project without restriction. Specifically, if other files
20
// instantiate templates or use macros or inline functions from this
21
// file, or you compile this file and link it with other files to produce
22
// an executable, this file does not by itself cause the resulting
23
// executable to be covered by the GNU General Public License. This
24
// exception does not however invalidate any other reasons why the
25
// executable file might be covered by the GNU General Public License.
26
27
#ifndef MLN_CORE_SITE_SET_P_RUN_PITER_HH
28
# define MLN_CORE_SITE_SET_P_RUN_PITER_HH
29
35
# include <mln/core/site_set/p_run.hh>
36
# include <mln/core/internal/site_set_iterator_base.hh>
37
38
39
namespace
mln
40
{
41
45
template
<
typename
P>
46
class
p_run_fwd_piter_
47
:
48
public
internal::site_set_iterator_base
< p_run<P>,
49
p_run_fwd_piter_<P> >
50
{
51
typedef
p_run_fwd_piter_<P>
self_
;
52
typedef
internal::site_set_iterator_base< p_run<P>
,
self_
>
super_
;
53
public
:
54
56
p_run_fwd_piter_
();
57
59
p_run_fwd_piter_
(
const
p_run<P>
& r);
60
63
bool
is_valid_
()
const
;
64
66
void
invalidate_
();
67
69
void
start_
();
70
72
void
next_
();
74
75
protected
:
76
using
super_::p_
;
77
using
super_::s_
;
78
};
79
80
81
85
template
<
typename
P>
86
class
p_run_bkd_piter_
87
:
88
public
internal::site_set_iterator_base
< p_run<P>,
89
p_run_bkd_piter_<P> >
90
{
91
typedef
p_run_bkd_piter_<P>
self_
;
92
typedef
internal::site_set_iterator_base< p_run<P>
,
self_
>
super_
;
93
public
:
94
96
p_run_bkd_piter_
();
97
99
p_run_bkd_piter_
(
const
p_run<P>
& r);
100
103
bool
is_valid_
()
const
;
104
106
void
invalidate_
();
107
109
void
start_
();
110
112
void
next_
();
114
115
protected
:
116
using
super_::p_
;
117
using
super_::s_
;
118
};
119
120
121
122
# ifndef MLN_INCLUDE_ONLY
123
124
// p_run_fwd_piter_<P>
125
126
template
<
typename
P>
127
inline
128
p_run_fwd_piter_<P>::p_run_fwd_piter_
()
129
{
130
}
131
132
template
<
typename
P>
133
inline
134
p_run_fwd_piter_<P>::p_run_fwd_piter_
(
const
p_run<P>& r)
135
{
136
this->change_target(r);
137
}
138
139
template
<
typename
P>
140
inline
141
bool
142
p_run_fwd_piter_<P>::is_valid_
()
const
143
{
144
mln_invariant(p_.index() >= 0);
145
return
p_.index() <
int
(s_->length());
146
}
147
148
template
<
typename
P>
149
inline
150
void
151
p_run_fwd_piter_<P>::invalidate_
()
152
{
153
p_.change_index(s_->length());
154
}
155
156
template
<
typename
P>
157
inline
158
void
159
p_run_fwd_piter_<P>::start_
()
160
{
161
p_.change_index(0);
162
}
163
164
template
<
typename
P>
165
inline
166
void
167
p_run_fwd_piter_<P>::next_
()
168
{
169
p_.inc_index();
170
}
171
172
173
// p_run_bkd_piter_<P>
174
175
template
<
typename
P>
176
inline
177
p_run_bkd_piter_<P>::p_run_bkd_piter_
()
178
{
179
}
180
181
template
<
typename
P>
182
inline
183
p_run_bkd_piter_<P>::p_run_bkd_piter_
(
const
p_run<P>& r)
184
{
185
this->
change_target
(r);
186
}
187
188
template
<
typename
P>
189
inline
190
bool
191
p_run_bkd_piter_<P>::is_valid_
()
const
192
{
193
mln_invariant(p_.index() <
int
(s_->length()));
194
return
p_.index() >= 0;
195
}
196
197
template
<
typename
P>
198
inline
199
void
200
p_run_bkd_piter_<P>::invalidate_
()
201
{
202
p_.change_index(-1);
203
}
204
205
template
<
typename
P>
206
inline
207
void
208
p_run_bkd_piter_<P>::start_
()
209
{
210
p_.change_index(s_->length() - 1);
211
}
212
213
template
<
typename
P>
214
inline
215
void
216
p_run_bkd_piter_<P>::next_
()
217
{
218
p_.dec_index();
219
}
220
221
222
# endif // ! MLN_INCLUDE_ONLY
223
224
}
// end of namespace mln
225
226
227
#endif // ! MLN_CORE_SITE_SET_P_RUN_PITER_HH
mln
core
site_set
p_run_piter.hh
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)