main page
modules
namespaces
classes
files
Gecode home
Generated on Mon Jul 27 2020 00:00:00 for Gecode by
doxygen
1.8.18
gecode
iter
ranges-singleton-append.hpp
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Christian Schulte <schulte@gecode.org>
5
* Guido Tack <tack@gecode.org>
6
*
7
* Copyright:
8
* Christian Schulte, 2004
9
* Guido Tack, 2006
10
*
11
* This file is part of Gecode, the generic constraint
12
* development environment:
13
* http://www.gecode.org
14
*
15
* Permission is hereby granted, free of charge, to any person obtaining
16
* a copy of this software and associated documentation files (the
17
* "Software"), to deal in the Software without restriction, including
18
* without limitation the rights to use, copy, modify, merge, publish,
19
* distribute, sublicense, and/or sell copies of the Software, and to
20
* permit persons to whom the Software is furnished to do so, subject to
21
* the following conditions:
22
*
23
* The above copyright notice and this permission notice shall be
24
* included in all copies or substantial portions of the Software.
25
*
26
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
*
34
*/
35
36
namespace
Gecode
{
namespace
Iter {
namespace
Ranges {
37
46
template
<
class
J>
47
class
SingletonAppend
:
public
MinMax
{
48
protected
:
50
J
j
;
51
public
:
53
54
SingletonAppend
(
void
);
57
SingletonAppend
(
int
i0,
int
i1, J&
j
);
59
void
init
(
int
i0,
int
i1, J&
j
);
61
63
64
void
operator ++
(
void
);
67
};
68
69
70
/*
71
* Binary SingletonAppend
72
*
73
*/
74
75
template
<
class
J>
76
inline
void
77
SingletonAppend<J>::operator ++
(
void
) {
78
if
(j()) {
79
mi = j.min(); ma = j.max();
80
++j;
81
}
else
{
82
finish();
83
}
84
}
85
86
87
template
<
class
J>
88
forceinline
89
SingletonAppend<J>::SingletonAppend
(
void
) {}
90
91
template
<
class
J>
92
forceinline
93
SingletonAppend<J>::SingletonAppend
(
int
i0,
int
i1, J& j0)
94
: j(j0) {
95
mi
=i0;
ma
=i1;
96
}
97
98
template
<
class
J>
99
forceinline
void
100
SingletonAppend<J>::init
(
int
i0,
int
i1, J& j0) {
101
mi=i0; ma=i1; j=j0;
102
}
103
104
}}}
105
106
// STATISTICS: iter-any
107
Gecode::Iter::Ranges::SingletonAppend
Range iterator for appending a singleton with a range iterator
Definition:
ranges-singleton-append.hpp:47
Gecode::Iter::Ranges::MinMax::mi
int mi
Minimum of current range.
Definition:
ranges-minmax.hpp:50
Gecode::Iter::Ranges::SingletonAppend::init
void init(int i0, int i1, J &j)
Initialize with singleton (i0, i1) and iterator j.
Definition:
ranges-singleton-append.hpp:100
Gecode
Gecode toplevel namespace
Gecode::Iter::Ranges::MinMax
Base for range iterators with explicit min and max.
Definition:
ranges-minmax.hpp:47
Gecode::Iter::Ranges::MinMax::ma
int ma
Maximum of current range.
Definition:
ranges-minmax.hpp:52
Gecode::Iter::Ranges::SingletonAppend::j
J j
Iterator to be appended.
Definition:
ranges-singleton-append.hpp:50
Gecode::Iter::Ranges::SingletonAppend::SingletonAppend
SingletonAppend(void)
Default constructor.
Definition:
ranges-singleton-append.hpp:89
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::Iter::Ranges::SingletonAppend::operator++
void operator++(void)
Move iterator to next range (if possible)
Definition:
ranges-singleton-append.hpp:77