macros.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00040 #define GECODE_POST \
00041 if (home.failed()) return; \
00042 ::Gecode::PostInfo __gecode__pi(home);
00043
00044
00052 #define GECODE_ME_CHECK(me) do { \
00053 if (::Gecode::me_failed(me)) \
00054 return ::Gecode::ES_FAILED; \
00055 } while (0)
00056
00064 #define GECODE_ME_CHECK_MODIFIED(modified, me) do { \
00065 ::Gecode::ModEvent __me__ ## __LINE__ = (me); \
00066 if (::Gecode::me_failed(__me__ ## __LINE__)) \
00067 return ::Gecode::ES_FAILED; \
00068 modified |= ::Gecode::me_modified(__me__ ## __LINE__); \
00069 } while (0)
00070
00077 #define GECODE_ME_FAIL(me) do { \
00078 if (::Gecode::me_failed(me)) { \
00079 (home).fail(); \
00080 return; \
00081 }} while (0)
00082
00083
00084
00091 #define GECODE_ES_CHECK(es) do { \
00092 ::Gecode::ExecStatus __es__ ## __LINE__ = (es); \
00093 if (__es__ ## __LINE__ < ::Gecode::ES_OK) \
00094 return __es__ ## __LINE__; \
00095 } while (0)
00096
00103 #define GECODE_ES_FAIL(es) do { \
00104 ::Gecode::ExecStatus __es__ ## __LINE__ = (es); \
00105 assert(__es__ ## __LINE__ != ::Gecode::__ES_SUBSUMED); \
00106 if (__es__ ## __LINE__ < ::Gecode::ES_OK) { \
00107 (home).fail(); return; \
00108 } \
00109 } while (0)
00110
00116 #define GECODE_REWRITE(prop,post) do { \
00117 ::Gecode::Propagator& __p__ ## __LINE__ = (prop); \
00118 size_t __s__ ## __LINE__ = __p__ ## __LINE__.dispose(home); \
00119 ::Gecode::ExecStatus __es__ ## __LINE__ = (post); \
00120 if (__es__ ## __LINE__ != ::Gecode::ES_OK) \
00121 return ::Gecode::ES_FAILED; \
00122 return home.ES_SUBSUMED_DISPOSED(__p__ ## __LINE__,__s__ ## __LINE__); \
00123 } while (0)
00124
00125