advisor.hpp /usr/include/gecode/kernel.hh Gecode::ViewAdvisor Gecode /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *MikaelLagerkvist<lagerkvist@gecode.org> *ChristianSchulte<schulte@gecode.org> * *Copyright: *MikaelLagerkvist,2006 *ChristianSchulte,2007 * *Lastmodified: *$Date:2010-04-0812:35:31+0200(Thu,08Apr2010)$by$Author:schulte$ *$Revision:10684$ * *ThisfileispartofGecode,thegenericconstraint *developmentenvironment: *http://www.gecode.org * *Permissionisherebygranted,freeofcharge,toanypersonobtaining *acopyofthissoftwareandassociateddocumentationfiles(the *"Software"),todealintheSoftwarewithoutrestriction,including *withoutlimitationtherightstouse,copy,modify,merge,publish, *distribute,sublicense,and/orsellcopiesoftheSoftware,andto *permitpersonstowhomtheSoftwareisfurnishedtodoso,subjectto *thefollowingconditions: * *Theabovecopyrightnoticeandthispermissionnoticeshallbe *includedinallcopiesorsubstantialportionsoftheSoftware. * *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND, *EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOF *MERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEAND *NONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBE *LIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTION *OFCONTRACT,TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTION *WITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE. * */ namespaceGecode{ template<classView> classViewAdvisor:publicAdvisor{ protected: Viewx; public: template<classA> ViewAdvisor(Space&home,Propagator&p,Council<A>&c,Viewx0); ViewAdvisor(Space&home,boolshare,ViewAdvisor<View>&a); Viewview(void)const; voidview(Space&home,Viewy); template<classA> voiddispose(Space&home,Council<A>&c); }; template<classView> template<classA> forceinline ViewAdvisor<View>::ViewAdvisor(Space&home,Propagator&p, Council<A>&c,Viewx0) :Advisor(home,p,c),x(x0){ x.subscribe(home,*this); } template<classView> forceinline ViewAdvisor<View>::ViewAdvisor(Space&home,boolshare, ViewAdvisor<View>&a) :Advisor(home,share,a){ x.update(home,share,a.x); } template<classView> forceinlineView ViewAdvisor<View>::view(void)const{ returnx; } template<classView> forceinlinevoid ViewAdvisor<View>::view(Space&home,Viewy){ x.cancel(home,*this);x=y;x.subscribe(home,*this); } template<classView> template<classA> forceinlinevoid ViewAdvisor<View>::dispose(Space&home,Council<A>&c){ x.cancel(home,*this); Advisor::dispose(home,c); } } //STATISTICS:kernel-other