Home Libraries Author Links

Abstract Map Types ElemTypeStmMap and ElemTypeStmMultiMap
[Dset: Associative Set and Map Containers]

Collaboration diagram for Abstract Map Types ElemTypeStmMap and ElemTypeStmMultiMap:

Detailed Description

Abstract map and multimap types modelling associative map and multimap containers holding objects of the configurable element type ElemType.


Modules

 Abstract Map Type Example
 NrStmMap is an example of an abstract map type with int both as key type and as mapped type and the key comparison function keyCmp().
 Abstract Multmiap Type Example
 MultiNrStmMultiMap is an example of an abstract multimap type with int both as key type and as mapped type and the key comparison function keyCmp().

Defines

#define StmMapTypeDefine(ElemType, KeyType, MappedType, keyCmpFct)
 Definition of the abstract map type ElemTypeStmMap of associative map containers holding elements of type ElemType being pairs of KeyType and MappedType objects ordered by the function keyCmpFct and definition of its abstract iterator type ElemTypeStmMapIterator.
#define StmMultiMapTypeDefine(ElemType, KeyType, MappedType, keyCmpFct)
 Definition of the abstract multimap type ElemTypeStmMultiMap of associative multimap containers holding elements of type ElemType being pairs of KeyType and MappedType objects ordered by the function keyCmpFct and definition of its abstract iterator type ElemTypeStmMultiMapIterator.


Define Documentation

#define StmMapTypeDefine ( ElemType,
KeyType,
MappedType,
keyCmpFct   ) 

Value:

StmMapAcTypeImpl_ (StmMap, ElemType, KeyType, MappedType, keyCmpFct, 0)        \
StmMapAcIteratorImpl_(StmMap, ElemType, KeyType, MappedType)                   \
StmUniqAcImpl_ (StmMap, ElemType)
Definition of the abstract map type ElemTypeStmMap of associative map containers holding elements of type ElemType being pairs of KeyType and MappedType objects ordered by the function keyCmpFct and definition of its abstract iterator type ElemTypeStmMapIterator.

Parameters:
[in] ElemType The element type of the map container.
[in] KeyType The key type of the map container.
[in] MappedType The mapped type of the map container.
[in] keyCmpFct The key comparison function of the map container.
Requires:
ElemType is a name not designating any existing type.
KeyType and MappedType are names designating existing types.
keyCmpFct shall have the signature
           int keyCmpFct (KeyType key1, KeyType key2);
and return a value less than, equal to or greater than null, if the KeyType object key1 is less than, equal to or greater than key2, respectively, thus inducing an equivalence relation on the set of objects of type KeyType as well as an equivalence relation on the set of objects of type ElemType.
Effects:
The macro defines the type ElemType as
          typedef struct ElemType ElemType;
          struct ElemType
          {
              KeyType key;
              MappedType val;
          };
and the corresponding type ElemTypeStmMapValueType as
          typedef struct ElemTypeStmMapValueType ElemTypeStmMapValueType;
          struct ElemTypeStmMapValueType
          {
              const KeyType key;
              MappedType val;
          };
Using these types the macro defines the abstract map type ElemTypeStmMap of associative map containers holding elements of type ElemType which are stored in ascending order according to the key comparison function keyCmpFct.
Moreover, the macro defines the abstract iterator type ElemTypeStmMapIterator by means of which elements contained in a map container object can be referenced.
Abstract map types have the element uniqueness property, meaning that an associative map container cannot hold any two different elements being equivalent with respect to the equivalence relation induced by keyCmpFct.
Note:
For an example documenting all method functions of an abstract map type and its iterator type see Abstract Map Type Example.
See also:
StmSetTypeDefine, StmMultiSetTypeDefine, StmMultiMapTypeDefine
Examples:
dsettst.c.

Definition at line 278 of file dset.h.

#define StmMultiMapTypeDefine ( ElemType,
KeyType,
MappedType,
keyCmpFct   ) 

Value:

StmMapAcTypeImpl_ (StmMultiMap, ElemType, KeyType, MappedType, keyCmpFct, 1)   \
StmMapAcIteratorImpl_(StmMultiMap, ElemType, KeyType, MappedType)              \
StmMultAcImpl_ (StmMultiMap, ElemType)
Definition of the abstract multimap type ElemTypeStmMultiMap of associative multimap containers holding elements of type ElemType being pairs of KeyType and MappedType objects ordered by the function keyCmpFct and definition of its abstract iterator type ElemTypeStmMultiMapIterator.

Parameters:
[in] ElemType The element type of the multimap container.
[in] KeyType The key type of the multimap container.
[in] MappedType The mapped type of the multimap container.
[in] keyCmpFct The key comparison function of the multimap container.
Requires:
ElemType is a name not designating any existing type.
KeyType and MappedType are names designating existing types.
keyCmpFct shall have the signature
           int keyCmpFct (KeyType key1, KeyType key2);
and return a value less than, equal to or greater than null, if the KeyType object key1 is less than, equal to or greater than key2, respectively, thus inducing an equivalence relation on the set of objects of type KeyType as well as an equivalence relation on the set of objects of type ElemType.
Effects:
The macro defines the type ElemType as
          typedef struct ElemType ElemType;
          struct ElemType
          {
              KeyType key;
              MappedType val;
          };
and the corresponding type ElemTypeStmMultiMapValueType as
          typedef struct ElemTypeStmMultiMapValueType ElemTypeStmMultiMapValueType;
          struct ElemTypeStmMultiMapValueType
          {
              const KeyType key;
              MappedType val;
          };
Using these types the macro defines the abstract multimap type ElemTypeStmMultiMap of associative multimap containers holding elements of type ElemType which are stored in ascending order according to the key comparison function keyCmpFct.
Moreover, the macro defines the abstract iterator type ElemTypeStmMultiMapIterator by means of which elements contained in a multimap container object can be referenced.
Abstract multimap types do not have the element uniqueness property, meaning that an associative multimap container can hold several elements being equivalent with respect to the equivalence relation induced by keyCmpFct.
Note:
For an example documenting all method functions of an abstract multimap type and its iterator type see Abstract Multmiap Type Example.
See also:
StmSetTypeDefine, StmMultiSetTypeDefine, StmMapTypeDefine
Examples:
dsettst.c.

Definition at line 350 of file dset.h.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).