base.icc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 namespace Gecode { namespace Int { namespace Channel {
00023
00024 template <class Info, PropCond pc>
00025 forceinline
00026 Base<Info,pc>::Base(Space* home, int n0, Info* xy0, bool fd)
00027 : Propagator(home,fd), n(n0), n_na(2*n), xy(xy0) {
00028 for (int i=2*n; i--; )
00029 xy[i].view.subscribe(home,this,pc);
00030 }
00031
00032 template <class Info, PropCond pc>
00033 forceinline
00034 Base<Info,pc>::Base(Space* home, bool share, Base<Info,pc>& p)
00035 : Propagator(home,share,p), n(p.n), n_na(p.n_na),
00036 xy(Info::allocate(home,2*n)) {
00037 for (int i=2*n; i--; )
00038 xy[i].update(home,share,p.xy[i]);
00039 }
00040
00041 template <class Info, PropCond pc>
00042 PropCost
00043 Base<Info,pc>::cost(void) const {
00044 return PC_QUADRATIC_LO;
00045 }
00046
00047 template <class Info, PropCond pc>
00048 size_t
00049 Base<Info,pc>::dispose(Space* home) {
00050 if (!home->failed())
00051 for (int i=2*n; i--; )
00052 xy[i].view.cancel(home,this,pc);
00053 (void) Propagator::dispose(home);
00054 return sizeof(*this);
00055 }
00056
00057 }}}
00058
00059
00060