/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 2009 * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ namespace Gecode { namespace Int { /* * Task array */ template forceinline TaskArray::TaskArray(void) : n(0), t(nullptr) {} template forceinline TaskArray::TaskArray(Space& home, int n0) : n(n0), t(home.alloc(n)) { assert(n > 0); } template forceinline TaskArray::TaskArray(const TaskArray& a) : n(a.n), t(a.t) {} template forceinline const TaskArray& TaskArray::operator =(const TaskArray& a) { n=a.n; t=a.t; return *this; } template forceinline int TaskArray::size(void) const { return n; } template forceinline void TaskArray::size(int n0) { n = n0; } template forceinline Task& TaskArray::operator [](int i) { assert((i >= 0) && (i < n)); return t[i]; } template forceinline const Task& TaskArray::operator [](int i) const { assert((i >= 0) && (i < n)); return t[i]; } template forceinline void TaskArray::subscribe(Space& home, Propagator& p, PropCond pc) { for (int i=0; i forceinline void TaskArray::cancel(Space& home, Propagator& p, PropCond pc) { for (int i=0; i forceinline void TaskArray::reschedule(Space& home, Propagator& p, PropCond pc) { for (int i=0; i forceinline void TaskArray::update(Space& home, TaskArray& a) { n=a.n; t=home.alloc(n); for (int i=0; i std::basic_ostream& operator <<(std::basic_ostream& os, const TaskArray& t) { std::basic_ostringstream s; s.copyfmt(os); s.width(0); s << '{'; if (t.size() > 0) { s << t[0]; for (int i=1; i forceinline TaskViewArray::TaskViewArray(TaskArray& t0) : t(t0) {} template forceinline int TaskViewArray::size(void) const { return t.size(); } template forceinline void TaskViewArray::size(int n) { t.size(n); } template forceinline TaskView& TaskViewArray::operator [](int i) { return static_cast(t[i]); } template forceinline const TaskView& TaskViewArray::operator [](int i) const { return static_cast(t[i]); } template std::basic_ostream& operator <<(std::basic_ostream& os, const TaskViewArray& t) { std::basic_ostringstream s; s.copyfmt(os); s.width(0); s << '{'; if (t.size() > 0) { s << t[0]; for (int i=1; i