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
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, PropCond pc>
00041 forceinline
00042 Base<Info,pc>::Base(Space* home, int n0, Info* xy0)
00043 : Propagator(home), n(n0), n_na(2*n), xy(xy0) {
00044 for (int i=2*n; i--; )
00045 xy[i].view.subscribe(home,this,pc);
00046 }
00047
00048 template <class Info, PropCond pc>
00049 forceinline
00050 Base<Info,pc>::Base(Space* home, bool share, Base<Info,pc>& p)
00051 : Propagator(home,share,p), n(p.n), n_na(p.n_na),
00052 xy(Info::allocate(home,2*n)) {
00053 for (int i=2*n; i--; )
00054 xy[i].update(home,share,p.xy[i]);
00055 }
00056
00057 template <class Info, PropCond pc>
00058 PropCost
00059 Base<Info,pc>::cost(ModEventDelta) const {
00060 return PC_QUADRATIC_LO;
00061 }
00062
00063 template <class Info, PropCond pc>
00064 Reflection::ActorSpec
00065 Base<Info,pc>::spec(const Space* home, Reflection::VarMap& m,
00066 const Support::Symbol& name) const {
00067 Reflection::ActorSpec s(name);
00068 for (int i=0; i<2*n; i++)
00069 s << xy[i].view.spec(home, m);
00070 return s;
00071 }
00072
00073 template <class Info, PropCond pc>
00074 forceinline size_t
00075 Base<Info,pc>::dispose(Space* home) {
00076 if (!home->failed())
00077 for (int i=2*n; i--; )
00078 xy[i].view.cancel(home,this,pc);
00079 (void) Propagator::dispose(home);
00080 return sizeof(*this);
00081 }
00082
00083 }}}
00084
00085
00086