summaryrefslogtreecommitdiff
path: root/web/yacco2/library/tblkup.w
blob: 989c8a47cd0129d49740f9b54a757b03b1da88af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@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.
@<Structure...@>+=
template @=<typename Functor>@>
struct functor2{
	struct functor{};
	void operator()(Functor* Func){Func->operator()();};
};@/
template @=<typename T>@>@/
class tble_lkup : public std::unary_function@=<T,T>@>{
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__;
};

@ 
@<Structure...@>+=
typedef tble_lkup<yacco2::CAbs_lr1_sym*> tble_lkup_type;@/