Definition
An instance S of the data type KeySet is a collection of elements of the data type AgdKey with an associated keymapper mapper. All keys stored in S must be allocated by mapper.
#include < AGD/KeySet.h >
Creation
| KeySet | S | creates an instances S of type KeySet initialized to the empty set. Sets the associated keymapper to the default keymapper of AGD. |
| KeySet | S(const Keymapper& M) | creates an instances S of type KeySet with associated keymapper M initialized to the empty set. |
| KeySet | S(const KeySet& T) | creates an instances S of type KeySet initialized to a copy of T. |
Operations
| const Keymapper * | S.get_keymapper() | returns the associated keymapper. |
a) Common Set Operations
| void | S.insert(const AgdKey& k) | adds k to S. |
| void | S.del(const AgdKey& k) | deletes k from S. |
| bool | S.member(const AgdKey& k) | returns true iff k |
| KeySet | S.join(const KeySet& T) | returns S |
| KeySet | S.diff(const KeySet& T) | returns
S |
| KeySet | S.intersect(const KeySet& T) | |
| returns S |
||
| KeySet | S.symdiff(const KeySet& T) | |
| returns
(S |
||
| bool | S.empty() | returns true iff
S = |
| void | S.clear() | makes S the empty set. |
b) Operators
The following operators return a new key set instead of changing
S.
| KeySet | S + const KeySet& T | returns S.join(T). |
| KeySet | S - const KeySet& T | returns S.diff(T). |
| KeySet | S & const KeySet& T | returns S.intersect(T). |
| KeySet | S |
The following operators manipulate S directly.
| KeySet& | S += const KeySet& T | assigns S.join(T) to S and returns S. |
| KeySet& | S -= const KeySet& T | assigns S.diff(T) to S and returns S. |
| KeySet& | S &= const KeySet& T | assigns S.intersect(T) to S and returns S. |
| KeySet& | S | |
| KeySet& | S << const AgdKey& k | inserts k into S and returns S. |
Relational and assignment operators:
| bool | S == const KeySet& T | return true iff S = T. |
| bool | S != const KeySet& T | return true iff S! = T. |
| bool | S <= const KeySet& T | returns true iff
S |
| bool | S >= const KeySet& T | returns true iff
S |
| KeySet& | S = const KeySet& T | assigns T to S. Returns S. |
c) Iteration
The following functions return iterators of type
KeySet::const_iterator.
d) Input and Output
Implementation
Key sets are implemented by bit vectors using an internal numbering of keys. All keys stored in a key set must be allocated by the same keymapper.
© Copyright 1998-2001, Algorithmic Solutions Software GmbH. All rights reserved.
2001-08-13