stack.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-07-12 15:53:12 +0200 (Wed, 12 Jul 2006) $ by $Author: tack $ 00010 * $Revision: 3349 $ 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 Int { namespace Channel { 00023 00030 class ProcessStack { 00031 private: 00032 int* p; 00033 public: 00034 ProcessStack(int* p); 00035 bool empty(void) const; 00036 int pop(void); 00037 void push(int i); 00038 }; 00039 00040 forceinline 00041 ProcessStack::ProcessStack(int* p0) : p(p0) { 00042 *(p++) = -1; 00043 } 00044 forceinline bool 00045 ProcessStack::empty(void) const { 00046 return *(p-1) < 0; 00047 } 00048 forceinline int 00049 ProcessStack::pop(void) { 00050 return *(--p); 00051 } 00052 forceinline void 00053 ProcessStack::push(int i) { 00054 *(p++) = i; 00055 } 00056 00057 }}} 00058 00059 // STATISTICS: int-prop