#include <consecutive_set.h>
Classes | |
| class | empty_set_exception |
| Exception that will be thrown if trying to retrieve values from an empty set. More... | |
| class | subset_t |
| Internal representation of a number of consecutive values. | |
Public Member Functions | |
| consecutive_set () | |
| Initializes an empty set. | |
| consecutive_set (T start, T end) | |
| Initializes a set with a range of consecutive values. | |
| void | swap (consecutive_set &set) |
| Swap contents of two sets. | |
| std::ostream & | print (std::ostream &os) const |
| Print contents of set to output stream. | |
| bool | is_consistent () const |
| Checks consistency of the objects internal structures. | |
| consecutive_set | sum (const consecutive_set &set) const |
| Calculate union with other set. | |
| void | sum_update (const consecutive_set &set) |
| Update set to contain union with other set. | |
| consecutive_set | intersection (const consecutive_set &set) const |
| Calculate intersection with other set. | |
| void | intersection_update (const consecutive_set &set) |
| Update set to contain intersection with other set. | |
| consecutive_set | diff (const consecutive_set &set) const |
| Calculate difference to other set. | |
| void | diff_update (const consecutive_set &set) |
| Update set to contain difference to other set. All value that exist in both sets will be removed from the set. | |
| consecutive_set | symdiff (const consecutive_set &set) const |
| Calculate symmetric difference to other set. | |
| void | symdiff_update (const consecutive_set &set) |
| Update set to contain symmetric difference to other set. Removes all values that exist in both sets and add those that only existed in the second set. | |
| bool | is_subset (const consecutive_set &set) const |
| Check if set is a subset. The set is a subset to the other set if all values in the set exists in the other set. | |
| bool | is_superset (const consecutive_set &set) const |
| Check if set is a superset. The set is a superset to the other set if all values in the other set exists in the set. | |
| void | add (T value) |
| Add a single value to set. Nothing will be changed if a value that already exists in the set is added again. | |
| void | remove (T value) |
| Remove a value from the set. The value that is to be removed must exist in the set or an assertion will fail. | |
| bool | contains (T value) const |
| Check if a value exists in the set. | |
| T | pop () |
| Remove and return a value from the set. Throws exception if the set is empty. | |
| T | pop (const consecutive_set &constraints) |
| Remove and return a value from a set and within constraints. Will return the smallest value found in the intersection of the set and constraints set, and throws an empty_set_exception if that set is empty. | |
| consecutive_set | pop (T num_values) |
| Remove and return a subset. Will return the smallest values found in the set. May return less than the number of requested values. | |
| consecutive_set | pop (T num_values, const consecutive_set &constraints) |
| Remove and return values from a set and within constraints. Will return the smallest values found in the intersection of the set and constraints set. May return less than the number of requested values. | |
| T | pop_back () |
| Remove and return a value from the set. Throws exception if the set is empty. | |
| T | pop_back (const consecutive_set &constraints) |
| Remove and return a value from a set and within constraints. Will return the highest value found in the intersection of the set and constraints set, and throws an empty_set_exception if that set is empty. | |
| consecutive_set | pop_back (T num_values) |
| Remove and return a subset. Will return the highest values found in the set. May return less than the number of requested values. | |
| consecutive_set | pop_back (T num_values, const consecutive_set &constraints) |
| Remove and return values from a set and within constraints. Will return the highest values found in the intersection of the set and constraints set. May return less than the number of requested values. | |
| void | clear () |
| Empties the set. | |
| T | size () const |
| Returns the number of values in the set. | |
| bool | operator<= (const consecutive_set &set) const |
| Checks if the set is a subset. | |
| bool | operator>= (const consecutive_set &set) const |
| Checks if the set is a superset. | |
| consecutive_set & | operator|= (const consecutive_set &set) |
| Update set to contain the union of the two sets. | |
| consecutive_set & | operator|= (T value) |
| Update set to contain the union of the set and the value. | |
| consecutive_set | operator| (const consecutive_set &set) const |
| Return a new set containing the union of the two sets. | |
| consecutive_set & | operator&= (const consecutive_set &set) |
| Update set to contain the intersection of the two sets. | |
| consecutive_set | operator& (const consecutive_set &set) const |
| Return a new set containing the intersection of the two sets. | |
| consecutive_set & | operator-= (const consecutive_set &set) |
| Update set to contain the difference of the two sets. | |
| consecutive_set & | operator-= (T value) |
| Update set to contain the difference of the set and the value. | |
| consecutive_set | operator- (const consecutive_set &set) const |
| Return a new set containing the difference of the two sets. | |
| consecutive_set & | operator^= (const consecutive_set &set) |
| Update set to contain the symmetric difference of the two sets. | |
| consecutive_set | operator^ (const consecutive_set &set) const |
| Return a new set containing the symmetric difference of the two sets. | |
| consecutive_set< T >::consecutive_set | ( | T | start, | |
| T | end | |||
| ) | [inline] |
Initializes a set with a range of consecutive values.
| start | First value in set | |
| end | Last value in set |
| void consecutive_set< T >::add | ( | T | value | ) | [inline] |
Add a single value to set. Nothing will be changed if a value that already exists in the set is added again.
| value | Value that shall be added to the set |
| bool consecutive_set< T >::contains | ( | T | value | ) | const [inline] |
Check if a value exists in the set.
| value | Value to inspect |
| consecutive_set< T > consecutive_set< T >::diff | ( | const consecutive_set< T > & | set | ) | const [inline] |
Calculate difference to other set.
| set | Second set containing values to be removed from the new set |
| void consecutive_set< T >::diff_update | ( | const consecutive_set< T > & | set | ) | [inline] |
Update set to contain difference to other set. All value that exist in both sets will be removed from the set.
| set | Second set containing values to be removed from the set |
| consecutive_set< T > consecutive_set< T >::intersection | ( | const consecutive_set< T > & | set | ) | const [inline] |
Calculate intersection with other set.
| set | Second set used for calculation of the intersection |
| void consecutive_set< T >::intersection_update | ( | const consecutive_set< T > & | set | ) | [inline] |
Update set to contain intersection with other set.
| set | Second set used for calculation of the intersection |
| bool consecutive_set< T >::is_consistent | ( | ) | const [inline] |
Checks consistency of the objects internal structures.
| bool consecutive_set< T >::is_subset | ( | const consecutive_set< T > & | set | ) | const [inline] |
Check if set is a subset. The set is a subset to the other set if all values in the set exists in the other set.
| set | Other set |
| bool consecutive_set< T >::is_superset | ( | const consecutive_set< T > & | set | ) | const [inline] |
Check if set is a superset. The set is a superset to the other set if all values in the other set exists in the set.
| set | Other set |
| consecutive_set< T > consecutive_set< T >::operator& | ( | const consecutive_set< T > & | set | ) | const [inline] |
| consecutive_set< T > & consecutive_set< T >::operator&= | ( | const consecutive_set< T > & | set | ) | [inline] |
| consecutive_set< T > consecutive_set< T >::operator- | ( | const consecutive_set< T > & | set | ) | const [inline] |
| consecutive_set< T > & consecutive_set< T >::operator-= | ( | T | value | ) | [inline] |
| consecutive_set< T > & consecutive_set< T >::operator-= | ( | const consecutive_set< T > & | set | ) | [inline] |
| bool consecutive_set< T >::operator<= | ( | const consecutive_set< T > & | set | ) | const [inline] |
| bool consecutive_set< T >::operator>= | ( | const consecutive_set< T > & | set | ) | const [inline] |
| consecutive_set< T > consecutive_set< T >::operator^ | ( | const consecutive_set< T > & | set | ) | const [inline] |
| consecutive_set< T > & consecutive_set< T >::operator^= | ( | const consecutive_set< T > & | set | ) | [inline] |
| consecutive_set< T > consecutive_set< T >::operator| | ( | const consecutive_set< T > & | set | ) | const [inline] |
| consecutive_set< T > & consecutive_set< T >::operator|= | ( | T | value | ) | [inline] |
| consecutive_set< T > & consecutive_set< T >::operator|= | ( | const consecutive_set< T > & | set | ) | [inline] |
| consecutive_set< T > consecutive_set< T >::pop | ( | T | num_values, | |
| const consecutive_set< T > & | constraints | |||
| ) | [inline] |
Remove and return values from a set and within constraints. Will return the smallest values found in the intersection of the set and constraints set. May return less than the number of requested values.
| num_values | Requested number of values | |
| constraints | Constraints set that returned set must a subset of. |
| consecutive_set< T > consecutive_set< T >::pop | ( | T | num_values | ) | [inline] |
Remove and return a subset. Will return the smallest values found in the set. May return less than the number of requested values.
| num_values | Requested number of values |
| T consecutive_set< T >::pop | ( | const consecutive_set< T > & | constraints | ) | [inline] |
Remove and return a value from a set and within constraints. Will return the smallest value found in the intersection of the set and constraints set, and throws an empty_set_exception if that set is empty.
| constraints | Constraints set that returned value must be found in. |
| T consecutive_set< T >::pop | ( | ) | [inline] |
Remove and return a value from the set. Throws exception if the set is empty.
| consecutive_set< T > consecutive_set< T >::pop_back | ( | T | num_values, | |
| const consecutive_set< T > & | constraints | |||
| ) | [inline] |
Remove and return values from a set and within constraints. Will return the highest values found in the intersection of the set and constraints set. May return less than the number of requested values.
| num_values | Requested number of values | |
| constraints | Constraints set that returned set must a subset of. |
| consecutive_set< T > consecutive_set< T >::pop_back | ( | T | num_values | ) | [inline] |
Remove and return a subset. Will return the highest values found in the set. May return less than the number of requested values.
| num_values | Requested number of values |
| T consecutive_set< T >::pop_back | ( | const consecutive_set< T > & | constraints | ) | [inline] |
Remove and return a value from a set and within constraints. Will return the highest value found in the intersection of the set and constraints set, and throws an empty_set_exception if that set is empty.
| constraints | Constraints set that returned value must be found in. |
| T consecutive_set< T >::pop_back | ( | ) | [inline] |
Remove and return a value from the set. Throws exception if the set is empty.
| std::ostream & consecutive_set< T >::print | ( | std::ostream & | os | ) | const [inline] |
Print contents of set to output stream.
| os | Output stream |
| void consecutive_set< T >::remove | ( | T | value | ) | [inline] |
Remove a value from the set. The value that is to be removed must exist in the set or an assertion will fail.
| value | Value to be removed from the set |
| consecutive_set< T > consecutive_set< T >::sum | ( | const consecutive_set< T > & | set | ) | const [inline] |
Calculate union with other set.
| set | Second set used for calculation of the union |
| void consecutive_set< T >::sum_update | ( | const consecutive_set< T > & | set | ) | [inline] |
Update set to contain union with other set.
| set | Second set used for calculation of the union |
| void consecutive_set< T >::swap | ( | consecutive_set< T > & | set | ) | [inline] |
Swap contents of two sets.
| set | Other set that will exchange values |
| consecutive_set< T > consecutive_set< T >::symdiff | ( | const consecutive_set< T > & | set | ) | const [inline] |
Calculate symmetric difference to other set.
| set | Second set |
| void consecutive_set< T >::symdiff_update | ( | const consecutive_set< T > & | set | ) | [inline] |
Update set to contain symmetric difference to other set. Removes all values that exist in both sets and add those that only existed in the second set.
| set | Second set |
1.5.7