Go to Overview over all GrAL packages.
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

partial_mapping Class Template Reference
[Components for Mappings]

A representation of a partial mapping T1 --> T2, using a default value for items not explicitely set. More...

#include <partial-mapping.h>

Collaboration diagram for partial_mapping:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T1 argument_type
typedef T2 result_type
typedef map_table_type::iterator iterator
typedef map_table_type::const_iterator const_iterator

Public Methods

 partial_mapping (const T2 &def=T2())
const T2 & set_default (const T2 &t2)
int size_of_dom () const
bool defined (const T1 &t1) const
bool undefined (const T1 &t1) const
const T2 & default_value () const
const_iterator begin () const
const_iterator end () const
T2 & operator[] (T1 const &t1)
T2 const & operator() (T1 const &t1) const

Detailed Description

template<class T1, class T2>
class partial_mapping< T1, T2 >

A representation of a partial mapping T1 --> T2, using a default value for items not explicitely set.

partial_mapping<T1,T2> is a model of Adaptable Unary Function.

Template parameters:

Invariants:

If pm is of type partial_mapping<T1,T2>, t1 of type T1 and t2 of type T2, then

Note:

statement of the form: t2 = pm[t1] would mean that the value of pm(t1) gets undefined if pm.undefined(t1) == true before! This is prohibited by returning a proxy in operator[] which only can be assigned to (i.e. occur only on the left side of an assignment).

Todo:
There should also be a corresponding domain-class and perhaps an inverse-mapping class : T2 --> P(T1)

Test directory for partial_mapping

Definition at line 58 of file partial-mapping.h.


Member Typedef Documentation

template<class T1, class T2>
typedef T1 partial_mapping::argument_type
 

Definition at line 61 of file partial-mapping.h.

template<class T1, class T2>
typedef T2 partial_mapping::result_type
 

Definition at line 62 of file partial-mapping.h.

template<class T1, class T2>
typedef map_table_type::iterator partial_mapping::iterator
 

Definition at line 105 of file partial-mapping.h.

template<class T1, class T2>
typedef map_table_type::const_iterator partial_mapping::const_iterator
 

Definition at line 106 of file partial-mapping.h.

Referenced by begin, end, and operator().


Constructor & Destructor Documentation

template<class T1, class T2>
partial_mapping< T1, T2 >::partial_mapping const T2 &    def = T2() [inline]
 

Definition at line 91 of file partial-mapping.h.


Member Function Documentation

template<class T1, class T2>
const T2& partial_mapping< T1, T2 >::set_default const T2 &    t2 [inline]
 

Definition at line 93 of file partial-mapping.h.

template<class T1, class T2>
int partial_mapping< T1, T2 >::size_of_dom   const [inline]
 

Definition at line 97 of file partial-mapping.h.

template<class T1, class T2>
bool partial_mapping< T1, T2 >::defined const T1 &    t1 const [inline]
 

Definition at line 98 of file partial-mapping.h.

template<class T1, class T2>
bool partial_mapping< T1, T2 >::undefined const T1 &    t1 const [inline]
 

Definition at line 99 of file partial-mapping.h.

Referenced by operator[].

template<class T1, class T2>
const T2& partial_mapping< T1, T2 >::default_value   const [inline]
 

Definition at line 101 of file partial-mapping.h.

template<class T1, class T2>
const_iterator partial_mapping< T1, T2 >::begin   const [inline]
 

Definition at line 109 of file partial-mapping.h.

References const_iterator.

template<class T1, class T2>
const_iterator partial_mapping< T1, T2 >::end   const [inline]
 

Definition at line 110 of file partial-mapping.h.

References const_iterator.

template<class T1, class T2>
T2& partial_mapping< T1, T2 >::operator[] T1 const &    t1 [inline]
 

Definition at line 115 of file partial-mapping.h.

References undefined.

template<class T1, class T2>
T2 const& partial_mapping< T1, T2 >::operator() T1 const &    t1 const [inline]
 

Definition at line 120 of file partial-mapping.h.

References const_iterator.


The documentation for this class was generated from the following file:
Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 15:57:16 2002 for Sequence by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000