A union of two hashed sets. More...
#include <setunion.h>
Public Types | |
| typedef set1type::value_type | value_type |
| The type of the element of each of the sets. | |
Public Member Functions | |
| setunion (const set1type &_set1, const set2type &_set2) | |
| The only allowed constructor. | |
| setunion (const setunion< set1type, set2type > &s) | |
| The copy constructor. | |
| setunion & | operator= (const setunion< set1type, set2type > &s) |
| The assignment operator. | |
| ~setunion () | |
| The destructor. | |
| const set1type & | get1 () const |
| Returns a const reference to the first set in the union. | |
| const set2type & | get2 () const |
| Returns a const reference to the second set in the union. | |
| int_t | getnumber (const typename set1type::value_type &e) const |
| Finds the given element and returns its number. | |
| bool | checknum (int_t n) const |
| Checks if the given number is an index of some element in the set union. | |
| bool | check (const typename set1type::value_type &e) const |
| Checks if the given element is in the set union. | |
| const setunion< set1type, set2type >::value_type & | operator[] (int_t n) const |
| Returns the element with the given number from the set union. | |
| const setunion< set1type, set2type >::value_type & | get (int_t n) const |
| Returns the element with the given number from the set union. | |
| int_t | size () const |
| Returns the number of elements in the set union. | |
| bool | empty () const |
| Returns true if both sets are empty. Otherwise returns false. | |
Private Attributes | |
| const set1type * | set1 |
| Reference to the first set. | |
| const set2type * | set2 |
| Reference to the second set. | |
A union of two hashed sets.
Thanks to the template style definition, it can be used to define a union of unions of sets etc., although the efficiency of this solution decreases with the increasing recursion level.
Definition at line 61 of file setunion.h.
| typedef set1type::value_type chomp::homology::setunion< set1type, set2type >::value_type |
The type of the element of each of the sets.
Definition at line 65 of file setunion.h.
| chomp::homology::setunion< set1type, set2type >::setunion | ( | const set1type & | _set1, | |
| const set2type & | _set2 | |||
| ) | [inline] |
The only allowed constructor.
Definition at line 125 of file setunion.h.
| chomp::homology::setunion< set1type, set2type >::setunion | ( | const setunion< set1type, set2type > & | s | ) | [inline] |
The copy constructor.
Definition at line 139 of file setunion.h.
{
throw "Trying to use the copy constructor of a set union.";
return;
} /* setunion::setunion */
| chomp::homology::setunion< set1type, set2type >::~setunion | ( | ) | [inline] |
| bool chomp::homology::setunion< set1type, set2type >::check | ( | const typename set1type::value_type & | e | ) | const [inline] |
| bool chomp::homology::setunion< set1type, set2type >::checknum | ( | int_t | n | ) | const [inline] |
Checks if the given number is an index of some element in the set union.
That is, checks if the number is non-negative and strictly smaller than the number of elements in the set union. Returns true if yes, false if no.
Definition at line 180 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set2, and chomp::homology::setunion< set1type, set2type >::size().
| bool chomp::homology::setunion< set1type, set2type >::empty | ( | ) | const [inline] |
Returns true if both sets are empty. Otherwise returns false.
Definition at line 217 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set1, and chomp::homology::setunion< set1type, set2type >::set2.
| const setunion< set1type, set2type >::value_type & chomp::homology::setunion< set1type, set2type >::get | ( | int_t | n | ) | const [inline] |
Returns the element with the given number from the set union.
Definition at line 194 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set1, chomp::homology::setunion< set1type, set2type >::set2, and chomp::homology::setunion< set1type, set2type >::size().
| const set1type & chomp::homology::setunion< set1type, set2type >::get1 | ( | ) | const [inline] |
Returns a const reference to the first set in the union.
Definition at line 154 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set1.
{
return *set1;
} /* setunion::get1 */
| const set2type & chomp::homology::setunion< set1type, set2type >::get2 | ( | ) | const [inline] |
Returns a const reference to the second set in the union.
Definition at line 160 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set2.
{
return *set2;
} /* setunion::get2 */
| int_t chomp::homology::setunion< set1type, set2type >::getnumber | ( | const typename set1type::value_type & | e | ) | const [inline] |
Finds the given element and returns its number.
Returns -1 if the element is not in the union of the sets.
Definition at line 167 of file setunion.h.
| setunion< set1type, set2type > & chomp::homology::setunion< set1type, set2type >::operator= | ( | const setunion< set1type, set2type > & | s | ) | [inline] |
The assignment operator.
Definition at line 147 of file setunion.h.
{
throw "Trying to use the assignment operator of a set union.";
return;
} /* setunion::setunion */
| const setunion< set1type, set2type >::value_type & chomp::homology::setunion< set1type, set2type >::operator[] | ( | int_t | n | ) | const [inline] |
Returns the element with the given number from the set union.
Definition at line 205 of file setunion.h.
{
return get (n);
} /* setunion::operator [] */
| int_t chomp::homology::setunion< set1type, set2type >::size | ( | ) | const [inline] |
Returns the number of elements in the set union.
Definition at line 211 of file setunion.h.
References chomp::homology::setunion< set1type, set2type >::set1, and chomp::homology::setunion< set1type, set2type >::set2.
Referenced by chomp::homology::setunion< set1type, set2type >::checknum(), and chomp::homology::setunion< set1type, set2type >::get().
const set1type* chomp::homology::setunion< set1type, set2type >::set1 [private] |
Reference to the first set.
Definition at line 115 of file setunion.h.
Referenced by chomp::homology::setunion< set1type, set2type >::empty(), chomp::homology::setunion< set1type, set2type >::get(), chomp::homology::setunion< set1type, set2type >::get1(), and chomp::homology::setunion< set1type, set2type >::size().
const set2type* chomp::homology::setunion< set1type, set2type >::set2 [private] |
Reference to the second set.
Definition at line 118 of file setunion.h.
Referenced by chomp::homology::setunion< set1type, set2type >::checknum(), chomp::homology::setunion< set1type, set2type >::empty(), chomp::homology::setunion< set1type, set2type >::get(), chomp::homology::setunion< set1type, set2type >::get2(), and chomp::homology::setunion< set1type, set2type >::size().
1.7.1