main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Aug 24 2012 04:52:12 for Gecode by
doxygen
1.8.1.2
gecode
kernel
brancher-val.hpp
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main author:
4
* Christian Schulte <schulte@gecode.org>
5
*
6
* Copyright:
7
* Christian Schulte, 2008
8
*
9
* Last modified:
10
* $Date: 2011-05-11 20:44:17 +1000 (Wed, 11 May 2011) $ by $Author: tack $
11
* $Revision: 12001 $
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
namespace
Gecode {
39
46
47
class
EmptyValSelChoice
{
48
public
:
50
size_t
size
(
void
)
const
;
52
void
archive
(
Archive
& e)
const
;
53
};
54
60
template
<
class
_View,
class
_Val>
61
class
ValSelBase
{
62
public
:
64
typedef
_View
View
;
66
typedef
_Val
Val
;
68
typedef
EmptyValSelChoice
Choice
;
70
static
const
unsigned
int
alternatives
= 2;
72
ValSelBase
(
void
);
74
ValSelBase
(
Space
& home,
const
ValBranchOptions
& vbo);
76
EmptyValSelChoice
choice
(
Space
& home);
78
EmptyValSelChoice
choice
(
const
Space
& home,
Archive
& e);
80
void
commit
(
Space
& home,
const
EmptyValSelChoice
&
c
,
unsigned
a
);
82
void
update
(
Space
& home,
bool
share,
ValSelBase
& vs);
84
void
dispose
(
Space
& home);
85
};
87
88
89
// Empty value selection choice
90
forceinline
size_t
91
EmptyValSelChoice::size
(
void
)
const
{
92
return
sizeof
(
EmptyValSelChoice
);
93
}
94
forceinline
void
95
EmptyValSelChoice::archive
(
Archive
& e)
const
{ (void)e; }
96
97
// Value selection base class
98
template
<
class
View,
class
Val>
99
forceinline
100
ValSelBase<View,Val>::ValSelBase
(
void
) {}
101
template
<
class
View,
class
Val>
102
forceinline
103
ValSelBase<View,Val>::ValSelBase
(
Space
&,
const
ValBranchOptions
&) {}
104
template
<
class
View,
class
Val>
105
forceinline
EmptyValSelChoice
106
ValSelBase<View,Val>::choice
(
Space
&) {
107
EmptyValSelChoice
c
;
return
c
;
108
}
109
template
<
class
View,
class
Val>
110
forceinline
EmptyValSelChoice
111
ValSelBase<View,Val>::choice
(
const
Space
&,
Archive
&) {
112
EmptyValSelChoice
c
;
return
c
;
113
}
114
template
<
class
View,
class
Val>
115
forceinline
void
116
ValSelBase<View,Val>::commit
(
Space
&,
const
EmptyValSelChoice
&,
unsigned
int
) {}
117
template
<
class
View,
class
Val>
118
forceinline
void
119
ValSelBase<View,Val>::update
(
Space
&,
bool
,
ValSelBase<View,Val>
&) {}
120
template
<
class
View,
class
Val>
121
forceinline
void
122
ValSelBase<View,Val>::dispose
(
Space
&) {}
123
124
}
125
126
// STATISTICS: kernel-branch