var.hpp /usr/include/gecode/kernel.hh Gecode::Var Gecode::VarImpVar Gecode /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> * *Copyright: *ChristianSchulte,2008 * *Lastmodified: *$Date:2013-02-1821:53:58+0100(Mon,18Feb2013)$by$Author:schulte$ *$Revision:13310$ * *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{ classVar{}; template<classVarImp> classVarImpVar:publicVar{ protected: VarImp*x; VarImpVar(void); VarImpVar(VarImp*y); public: typedefVarImpVarImpType; VarImp*varimp(void)const; unsignedintdegree(void)const; doubleafc(constSpace&home)const; boolassigned(void)const; voidupdate(Space&home,boolshare,VarImpVar<VarImp>&y); boolsame(constVarImpVar<VarImp>&y)const; boolbefore(constVarImpVar<VarImp>&y)const; }; /* *Variable:containsapointertoavariableimplementation * */ template<classVarImp> forceinline VarImpVar<VarImp>::VarImpVar(void) :x(NULL){} template<classVarImp> forceinline VarImpVar<VarImp>::VarImpVar(VarImp*y) :x(y){} template<classVarImp> forceinlineVarImp* VarImpVar<VarImp>::varimp(void)const{ returnx; } template<classVarImp> forceinlineunsignedint VarImpVar<VarImp>::degree(void)const{ returnx->degree(); } template<classVarImp> forceinlinedouble VarImpVar<VarImp>::afc(constSpace&home)const{ returnx->afc(home); } template<classVarImp> forceinlinebool VarImpVar<VarImp>::assigned(void)const{ returnx->assigned(); } template<classVarImp> forceinlinevoid VarImpVar<VarImp>::update(Space&home,boolshare,VarImpVar<VarImp>&y){ x=y.x->copy(home,share); } template<classVarImp> forceinlinebool VarImpVar<VarImp>::same(constVarImpVar<VarImp>&y)const{ returnvarimp()==y.varimp(); } template<classVarImp> forceinlinebool VarImpVar<VarImp>::before(constVarImpVar<VarImp>&y)const{ returnvarimp()<y.varimp(); } } //STATISTICS:kernel-var