LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
over-table.hxx
Go to the documentation of this file.
1 
6 #ifndef OVERLOAD_OVER_TABLE_HXX
7 # define OVERLOAD_OVER_TABLE_HXX
8 
9 # include <ostream>
10 # include <overload/over-table.hh>
11 
12 namespace overload
13 {
14 
15  template <typename T>
17  {
18  oversymtab_.emplace_front ();
19  }
20 
21  template <typename T>
22  void OverTable<T>::put (misc::symbol key, T& value)
23  {
24  oversymtab_.front ()[key].push_back (&value);
25  }
26 
27  template <typename T>
30  {
31  precondition (!oversymtab_.empty ());
32  return oversymtab_.front () [key];
33  }
34 
35  template <typename T>
37  {
38  oversymtab_.push_front (oversymtab_.front ());
39  }
40 
41  template <typename T>
43  {
44  precondition (!oversymtab_.empty ());
45  oversymtab_.pop_front ();
46  }
47 
48  template <typename T>
49  std::ostream& OverTable<T>::print (std::ostream& ostr) const
50  {
51  ostr <<"<overTable>" << std::endl;
52  for (const mmap_type* il : oversymtab_)
53  {
54  ostr << "<scope>" << std::endl;
55  for (const typename mmap_type::value_type& im : il)
56  ostr << im.first// << " = " << *im->second
57  << std::endl;
58  ostr << "</scope>" << std::endl;
59  }
60  return ostr <<"</overTable>" << std::endl;
61  }
62 
63 } // namespace type
64 
65 #endif // !OVERLOAD_OVER_TABLE_HXX