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

 hlut ()
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>
hlut& oln::level::hlut< T, T2 >::set ( const T &  val,
const T2 &  newval 
) [inline]

Register a value.

Definition at line 70 of file lut.hh.

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

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       }


The documentation for this class was generated from the following file:
Generated on Tue Feb 20 20:27:29 2007 for Olena by  doxygen 1.5.1