|
waLBerla 7.2
|
A class for managing sets that supports the ability to define a set that represents all possible elements.
What is special about this set is the possibility to define a set that contains all possible elements:
If the equality of two sets must be tested, the operators "==" and "!=" and the member function "isEqual" can be used. If two sets must be compared in terms of size, the operators "<", ">", "<=", and ">=" and the member function "equalSize" can be used:
#include <AllSet.h>
Public Types | |
| using | ConstIter = typename std::set<T>::const_iterator |
Public Member Functions | |
| AllSet (const bool _all=false) | |
| AllSet (const T &element) | |
| void | invert () |
| AllSet< T > | getComplement () const |
| void | insert (const T &element) |
| void | clear () |
| const AllSet< T > & | operator&= (const AllSet< T > &set) |
| intersection | |
| const AllSet< T > & | operator+= (const AllSet< T > &set) |
| union | |
| const AllSet< T > & | operator-= (const AllSet< T > &set) |
| difference / relative complement | |
| bool | operator< (const AllSet< T > &set) const |
| compares the size (not the content!) of two sets | |
| bool | operator> (const AllSet< T > &set) const |
| compares the size (not the content!) of two sets | |
| bool | operator<= (const AllSet< T > &set) const |
| compares the size (not the content!) of two sets | |
| bool | operator>= (const AllSet< T > &set) const |
| compares the size (not the content!) of two sets | |
| bool | equalSize (const AllSet< T > &set) const |
| compares the size (not the content!) of two sets | |
| bool | intersects (const AllSet< T > &set) const |
| Returns true only if there is an intersection between "this" and "set". | |
| bool | contains (const AllSet< T > &set) const |
| Returns true only if "set" is a strict subset of "this". | |
| bool | contains (const T &element) const |
| Returns true only if the element "element" is included in this set. | |
| bool | isEqual (const AllSet< T > &set) const |
| bool | isUniverse () const |
| bool | isEmpty () const |
| bool | isAll () const |
| bool | isCountable () const |
| void | toStream (std::ostream &os) const |
| std::string | toString () const |
| ConstIter | begin () const |
| ConstIter | end () const |
Static Public Member Functions | |
| static const AllSet< T > & | all () |
| static const AllSet< T > & | emptySet () |
Private Attributes | |
| bool | all_ |
| true if the set represents a set of all possible elements (= "the universe" / the complement of the empty set) | |
| std::set< T > | set_ |
Friends | |
| AllSet< T > | operator& (const AllSet &a, const AllSet &b) |
| intersection | |
| AllSet< T > | operator+ (const AllSet &a, const AllSet &b) |
| union | |
| AllSet< T > | operator- (const AllSet &a, const AllSet &b) |
| difference / relative complement | |
| bool | operator== (const AllSet &a, const AllSet &b) |
| compares the content of two sets | |
| bool | operator!= (const AllSet &a, const AllSet &b) |
| compares the content of two sets | |
| using walberla::AllSet< T >::ConstIter = typename std::set<T>::const_iterator |
|
inlineexplicit |
|
inline |
|
inlinestatic |
|
inline |
|
inline |
| bool walberla::AllSet< T >::contains | ( | const AllSet< T > & | set | ) | const |
Returns true only if "set" is a strict subset of "this".
|
inline |
Returns true only if the element "element" is included in this set.
|
inlinestatic |
|
inline |
|
inline |
compares the size (not the content!) of two sets
Returns true only if there are as many elements in "this" set as there are elements in the set "set".
|
inline |
|
inline |
| bool walberla::AllSet< T >::intersects | ( | const AllSet< T > & | set | ) | const |
Returns true only if there is an intersection between "this" and "set".
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| const AllSet< T > & walberla::AllSet< T >::operator&= | ( | const AllSet< T > & | set | ) |
intersection
Calculates the intersection of "this" and "set", only the resulting set is kept.
| const AllSet< T > & walberla::AllSet< T >::operator+= | ( | const AllSet< T > & | set | ) |
union
Calculates the union of "this" and "set", only the resulting set is kept.
| const AllSet< T > & walberla::AllSet< T >::operator-= | ( | const AllSet< T > & | set | ) |
difference / relative complement
Calculates the difference of "this" and "set", only the resulting set (result = this - set) is kept.
| bool walberla::AllSet< T >::operator< | ( | const AllSet< T > & | set | ) | const |
compares the size (not the content!) of two sets
Returns true only if there are less elements in "this" set than in the set "set".
|
inline |
compares the size (not the content!) of two sets
| bool walberla::AllSet< T >::operator> | ( | const AllSet< T > & | set | ) | const |
compares the size (not the content!) of two sets
Returns true only if there are more elements in "this" set than in the set "set".
|
inline |
compares the size (not the content!) of two sets
| void walberla::AllSet< T >::toStream | ( | std::ostream & | os | ) | const |
|
inline |
compares the content of two sets
intersection
union
difference / relative complement
compares the content of two sets
|
private |
true if the set represents a set of all possible elements (= "the universe" / the complement of the empty set)
|
private |