Sha256: e28d3bd5e4339024a93b73aa9b593dd2e9f0fe47808dffa2218f631fcb32fb68

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2006
 *
 *  Last modified:
 *     $Date: 2006-07-12 15:53:12 +0200 (Wed, 12 Jul 2006) $ by $Author: tack $
 *     $Revision: 3349 $
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  See the file "LICENSE" for information on usage and
 *  redistribution of this file, and for a
 *     DISCLAIMER OF ALL WARRANTIES.
 *
 */

namespace Gecode { namespace Int { namespace Channel {

  /**
   * \brief A simple integer stack for tracking which views are assigned
   *
   * Constructed such that temporary memory can be used. Requires that
   * only positive numbers are pushed (uses -1 as sentinel element).
   */
  class ProcessStack {
  private:
    int* p;
  public:
    ProcessStack(int* p);
    bool empty(void) const;
    int pop(void);
    void push(int i);
  };

  forceinline
  ProcessStack::ProcessStack(int* p0) : p(p0) {
    *(p++) = -1;
  }
  forceinline bool
  ProcessStack::empty(void) const {
    return *(p-1) < 0;
  }
  forceinline int
  ProcessStack::pop(void) {
    return *(--p);
  }
  forceinline void
  ProcessStack::push(int i) {
    *(p++) = i;
  }

}}}

// STATISTICS: int-prop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/int/channel/stack.icc