$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_transformed_piter.hh
1
// Copyright (C) 2009, 2012, 2013 EPITA Research and Development
2
// 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_TRANSFORMED_PITER_HH
28
# define MLN_CORE_SITE_SET_P_TRANSFORMED_PITER_HH
29
33
34
# include <mln/core/internal/site_set_iterator_base.hh>
35
# include <mln/core/site_set/p_transformed.hh>
36
# include <mln/convert/to.hh>
37
38
39
namespace
mln
40
{
41
42
51
template
<
typename
Pi,
typename
S,
typename
F>
52
struct
p_transformed_piter
53
:
public
internal::site_set_iterator_base
< p_transformed<S,F>,
// Site_Set.
54
p_transformed_piter<Pi,S,F> >
// Exact.
55
{
57
p_transformed_piter
();
58
60
p_transformed_piter
(
const
p_transformed<S,F>
& s);
61
64
bool
is_valid_
()
const
;
65
67
void
invalidate_
();
68
70
void
start_
();
71
73
void
next_
();
75
77
void
change_target
(
const
p_transformed<S,F>
& s);
78
79
private
:
80
typedef
p_transformed_piter<Pi,S,F>
self_
;
81
typedef
internal::site_set_iterator_base<p_transformed<S,F>
,
self_
>
super_
;
82
83
protected
:
84
using
super_::s_
;
85
using
super_::p_
;
86
87
// The underlying site iterator.
88
Pi
pi_
;
89
};
90
91
92
93
# ifndef MLN_INCLUDE_ONLY
94
95
template
<
typename
Pi,
typename
S,
typename
F>
96
inline
97
p_transformed_piter<Pi,S,F>::p_transformed_piter
()
98
{
99
}
100
101
template
<
typename
Pi,
typename
S,
typename
F>
102
inline
103
p_transformed_piter<Pi,S,F>::p_transformed_piter
(
const
p_transformed<S,F>& s)
104
{
105
this->change_target(s);
106
}
107
108
template
<
typename
Pi,
typename
S,
typename
F>
109
inline
110
bool
111
p_transformed_piter<Pi,S,F>::is_valid_
()
const
112
{
113
return
pi_.is_valid();
114
}
115
116
template
<
typename
Pi,
typename
S,
typename
F>
117
inline
118
void
119
p_transformed_piter<Pi,S,F>::invalidate_
()
120
{
121
pi_.invalidate();
122
}
123
124
template
<
typename
Pi,
typename
S,
typename
F>
125
inline
126
void
127
p_transformed_piter<Pi,S,F>::start_
()
128
{
129
pi_.start();
130
if
(pi_.is_valid())
131
p_ = s_->function()(convert::to<mln_argument(F)>(pi_));
132
}
133
134
template
<
typename
Pi,
typename
S,
typename
F>
135
inline
136
void
137
p_transformed_piter<Pi,S,F>::next_
()
138
{
139
pi_.next();
140
if
(pi_.is_valid())
141
p_ = s_->function()(convert::to<mln_argument(F)>(pi_));
142
}
143
144
template
<
typename
Pi,
typename
S,
typename
F>
145
inline
146
void
147
p_transformed_piter<Pi,S,F>::change_target
(
const
p_transformed<S,F>& s)
148
{
149
s_ = & s;
150
// p might be also updated since it can hold a pointer towards
151
// the set it designates, so:
152
pi_.change_target(s.primary_set());
153
// Last:
154
this->invalidate();
155
}
156
157
# endif // ! MLN_INCLUDE_ONLY
158
159
}
// end of namespace mln
160
161
162
#endif // ! MLN_CORE_SITE_SET_P_TRANSFORMED_PITER_HH
mln
core
site_set
p_transformed_piter.hh
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)