oln::level::hlut< T, T2 > Class Template Reference

Look up table "id" version. More...

#include <lut.hh>

Collaboration diagram for oln::level::hlut< T, T2 >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T2 output_t

Public Member Functions

hlutset (const T &val, const T2 &newval)
const T2 operator() (const T &val) const

Detailed Description

template<class T, class T2 = T>
class oln::level::hlut< T, T2 >

Look up table "id" version.

If the value has not been set, return id (see the example).

See also:
hlut_def
** hlut<int> l; ** ** l.set(16, 64); ** ** cout << l(16) << "," // print 64, ** << l(51) << endl; // print 51 **

Definition at line 54 of file lut.hh.


Member Function Documentation

template<class T, class T2 = T>
const T2 oln::level::hlut< T, T2 >::operator() const T &  val  )  const [inline]
 

Get the value corresponding to the key.

Return the key if the key has not been set.

Definition at line 81 of file lut.hh.

00082       {
00083         static typename hmap_t::const_iterator i;
00084         i = hmap_.find(val);
00085         return i != hmap_.end() ? i->second : val;
00086       }

template<class T, class T2 = T>
hlut& oln::level::hlut< T, T2 >::set const T &  val,
const T2 &  newval
[inline]
 

Register a value.

  • val Key.
  • newval Value corresponding to the key.

Definition at line 70 of file lut.hh.

00071       {
00072         hmap_[val] = newval;
00073         return *this;
00074       }


The documentation for this class was generated from the following file:
Generated on Thu Apr 15 20:16:30 2004 for Olena by doxygen 1.3.6-20040222