idx-view.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
* Guido Tack, 2004
*
* 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.
*
*/
#ifndef __GECODE_INT_IDX_VIEW_HH__
#define __GECODE_INT_IDX_VIEW_HH__
#include <gecode/int.hh>
namespace Gecode { namespace Int {
template<class View>
class IdxView {
public:
int idx;
View view;
static IdxView* allocate(Space& home, int n);
};
template<class View>
class ViewToVarArg {};
template<class View>
class IdxViewArray {
private:
IdxView<View>* xs;
int n;
public:
IdxViewArray(void);
IdxViewArray(const IdxViewArray<View>&);
IdxViewArray(Space& home, const typename ViewToVarArg<View>::argtype& x);
IdxViewArray(Space& home, int n);
int size(void) const;
void size(int n);
IdxView<View>& operator [](int n);
const IdxView<View>& operator [](int) const;
void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
void cancel(Space& home, Propagator& p, PropCond pc);
void reschedule(Space& home, Propagator& p, PropCond pc);
void update(Space& home, IdxViewArray<View>& x);
};
template<class Char, class Traits, class View>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,
const IdxViewArray<View>& x);
}}
#include <gecode/int/idx-view.hpp>
#endif
// STATISTICS: int-prop
Gecode::Int::IdxViewArray
An array of IdxView pairs.
Definition idx-view.hh:67
Gecode::Int::IdxViewArray::operator[]
IdxView< View > & operator[](int n)
Access element n.
Definition idx-view.hpp:117
Gecode::Int::IdxViewArray::subscribe
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Definition idx-view.hpp:131
Gecode::Int::IdxViewArray::reschedule
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Definition idx-view.hpp:146
Gecode::Int::IdxViewArray::IdxViewArray
IdxViewArray(Space &home, int n)
Construct an IdxViewArray of size n.
Definition idx-view.hpp:96
Gecode::Int::IdxViewArray::size
void size(int n)
Set the size to n.
Definition idx-view.hpp:111
Gecode::Int::IdxViewArray::IdxViewArray
IdxViewArray(void)
Default constructor.
Definition idx-view.hpp:73
Gecode::Int::IdxViewArray::update
void update(Space &home, IdxViewArray< View > &x)
Cloning.
Definition idx-view.hpp:153
Gecode::Int::IdxViewArray::IdxViewArray
IdxViewArray(const IdxViewArray< View > &)
Copy constructor.
Definition idx-view.hpp:77
Gecode::Int::IdxViewArray::cancel
void cancel(Space &home, Propagator &p, PropCond pc)
Definition idx-view.hpp:139
Gecode::Int::IdxViewArray::size
int size(void) const
Return the current size.
Definition idx-view.hpp:105
Gecode::Int::IdxViewArray::IdxViewArray
IdxViewArray(Space &home, const typename ViewToVarArg< View >::argtype &x)
Construct an IdxViewArray from x.
Definition idx-view.hpp:83
Gecode::Int::IdxView
Class for pair of index and view.
Definition idx-view.hh:48
Gecode::Int::IdxView::idx
int idx
The index.
Definition idx-view.hh:51
Gecode::Int::IdxView::view
View view
Thhe view.
Definition idx-view.hh:53
Gecode::Int::IdxView::allocate
static IdxView * allocate(Space &home, int n)
Allocate memory for n index-view pairs.
Definition idx-view.hpp:67
Gecode::Int::ViewToVarArg
Class to map VarArg type to view.
Definition idx-view.hh:60
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::View
int.hh
idx-view.hpp
Gecode::Int
Finite domain integers.
Gecode::Int::operator<<
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const IdxViewArray< View > &x)
Definition idx-view.hpp:167
Gecode
Gecode toplevel namespace
Gecode::PropCond
int PropCond
Type for propagation conditions.
Definition core.hpp:72