Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
idx-view.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 * Guido Tack <tack@gecode.org>
6 *
7 * Copyright:
8 * Christian Schulte, 2004
9 * Guido Tack, 2004
10 *
11 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36#ifndef __GECODE_INT_IDX_VIEW_HH__
37#define __GECODE_INT_IDX_VIEW_HH__
38
39#include <gecode/int.hh>
40
41namespace Gecode { namespace Int {
42
47 template<class View>
48 class IdxView {
49 public:
51 int idx;
55 static IdxView* allocate(Space& home, int n);
56 };
57
59 template<class View>
60 class ViewToVarArg {};
61
66 template<class View>
68 private:
70 IdxView<View>* xs;
72 int n;
73 public:
81 IdxViewArray(Space& home, int n);
82
84 int size(void) const;
86 void size(int n);
87
91 const IdxView<View>& operator [](int) const;
92
97 void subscribe(Space& home, Propagator& p, PropCond pc, bool process=true);
102 void cancel(Space& home, Propagator& p, PropCond pc);
104 void reschedule(Space& home, Propagator& p, PropCond pc);
105
108 };
109
114 template<class Char, class Traits, class View>
115 std::basic_ostream<Char,Traits>&
116 operator <<(std::basic_ostream<Char,Traits>& os,
117 const IdxViewArray<View>& x);
118
119}}
120
122
123#endif
124
125
126// STATISTICS: int-prop
127
An array of IdxView pairs.
Definition idx-view.hh:67
IdxView< View > & operator[](int n)
Access element n.
Definition idx-view.hpp:117
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Definition idx-view.hpp:131
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Definition idx-view.hpp:146
IdxViewArray(Space &home, int n)
Construct an IdxViewArray of size n.
Definition idx-view.hpp:96
void size(int n)
Set the size to n.
Definition idx-view.hpp:111
IdxViewArray(void)
Default constructor.
Definition idx-view.hpp:73
void update(Space &home, IdxViewArray< View > &x)
Cloning.
Definition idx-view.hpp:153
IdxViewArray(const IdxViewArray< View > &)
Copy constructor.
Definition idx-view.hpp:77
void cancel(Space &home, Propagator &p, PropCond pc)
Definition idx-view.hpp:139
int size(void) const
Return the current size.
Definition idx-view.hpp:105
IdxViewArray(Space &home, const typename ViewToVarArg< View >::argtype &x)
Construct an IdxViewArray from x.
Definition idx-view.hpp:83
Class for pair of index and view.
Definition idx-view.hh:48
int idx
The index.
Definition idx-view.hh:51
View view
Thhe view.
Definition idx-view.hh:53
static IdxView * allocate(Space &home, int n)
Allocate memory for n index-view pairs.
Definition idx-view.hpp:67
Class to map VarArg type to view.
Definition idx-view.hh:60
Base-class for propagators.
Definition core.hpp:1066
Computation spaces.
Definition core.hpp:1744
Finite domain integers.
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const IdxViewArray< View > &x)
Definition idx-view.hpp:167
Gecode toplevel namespace
int PropCond
Type for propagation conditions.
Definition core.hpp:72
Post propagator for SetVar x
Definition set.hh:773