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

Look up table "default" version. More...

#include <lut.hh>

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef T2 output_t

Public Member Functions

hlut_defset (const T &val, const T2 &newval)
hlut_defset_default (const T2 &defaultval)
 Set a default value.

const T2 operator() (const T &val) const

Detailed Description

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

Look up table "default" version.

If the value has not been set, return the default value.

Note:
The default value can be redefined.
See also:
hlut_def
** hlut_def<int> l; ** ** l.set(16, 64); ** ** cout << l(16) << "," // print "64," ** << l(51) << endl; // print "0" ** l.set_default(42); ** cout << l(51) << endl; // print "42" **

Definition at line 111 of file lut.hh.


Member Function Documentation

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

Get the value corresponding to the key.

Return defaultval_ if the key has not been set.

Definition at line 148 of file lut.hh.

00149       {
00150         static typename hmap_t::const_iterator i;
00151         i = hmap_.find(val);
00152         return i != hmap_.end() ? i->second : defaultval_;
00153       }

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

Register a value.

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

Definition at line 129 of file lut.hh.

Referenced by oln::morpho::internal_kill_cc_area().

00130       {
00131         hmap_[val] = newval;
00132         return *this;
00133       }


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