@q file: tblkup.w@> @q% Copyright Dave Bone 1998 - 2015@> @q% /*@> @q% This Source Code Form is subject to the terms of the Mozilla Public@> @q% License, v. 2.0. If a copy of the MPL was not distributed with this@> @q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> @q% */@> @** Table lookup functor. Inheritance earns its keep. See ``Yacco2 - symbol table'' document as an example of use. @+= template @=@> struct functor2{ struct functor{}; void operator()(Functor* Func){Func->operator()();}; };@/ template @=@>@/ class tble_lkup : public std::unary_function@=@>{ public:@/ tble_lkup():lkup__(ON){}; ~tble_lkup(){}; virtual T operator()(T t)=0; void turn_off_lkup(){ lkup__ = OFF;@/ /// yacco2::lrclog << "TURN OFF TBLE LK" << std::endl; }; void turn_on_lkup(){ lkup__ = ON;@/ /// yacco2::lrclog << "TURN ON TBLE LK" << std::endl; }; bool lkup(){return lkup__;}; bool lkup__; }; @ @+= typedef tble_lkup tble_lkup_type;@/