base.hpp
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
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Gecode { namespace Int { namespace Channel {
00039
00040 template<class Info, class Offset, PropCond pc>
00041 forceinline
00042 Base<Info,Offset,pc>::Base(Home home, int n0, Info* xy0,
00043 Offset& ox0, Offset& oy0)
00044 : Propagator(home), n(n0), n_na(2*n), ox(ox0), oy(oy0), xy(xy0) {
00045 for (int i=2*n; i--; )
00046 xy[i].view.subscribe(home,*this,pc);
00047 }
00048
00049 template<class Info, class Offset, PropCond pc>
00050 forceinline
00051 Base<Info,Offset,pc>::Base(Space& home, bool share, Base<Info,Offset,pc>& p)
00052 : Propagator(home,share,p), n(p.n), n_na(p.n_na),
00053 xy(home.alloc<Info>(2*n)) {
00054 ox.update(p.ox);
00055 oy.update(p.oy);
00056 for (int i=2*n; i--; )
00057 xy[i].update(home,share,p.xy[i]);
00058 }
00059
00060 template<class Info, class Offset, PropCond pc>
00061 PropCost
00062 Base<Info,Offset,pc>::cost(const Space&, const ModEventDelta&) const {
00063 return PropCost::quadratic(PropCost::LO, 2*n);
00064 }
00065
00066 template<class Info, class Offset, PropCond pc>
00067 forceinline size_t
00068 Base<Info,Offset,pc>::dispose(Space& home) {
00069 for (int i=2*n; i--; )
00070 xy[i].view.cancel(home,*this,pc);
00071 (void) Propagator::dispose(home);
00072 return sizeof(*this);
00073 }
00074
00075 }}}
00076
00077
00078