Generated on Thu Apr 11 13:59:16 2019 for Gecode by doxygen 1.6.3

macros.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2004
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  *  Permission is hereby granted, free of charge, to any person obtaining
00014  *  a copy of this software and associated documentation files (the
00015  *  "Software"), to deal in the Software without restriction, including
00016  *  without limitation the rights to use, copy, modify, merge, publish,
00017  *  distribute, sublicense, and/or sell copies of the Software, and to
00018  *  permit persons to whom the Software is furnished to do so, subject to
00019  *  the following conditions:
00020  *
00021  *  The above copyright notice and this permission notice shall be
00022  *  included in all copies or substantial portions of the Software.
00023  *
00024  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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 // STATISTICS: kernel-other