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: 2006-08-04 16:03:17 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $ 00010 * $Revision: 3511 $ 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 forceinline 00032 Stop::~Stop(void) {} 00033 00034 00035 00036 /* 00037 * Stopping for memory limit 00038 * 00039 */ 00040 00041 forceinline 00042 MemoryStop::MemoryStop(size_t l0) : l(l0) {} 00043 00044 forceinline size_t 00045 MemoryStop::limit(void) const { 00046 return l; 00047 } 00048 00049 forceinline void 00050 MemoryStop::limit(size_t l0) { 00051 l=l0; 00052 } 00053 00054 00055 /* 00056 * Stopping for memory limit 00057 * 00058 */ 00059 00060 forceinline 00061 FailStop::FailStop(unsigned long int l0) : l(l0) {} 00062 00063 forceinline unsigned long int 00064 FailStop::limit(void) const { 00065 return l; 00066 } 00067 00068 forceinline void 00069 FailStop::limit(unsigned long int l0) { 00070 l=l0; 00071 } 00072 00073 00074 /* 00075 * Stopping for memory limit 00076 * 00077 */ 00078 00079 forceinline 00080 TimeStop::TimeStop(unsigned long int l0) 00081 : s(clock()), l(l0) {} 00082 00083 forceinline unsigned long int 00084 TimeStop::limit(void) const { 00085 return l; 00086 } 00087 00088 forceinline void 00089 TimeStop::limit(unsigned long int l0) { 00090 l=l0; 00091 } 00092 00093 forceinline void 00094 TimeStop::reset(void) { 00095 s=clock(); 00096 } 00097 00098 }} 00099 00100 // STATISTICS: search-any