advisor.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 namespace Gecode {
00037
00042 template<class View>
00043 class ViewAdvisor : public Advisor {
00044 protected:
00046 View x;
00047 public:
00049 template<class A>
00050 ViewAdvisor(Space& home, Propagator& p, Council<A>& c, View x0);
00052 ViewAdvisor(Space& home, ViewAdvisor<View>& a);
00054 View view(void) const;
00056 void view(Space& home, View y);
00058 template<class A>
00059 void dispose(Space& home, Council<A>& c);
00060 };
00061
00062
00063 template<class View>
00064 template<class A>
00065 forceinline
00066 ViewAdvisor<View>::ViewAdvisor(Space& home, Propagator& p,
00067 Council<A>& c, View x0)
00068 : Advisor(home,p,c), x(x0) {
00069 x.subscribe(home,*this);
00070 }
00071 template<class View>
00072 forceinline
00073 ViewAdvisor<View>::ViewAdvisor(Space& home, ViewAdvisor<View>& a)
00074 : Advisor(home,a) {
00075 x.update(home,a.x);
00076 }
00077 template<class View>
00078 forceinline View
00079 ViewAdvisor<View>::view(void) const {
00080 return x;
00081 }
00082 template<class View>
00083 forceinline void
00084 ViewAdvisor<View>::view(Space& home, View y) {
00085 x.cancel(home,*this); x=y; x.subscribe(home,*this);
00086 }
00087 template<class View>
00088 template<class A>
00089 forceinline void
00090 ViewAdvisor<View>::dispose(Space& home, Council<A>& c) {
00091 x.cancel(home,*this);
00092 Advisor::dispose(home,c);
00093 }
00094
00095 }
00096
00097