Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
print.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 *
6 * Copyright:
7 * Christian Schulte, 2017
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#include <functional>
35
36namespace Gecode {
37
39 template<class Var, class Val>
40 using VarValPrint = std::function<void(const Space& home, const Brancher& b,
41 unsigned int a,
42 Var x, int i, const Val& m,
43 std::ostream& o)>;
44
46 template<class View, class Val>
48 public:
50 typedef typename View::VarType Var;
51 protected:
53 public:
59 operator bool(void) const;
61 void operator ()(const Space& home, const Brancher& b,
62 unsigned int a,
63 View x, int i, const Val& m,
64 std::ostream& o) const;
66 bool notice(void) const;
68 void dispose(Space& home);
69 };
70
72 template<class View, class Val>
74 public:
76 typedef typename View::VarType Var;
77 public:
83 operator bool(void) const;
85 void operator ()(const Space& home, const Brancher& b,
86 unsigned int a,
87 View x, int i, const Val& m,
88 std::ostream& o) const;
90 bool notice(void) const;
92 void dispose(Space& home);
93 };
94
95
96
97 template<class View, class Val>
100 if (!vvp)
101 throw Gecode::InvalidFunction("BrancherPrint::BrancherPrint");
102 }
103
104 template<class View, class Val>
109
110 template<class View, class Val>
113 return true;
114 }
115
116 template<class View, class Val>
117 forceinline void
119 unsigned int a,
120 View x, int i, const Val& m,
121 std::ostream& o) const {
123 Var xv(x.varimp());
124 p()(home,b,a,xv,i,m,o);
125 }
126
127 template<class View, class Val>
128 forceinline bool
130 return true;
131 }
132
133 template<class View, class Val>
134 forceinline void
138
139
140 template<class View, class Val>
143 assert(!vvp);
144 (void) vvp;
145 }
146
147 template<class View, class Val>
150
151 template<class View, class Val>
154 return false;
155 }
156
157 template<class View, class Val>
158 forceinline void
160 unsigned int,
161 View, int, const Val&,
162 std::ostream&) const {}
163 template<class View, class Val>
164 forceinline bool
166 return false;
167 }
168
169 template<class View, class Val>
170 forceinline void
172
173}
174
175// STATISTICS: kernel-branch
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Class without print function.
Definition print.hpp:73
void dispose(Space &home)
Delete.
Definition print.hpp:171
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition print.hpp:165
View::VarType Var
The corresponding variable type.
Definition print.hpp:76
BrancherNoPrint(VarValPrint< Var, Val > vvp)
Initialize.
Definition print.hpp:142
void operator()(const Space &home, const Brancher &b, unsigned int a, View x, int i, const Val &m, std::ostream &o) const
Invoke print function.
Definition print.hpp:159
Class storing a print function.
Definition print.hpp:47
void operator()(const Space &home, const Brancher &b, unsigned int a, View x, int i, const Val &m, std::ostream &o) const
Invoke print function.
Definition print.hpp:118
View::VarType Var
The corresponding variable type.
Definition print.hpp:50
BrancherPrint(VarValPrint< Var, Val > vvp)
Initialize.
Definition print.hpp:99
SharedData< VarValPrint< Var, Val > > p
Definition print.hpp:52
void dispose(Space &home)
Delete.
Definition print.hpp:135
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition print.hpp:129
Base-class for branchers.
Definition core.hpp:1442
Exception: invalid function
Class for sharing data between spaces.
Computation spaces.
Definition core.hpp:1742
VarImp * varimp(void) const
Return variable implementation of variable.
Definition var.hpp:96
Base class for variables.
Definition var.hpp:40
Gecode toplevel namespace
std::function< void(const Space &home, const Brancher &b, unsigned int a, Var x, int i, const Val &m, std::ostream &o)> VarValPrint
Function type for printing variable and value selection.
Definition print.hpp:40
Post propagator for SetVar x
Definition set.hh:767
#define forceinline
Definition config.hpp:187
#define GECODE_VALID_FUNCTION(f)
Assert that a function is valid.
Definition macros.hpp:94