values-offset.hpp /usr/include/gecode/iter.hh Gecode::Iter::Values::Offset Gecode Gecode::Iter Gecode::Iter::Values /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> * *Copyright: *ChristianSchulte,2007 * *Lastmodified: *$Date:2010-07-2817:35:33+0200(Wed,28Jul2010)$by$Author:schulte$ *$Revision:11294$ * *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{namespaceIter{namespaceValues{ template<classI> classOffset{ protected: Ii; intc; public: Offset(void); Offset(I&i,intc); voidinit(I&i,intc); booloperator ()(void)const; voidoperator ++(void); intval(void)const; }; template<classI> forceinline Offset<I>::Offset(void){} template<classI> forceinlinevoid Offset<I>::init(I&i0,intc0){ i=i0;c=c0; } template<classI> forceinline Offset<I>::Offset(I&i0,intc0):i(i0),c(c0){} template<classI> forceinlinevoid Offset<I>::operator ++(void){ ++i; } template<classI> forceinlinebool Offset<I>::operator ()(void)const{ returni(); } template<classI> forceinlineint Offset<I>::val(void)const{ returni.val()+c; } }}} //STATISTICS:iter-any