General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
|
Abstract data types to be used in specifications
This C module implements sets of small
nonnegative integral values by values of an unsigned type
that is determined on instantiation of the module.
The maximal element value depends on the number of bits used for the
representation of the chosen unsigned type.
The operations provided by this module may be
used for computations on kind set values (or any other
suitable application). In the following description of the set
operations we assume that el stands for an expression that
yields an integer being a set element, and s, s1, s2 stand
for expressions yielding sets.
The module is instantiated by
$/Adt/IntSet.gnrc +instance=NAME +referto=TYPE :inst
where NAME identifies the IntSet instance and TYPE
specifies the type used for representing set values.
If the referto parameter is specified to be TYPE , then
unsigned TYPE has to be a valid integral C type.
Examples for the referto parameter are short , int ,
or 'long int' . If the referto parameter is omitted
int is assumed. The instance parameter may be omitted
if there is only one instance of this module.
All entities exported by this module can be used in specifications
of type .lido , .init , .finl , and .con .
They can also be used in .pdl specifications or in C modules
if the interface file NAMEIntSet.h is imported there.
The module exports the following type names and macros
(all names are prefixed by the value NAME of the instance
parameter):
NAMEIntSet
- the type representing sets.
NAMENULLIS
- the unique value for an empty set.
NAMENullIS()
- a macro with no arguments for the unique value for an empty set,
to be used where a functional notation is required as in
WITH
clauses of CONSTITUENTS .
The following operations for set processing are supplied by the module.
It is indicated whether an operation is implemented by a function
or by a macro. The macros do not evaluate any argument repeatedly.
NAMEIntSet NAMESingleIS (int el)
- Yields a singleton set containing
el ;
a message is issued if el is not a valid element.
(function)
NAMEIntSet NAMEAddElIS (int el, NAMEIntSet s)
- Yields the union of
NAMESingleIS(el) and s ;
a message is issued if el is not a valid element.
(function)
NAMEIntSet NAMEConsIS (int el, NAMEIntSet s)
- Yields the union of
NAMESingleIS(el) and s ;
validity of el is not checked.
(macro)
int NAMEInIS (int el, NAMEIntSet s)
- Yields 1 iff
el is in s ;
a message is issued if el is not a valid element.
(function)
NAMEIntSet NAMEUniteIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields the union of
s1 and s2 .
(macro)
NAMEIntSet NAMESubIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields
s1 minus s2 .
(macro)
NAMEIntSet NAMEInterIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields the intersection of
s1 and s2 .
(macro)
int NAMEDisjIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields 1 iff
s1 and s2 are disjoint.
(macro)
int NAMEInclIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields 1 iff
s1 is a subset of s2 .
(function)
int NAMEEqualIS (NAMEIntSet s1, NAMEIntSet s2)
- Yields 1 iff
s1 is equal to s2 .
(macro)
int NAMEEmptyIS (NAMEIntSet s)
- Yields 1 iff
s is empty.
(macro)
int NAMECardIS (NAMEIntSet s)
- Yields the number of elements in
s .
(function)
|