This file is indexed.

/usr/include/mia-2.4/mia/2d/iterator.cxx is in libmia-2.4-dev 2.4.3-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/* -*- mia-c++  -*-
 *
 * This file is part of MIA - a toolbox for medical image analysis 
 * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
 *
 * MIA is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <stdexcept>
#include <mia/core/errormacro.hh>
#include <mia/2d/iterator.hh>

NS_MIA_BEGIN

template <typename I> 
range2d_iterator_with_boundary_flag<I>::range2d_iterator_with_boundary_flag():
	m_pos(0,0), 
	m_size(0,0), 
	m_begin(0,0), 
	m_end(0,0), 
	m_xstride(0),
	m_boundary(eb_none)
{
}

template <typename I> 
range2d_iterator_with_boundary_flag<I>::range2d_iterator_with_boundary_flag(const C2DBounds& pos):
	m_pos(pos), 
	m_size(0,0), 
	m_begin(0,0), 
	m_end(0,0), 
	m_xstride(0),
	m_boundary(eb_none)
{
}

template <typename I> 
range2d_iterator_with_boundary_flag<I>::range2d_iterator_with_boundary_flag(const C2DBounds& pos, const C2DBounds& size, 
				      const C2DBounds& begin, const C2DBounds& end, I iterator):
	m_pos(pos), 
	m_size(size), 
	m_begin(begin), 
	m_end(end),
	m_xstride(m_size.x - (m_end.x - m_begin.x)),
	m_iterator(iterator), 
	m_boundary(eb_none)
{
	cvdebug() << "m_boundary=" << m_boundary << "\n"; 
	if (m_pos.x == 0)
		m_boundary |= eb_xlow; 
	if (m_pos.x == size.x - 1)
		m_boundary |= eb_xhigh; 
	
	if (m_pos.y == 0)
		m_boundary |= eb_ylow; 
	if (m_pos.y == size.y - 1)
		m_boundary |= eb_yhigh; 

	cvdebug() << "m_boundary=" << m_boundary << "\n"; 
	
}


template <typename I> 
range2d_iterator_with_boundary_flag<I>& range2d_iterator_with_boundary_flag<I>::operator = (const range2d_iterator_with_boundary_flag<I>& other)
{
	m_pos = other.m_pos; 
	m_size = other.m_size;  
	m_begin = other.m_begin; 
	m_end = other.m_end; 
	m_iterator = other.m_iterator; 
	m_xstride = other.m_xstride; 
	m_boundary = other.m_boundary; 
	return *this; 
}



template <typename I> 
range2d_iterator_with_boundary_flag<I>::range2d_iterator_with_boundary_flag(const range2d_iterator_with_boundary_flag<I>& other):
	m_pos(other.m_pos), 
	m_size(other.m_size), 
	m_begin(other.m_begin), 
	m_end(other.m_end), 
	m_xstride(other.m_xstride),
	m_iterator(other.m_iterator), 
	m_boundary(other.m_boundary)
{
}	

template <typename I> 
range2d_iterator_with_boundary_flag<I>& range2d_iterator_with_boundary_flag<I>::operator ++()
{
	DEBUG_ASSERT_RELEASE_THROW(m_pos.x < m_end.x, "range2d_iterator_with_boundary_flag: trying to increment past end");
	
	++m_pos.x;
	++m_iterator; 
	m_boundary &= ~eb_x;
	if (m_pos.x == m_end.x) {
		increment_y(); 
		if (m_pos.x == 0) 
			m_boundary |= eb_xlow;
	}else if (m_pos.x == m_size.x - 1)
		m_boundary |= eb_xhigh; 
	
	return *this; 
}

template <typename I> 
void range2d_iterator_with_boundary_flag<I>::increment_y()
{
	if (m_pos.y < m_end.y - 1) {
		m_pos.x = m_begin.x; 
		++m_pos.y; 
		m_boundary &= ~eb_ylow; 
		std::advance(m_iterator, m_xstride);
		if (m_pos.y == m_size.y - 1)
			m_boundary |= eb_yhigh; 
	}else if (m_pos.y == m_end.y - 1) {
		m_pos = m_end; 

	}
}

template <typename I> 
typename range2d_iterator_with_boundary_flag<I>::internal_iterator 
range2d_iterator_with_boundary_flag<I>::get_point()
{
	return m_iterator; 
}

template <typename I> 
range2d_iterator_with_boundary_flag<I> range2d_iterator_with_boundary_flag<I>::operator ++(int)
{
	range2d_iterator_with_boundary_flag result(*this); 
	++(*this); 
	return result; 
}

template <typename I> 
typename range2d_iterator_with_boundary_flag<I>::reference range2d_iterator_with_boundary_flag<I>::operator *() const
{
	return *m_iterator; 
}

template <typename I> 
struct __iterator2d_dispatch_operator_for_bool {
	static typename range2d_iterator_with_boundary_flag<I>::pointer 
	apply(const typename range2d_iterator_with_boundary_flag<I>::internal_iterator& it) {
		return it.operator->(); 
	}
}; 

template <> 
struct __iterator2d_dispatch_operator_for_bool<std::vector<bool>::iterator> {
	static std::vector<bool>::iterator::pointer apply(const std::vector<bool>::iterator& ) {
		throw std::logic_error("You can't use the '->' with a bool 2DDatafield range iterator"); 
	}
}; 

template <> 
struct __iterator2d_dispatch_operator_for_bool<std::vector<bool>::const_iterator> {
	static std::vector<bool>::const_iterator::pointer apply(const std::vector<bool>::const_iterator& ) {
		throw std::logic_error("You can't use the '->' with a bool 2DDatafield range iterator"); 
	}
}; 
			

template <typename I> 
typename range2d_iterator_with_boundary_flag<I>::pointer range2d_iterator_with_boundary_flag<I>::operator ->() const
{
	return __iterator2d_dispatch_operator_for_bool<internal_iterator>::apply(m_iterator);
}

template <typename I> 
const C2DBounds& range2d_iterator_with_boundary_flag<I>::pos() const
{
	return m_pos; 
}

template <typename I> 
int range2d_iterator_with_boundary_flag<I>::get_boundary_flags() const
{
	return m_boundary; 
}

template <typename I> 
range2d_iterator<I>::range2d_iterator():
	m_pos(0,0), 
	m_size(0,0), 
	m_begin(0,0), 
	m_end(0,0), 
	m_xstride(0)
{
}

template <typename I> 
range2d_iterator<I>::range2d_iterator(const C2DBounds& pos):
	m_pos(pos), 
	m_size(0,0), 
	m_begin(0,0), 
	m_end(0,0), 
	m_xstride(0)
{
}

template <typename I> 
range2d_iterator<I>::range2d_iterator(const C2DBounds& pos, const C2DBounds& size, 
				      const C2DBounds& begin, const C2DBounds& end, I iterator):
	m_pos(pos), 
	m_size(size), 
	m_begin(begin), 
	m_end(end),
	m_xstride(m_size.x - (m_end.x - m_begin.x)),
	m_iterator(iterator)
{
}


template <typename I> 
range2d_iterator<I>& range2d_iterator<I>::operator = (const range2d_iterator<I>& other)
{
	m_pos = other.m_pos; 
	m_size = other.m_size;  
	m_begin = other.m_begin; 
	m_end = other.m_end; 
	m_iterator = other.m_iterator; 
	m_xstride = other.m_xstride; 
	return *this; 
}



template <typename I> 
range2d_iterator<I>::range2d_iterator(const range2d_iterator<I>& other):
	m_pos(other.m_pos), 
	m_size(other.m_size), 
	m_begin(other.m_begin), 
	m_end(other.m_end), 
	m_xstride(other.m_xstride),
	m_iterator(other.m_iterator)
{
}	

template <typename I> 
range2d_iterator<I>& range2d_iterator<I>::operator ++()
{
	DEBUG_ASSERT_RELEASE_THROW(m_pos.x < m_end.x, "range2d_iterator: trying to increment past end");
	
	++m_pos.x;
	++m_iterator; 
	if (m_pos.x == m_end.x)
		increment_y(); 
	
	return *this; 
}

template <typename I> 
void range2d_iterator<I>::increment_y()
{
	if (m_pos.y < m_end.y - 1) {
		m_pos.x = m_begin.x; 
		++m_pos.y; 
		std::advance(m_iterator, m_xstride);
	} else if (m_pos.y == m_end.y - 1) {
		m_pos = m_end; 
	}
}

template <typename I> 
typename range2d_iterator<I>::internal_iterator 
range2d_iterator<I>::get_point()
{
	return m_iterator; 
}

template <typename I> 
range2d_iterator<I> range2d_iterator<I>::operator ++(int)
{
	range2d_iterator result(*this); 
	++(*this); 
	return result; 
}

template <typename I> 
typename range2d_iterator<I>::reference range2d_iterator<I>::operator *() const
{
	return *m_iterator; 
}


template <typename I> 
typename range2d_iterator<I>::pointer range2d_iterator<I>::operator ->() const
{
	return __iterator2d_dispatch_operator_for_bool<internal_iterator>::apply(m_iterator);
}

template <typename I> 
const C2DBounds& range2d_iterator<I>::pos() const
{
	return m_pos; 
}


template <typename I> 
range2d_iterator_with_boundary_flag<I> range2d_iterator<I>::with_boundary_flag() const
{
	return range2d_iterator_with_boundary_flag<I>(m_pos, m_size, m_begin, m_end, m_iterator); 
}

NS_MIA_END