rutz::assoc_array< value_t > Class Template Reference

rutz::assoc_array is a typesafe wrapper of rutz::assoc_array_base. More...

#include <rutz/assocarray.h>

Collaboration diagram for rutz::assoc_array< value_t >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 assoc_array (const char *descr, bool nocase=false)
 Default constructor.
rutz::fstring get_known_keys (const char *sep) const
 Get a string listing of known keys, separated by the string sep.
void throw_for_key (const char *key, const rutz::file_pos &pos) const
 Raise an exception reporting an unknown key.
void throw_for_key (const rutz::fstring &key, const rutz::file_pos &pos) const
 Raise an exception reporting an unknown key.
value_t * get_ptr_for_key (const rutz::fstring &key) const
 Get the object associated with the given key.
value_t * get_ptr_for_key (const char *key) const
 Get the object associated with the given key.
void set_ptr_for_key (const char *key, value_t *ptr)
 Associate the object at ptr with the given key.

Detailed Description

template<class value_t>
class rutz::assoc_array< value_t >

rutz::assoc_array is a typesafe wrapper of rutz::assoc_array_base.

Definition at line 104 of file assocarray.h.


Constructor & Destructor Documentation

template<class value_t>
rutz::assoc_array< value_t >::assoc_array ( const char *  descr,
bool  nocase = false 
) [inline]

Default constructor.

Parameters:
descr a human-readable description of what this array's keys represent; this is used in error messages, e.g. if descr is "frobnicator", then error messages would include "unknown frobnicator"
nocase true if the array should use case-insensitive string comparisons (default is false, giving normal case-sensitive string comparisons)

Definition at line 117 of file assocarray.h.


Member Function Documentation

template<class value_t>
rutz::fstring rutz::assoc_array< value_t >::get_known_keys ( const char *  sep  )  const [inline]

Get a string listing of known keys, separated by the string sep.

Definition at line 121 of file assocarray.h.

Referenced by rutz::factory< nub::ref< P > >::get_known_keys().

template<class value_t>
value_t* rutz::assoc_array< value_t >::get_ptr_for_key ( const char *  key  )  const [inline]

Get the object associated with the given key.

Definition at line 139 of file assocarray.h.

template<class value_t>
value_t* rutz::assoc_array< value_t >::get_ptr_for_key ( const rutz::fstring key  )  const [inline]

Get the object associated with the given key.

Definition at line 135 of file assocarray.h.

Referenced by rutz::factory< nub::ref< P > >::find_creator(), and rutz::factory< nub::ref< P > >::register_alias().

template<class value_t>
void rutz::assoc_array< value_t >::set_ptr_for_key ( const char *  key,
value_t *  ptr 
) [inline]

Associate the object at ptr with the given key.

Definition at line 143 of file assocarray.h.

Referenced by rutz::factory< nub::ref< P > >::register_alias(), and rutz::factory< nub::ref< P > >::register_creator().

template<class value_t>
void rutz::assoc_array< value_t >::throw_for_key ( const rutz::fstring key,
const rutz::file_pos pos 
) const [inline]

Raise an exception reporting an unknown key.

Definition at line 130 of file assocarray.h.

template<class value_t>
void rutz::assoc_array< value_t >::throw_for_key ( const char *  key,
const rutz::file_pos pos 
) const [inline]

Raise an exception reporting an unknown key.

Definition at line 125 of file assocarray.h.

Referenced by rutz::factory< nub::ref< P > >::new_checked_object().


The documentation for this class was generated from the following file:
Generated on Sun May 8 08:44:43 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3