next up previous contents index
Next: Keymapper Iterators ( Keymapper::const_iterator Up: Pre- and Postconditions Previous: Keys ( AgdKey )   Contents   Index


Key Mappers ( Keymapper )

Definition

An instance M of type Keymapper is an injective mapping from strings to keys. We use dom(M) to denote the set of used strings, and M(s) to denote the value of M for string s. Each key has a unique index between 0 and n - 1, where n is the number of keys in M.

#include < AGD/Keymapper.h >

Creation

Keymapper M creates an instances M of type Keymapper. Sets dom(M) to the empty set.

Operations

int M.number_of_keys() returns the number of defined keys.

AgdKey M.ask_key(const leda_string& s)
    returns M(s) if s $ \in$ dom(M), nil otherwise.

AgdKey M.get_key(const leda_string& s)
    returns M(s). Creates a new key and adds s to dom(M) if s$ \notin$dom(M).

leda_string M.get_string(AgdKey k) returns the string s with M(s) = k.

const_iterator M.begin() returns an iterator pointing to first element in M.

const_iterator M.end() returns an iterator pointing to one-past-last element in M.

const_iterator M.rbegin() returns an iterator pointing to last element in M.

const_iterator M.rend() returns an iterator pointing to one-before-first element in M.


next up previous contents index
Next: Keymapper Iterators ( Keymapper::const_iterator Up: Pre- and Postconditions Previous: Keys ( AgdKey )   Contents   Index

© Copyright 1998-2001, Algorithmic Solutions Software GmbH. All rights reserved.
2001-08-13