Generated on Thu Mar 13 2014 04:39:35 for Gecode by doxygen 1.8.1.2
stop.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, 2006
8  *
9  * Last modified:
10  * $Date: 2009-05-09 04:33:02 +1000 (Sat, 09 May 2009) $ by $Author: schulte $
11  * $Revision: 9047 $
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 { namespace Search {
39 
40  /*
41  * Base class
42  *
43  */
45  Stop::Stop(void) {}
46 
48  Stop::~Stop(void) {}
49 
50 
51 
52  /*
53  * Stopping for memory limit
54  *
55  */
56 
58  MemoryStop::MemoryStop(size_t l0) : l(l0) {}
59 
60  forceinline size_t
61  MemoryStop::limit(void) const {
62  return l;
63  }
64 
65  forceinline void
66  MemoryStop::limit(size_t l0) {
67  l=l0;
68  }
69 
70 
71  /*
72  * Stopping for node limit
73  *
74  */
75 
77  NodeStop::NodeStop(unsigned long int l0) : l(l0) {}
78 
79  forceinline unsigned long int
80  NodeStop::limit(void) const {
81  return l;
82  }
83 
84  forceinline void
85  NodeStop::limit(unsigned long int l0) {
86  l=l0;
87  }
88 
89 
90  /*
91  * Stopping for failure limit
92  *
93  */
94 
96  FailStop::FailStop(unsigned long int l0) : l(l0) {}
97 
98  forceinline unsigned long int
99  FailStop::limit(void) const {
100  return l;
101  }
102 
103  forceinline void
104  FailStop::limit(unsigned long int l0) {
105  l=l0;
106  }
107 
108 
109  /*
110  * Stopping for time limit
111  *
112  */
113 
115  TimeStop::TimeStop(unsigned long int l0)
116  : l(l0) {
117  t.start();
118  }
119 
120  forceinline unsigned long int
121  TimeStop::limit(void) const {
122  return l;
123  }
124 
125  forceinline void
126  TimeStop::limit(unsigned long int l0) {
127  l=l0;
128  }
129 
130  forceinline void
132  t.start();
133  }
134 
135 }}
136 
137 // STATISTICS: search-other