/* * Main authors: * Guido Tack * Christian Schulte * * Copyright: * Guido Tack, 2004,2005 * Christian Schulte, 2004,2005 * * Last modified: * $Date: 2006-08-24 11:25:05 +0200 (Thu, 24 Aug 2006) $ by $Author: schulte $ * $Revision: 3559 $ * * 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 Set { namespace Select { template forceinline IdxView* IdxView::allocate(Space* home, int n) { return reinterpret_cast*>(home->alloc(sizeof(IdxView)*n)); } template IdxViewArray::IdxViewArray(void) : xs(NULL), n(0) {} template IdxViewArray::IdxViewArray(const IdxViewArray& a) { n = a.n; xs = a.xs; } template IdxViewArray::IdxViewArray(Space* home, const SetVarArgs& xa) : xs(NULL) { n = xa.size(); if (n>0) { xs = IdxView::allocate(home, n); for (int i = n; i--; ) { SetView xav(xa[i]); View xavv(xav); xs[i].idx = i; xs[i].var = xavv; } } } template forceinline int IdxViewArray::size(void) const { return n; } template forceinline void IdxViewArray::size(int n0) { n = n0; } template forceinline IdxView& IdxViewArray::operator[](int i) { assert((i >= 0) && (i < size())); return xs[i]; } template forceinline const IdxView& IdxViewArray::operator[](int i) const { assert((i >= 0) && (i < size())); return xs[i]; } template void IdxViewArray::subscribe(Space* home, Propagator* p, PropCond pc, bool process) { for (int i = n; i--; ) xs[i].var.subscribe(home,p,pc,process); } template void IdxViewArray::cancel(Space* home, Propagator* p, PropCond pc) { for (int i = n; i--; ) xs[i].var.cancel(home,p,pc); } template void IdxViewArray::update(Space* home, bool share, IdxViewArray& a) { n = a.size(); if (n>0) { xs = IdxView::allocate(home,n); for (int i=n; i--; ) { xs[i].idx = a[i].idx; xs[i].var.update(home,share,a[i].var); } } } }}} // STATISTICS: set-prop