stop.icc
Go to the documentation of this file.00001 /* 00002 * Main authors: 00003 * Christian Schulte <schulte@gecode.org> 00004 * 00005 * Copyright: 00006 * Christian Schulte, 2006 00007 * 00008 * Last modified: 00009 * $Date: 2005-08-10 20:28:01 +0200 (Wed, 10 Aug 2005) $ by $Author: schulte $ 00010 * $Revision: 2202 $ 00011 * 00012 * This file is part of Gecode, the generic constraint 00013 * development environment: 00014 * http://www.gecode.org 00015 * 00016 * See the file "LICENSE" for information on usage and 00017 * redistribution of this file, and for a 00018 * DISCLAIMER OF ALL WARRANTIES. 00019 * 00020 */ 00021 00022 namespace Gecode { namespace Search { 00023 00024 /* 00025 * Base class 00026 * 00027 */ 00028 forceinline 00029 Stop::Stop(void) {} 00030 00031 00032 /* 00033 * Stopping for memory limit 00034 * 00035 */ 00036 00037 forceinline 00038 MemoryStop::MemoryStop(size_t l0) : l(l0) {} 00039 00040 forceinline size_t 00041 MemoryStop::limit(void) const { 00042 return l; 00043 } 00044 00045 forceinline void 00046 MemoryStop::limit(size_t l0) { 00047 l=l0; 00048 } 00049 00050 00051 /* 00052 * Stopping for memory limit 00053 * 00054 */ 00055 00056 forceinline 00057 FailStop::FailStop(unsigned long int l0) : l(l0) {} 00058 00059 forceinline unsigned long int 00060 FailStop::limit(void) const { 00061 return l; 00062 } 00063 00064 forceinline void 00065 FailStop::limit(unsigned long int l0) { 00066 l=l0; 00067 } 00068 00069 00070 /* 00071 * Stopping for memory limit 00072 * 00073 */ 00074 00075 forceinline 00076 TimeStop::TimeStop(unsigned long int l0) 00077 : s(clock()), l(l0) {} 00078 00079 forceinline unsigned long int 00080 TimeStop::limit(void) const { 00081 return l; 00082 } 00083 00084 forceinline void 00085 TimeStop::limit(unsigned long int l0) { 00086 l=l0; 00087 } 00088 00089 forceinline void 00090 TimeStop::reset(void) { 00091 s=clock(); 00092 } 00093 00094 }} 00095 00096 // STATISTICS: search-any