Emulates a mathematical set, providing several standard set operations. More...
#include <set.h>


Public Member Functions | |
| set (int num=0, const contents *init=NIL, basis::un_short flags=basis::array< contents >::EXPONE) | |
| Constructs a set with "num" elements, copying them from "init". | |
| ~set () | |
| Destroys any storage held for the set. | |
| int | elements () const |
| Returns the number of elements in this set. | |
| bool | empty () const |
| Returns true if the set has no elements. | |
| bool | non_empty () const |
| Returns true if the set has some elements. | |
| void | clear () |
| Empties out this set. | |
| bool | member (const contents &to_test) const |
| Returns true if the item "to_test" is a member of this set. | |
| bool | add (const contents &to_add) |
| Adds a new element "to_add" to the set. | |
| set & | operator+= (const contents &to_add) |
| An algebraic operator synonym for add() that operates on the contents. | |
| set & | operator+= (const set &to_add) |
| An algebraic operator synonym for add() that operates on a set. | |
| bool | remove (const contents &to_remove) |
| Removes the item "to_remove" from the set. | |
| set & | operator-= (const contents &to_zap) |
| An algebraic operator synonym for remove that operates on the contents. | |
| set & | operator-= (const set &to_zap) |
| An algebraic operator synonym for remove that operates on a set. | |
| set | set_union (const set &union_with) const |
| Implements the set union of "this" with "union_with". | |
| void | unionize (const set &union_with) |
| Makes "this" set a union of "this" and "union_with". | |
| set | operator+ (const set &uw) const |
| A synonym for set_union. | |
| set | intersection (const set &intersect_with) const |
| Returns the intersection of "this" with the set in "intersect_with". | |
| set | operator* (const set &iw) const |
| A synonym for intersection. | |
| set | difference (const set &differ_with) const |
| Returns the difference of this with "differ_with". | |
| void | differentiate (const set &differ_with) |
| Makes "this" set equal to the difference of "this" and "differ_with". | |
| set | operator- (const set &dw) const |
| A synonym for difference. | |
| int | find (const contents &to_find) const |
| Returns the integer index of the item "to_find" in this set. | |
| bool | remove_index (int index) |
| Zaps the entry at the specified "index". | |
Emulates a mathematical set, providing several standard set operations.
Note: this is not an efficient object and it should not be used for sets of non-trivial sizes.
Definition at line 35 of file set.h.
| structures::set< contents >::set | ( | int | num = 0, |
|
| const contents * | init = NIL, |
|||
| basis::un_short | flags = basis::array<contents>::EXPONE | |||
| ) | [inline] |
| structures::set< contents >::~set | ( | ) | [inline] |
| bool structures::set< contents >::add | ( | const contents & | to_add | ) | [inline] |
Adds a new element "to_add" to the set.
This always succeeds, but will return true if the item was not already present.
Definition at line 232 of file set.h.
References basis::array< contents >::concatenate(), and structures::set< contents >::member().
Referenced by structures::pointer_hash< contents >::add(), structures::int_hash< contents >::add(), processes::process_control::find_process_in_list(), textual::list_parsing::get_ids_from_string(), structures::set< octopus_request_id >::operator+=(), structures::set< contents >::set_union(), structures::set< contents >::unionize(), and structures::unpack().
| void structures::set< contents >::clear | ( | ) | [inline] |
Empties out this set.
Definition at line 55 of file set.h.
Referenced by processes::process_control::find_process_in_list(), textual::list_parsing::get_ids_from_string(), structures::pointer_hash< contents >::reset(), structures::int_hash< contents >::reset(), and structures::unpack().
| set< contents > structures::set< contents >::difference | ( | const set< contents > & | differ_with | ) | const [inline] |
Returns the difference of this with "differ_with".
Difference is defined as the subset of elements in "this" that are not also in "differ_with".
Definition at line 293 of file set.h.
References structures::set< contents >::member(), and structures::set< contents >::remove().
Referenced by structures::set< octopus_request_id >::operator-().
| void structures::set< contents >::differentiate | ( | const set< contents > & | differ_with | ) | [inline] |
Makes "this" set equal to the difference of "this" and "differ_with".
That is, after the call, "this" will only contain elements that were not also in "differ_with".
Definition at line 304 of file set.h.
References structures::set< contents >::member().
Referenced by structures::set< octopus_request_id >::operator-=().
| int structures::set< contents >::elements | ( | ) | const [inline] |
Returns the number of elements in this set.
Definition at line 47 of file set.h.
Referenced by structures::pointer_hash< contents >::apply(), structures::int_hash< contents >::apply(), processes::mailbox::apply(), configuration::config_watcher::changed_items(), configuration::config_watcher::changed_sections(), structures::set< octopus_request_id >::empty(), structures::set< contents >::find(), structures::set< contents >::intersection(), application::launch_manager::launch_now(), processes::mailbox::limit_boxes(), structures::set< contents >::member(), structures::set< octopus_request_id >::non_empty(), structures::pack(), structures::set< contents >::remove(), processes::mailbox::show(), structures::symbol_table_compare(), structures::memory_limiter::text_form(), configuration::system_values::text_form(), and application::launch_manager::zap_process().
| bool structures::set< contents >::empty | ( | ) | const [inline] |
| int structures::set< contents >::find | ( | const contents & | to_find | ) | const [inline] |
Returns the integer index of the item "to_find" in this set.
This returns a negative number if the index cannot be found. Note that this only makes sense within our particular implementation of set as an array.
Definition at line 240 of file set.h.
References structures::set< contents >::elements().
| set< contents > structures::set< contents >::intersection | ( | const set< contents > & | intersect_with | ) | const [inline] |
Returns the intersection of "this" with the set in "intersect_with".
Definition at line 260 of file set.h.
References basis::array< contents >::concatenate(), structures::set< contents >::elements(), basis::array< contents >::flags(), and NIL.
Referenced by configuration::config_watcher::changed_items(), configuration::config_watcher::changed_sections(), and structures::set< octopus_request_id >::operator*().
| bool structures::set< contents >::member | ( | const contents & | to_test | ) | const [inline] |
Returns true if the item "to_test" is a member of this set.
Definition at line 223 of file set.h.
References structures::set< contents >::elements().
Referenced by structures::set< contents >::add(), structures::set< contents >::difference(), structures::set< contents >::differentiate(), sockets::socket_minder::handle_pending_connecters(), application::launch_manager::launch_now(), application::launch_manager::push_timed_activities(), processes::post_office::route_listed(), sockets::socket_minder::zap_pending_server(), and application::launch_manager::zap_process().
| bool structures::set< contents >::non_empty | ( | ) | const [inline] |
| set structures::set< contents >::operator* | ( | const set< contents > & | iw | ) | const [inline] |
| set structures::set< contents >::operator+ | ( | const set< contents > & | uw | ) | const [inline] |
| set& structures::set< contents >::operator+= | ( | const set< contents > & | to_add | ) | [inline] |
| set& structures::set< contents >::operator+= | ( | const contents & | to_add | ) | [inline] |
An algebraic operator synonym for add() that operates on the contents.
Reimplemented from basis::array< contents >.
| set structures::set< contents >::operator- | ( | const set< contents > & | dw | ) | const [inline] |
| set& structures::set< contents >::operator-= | ( | const set< contents > & | to_zap | ) | [inline] |
| set& structures::set< contents >::operator-= | ( | const contents & | to_zap | ) | [inline] |
| bool structures::set< contents >::remove | ( | const contents & | to_remove | ) | [inline] |
Removes the item "to_remove" from the set.
If it was not present, false is returned and the set is unchanged.
Definition at line 249 of file set.h.
References structures::set< contents >::elements(), and basis::array< contents >::zap().
Referenced by structures::pointer_hash< contents >::acquire(), structures::int_hash< contents >::acquire(), structures::pointer_hash< contents >::apply(), structures::int_hash< contents >::apply(), structures::set< contents >::difference(), structures::pointer_hash< contents >::zap(), structures::int_hash< contents >::zap(), and sockets::socket_minder::zap_pending_server().
| bool structures::set< contents >::remove_index | ( | int | index | ) | [inline] |
| set< contents > structures::set< contents >::set_union | ( | const set< contents > & | union_with | ) | const [inline] |
Implements the set union of "this" with "union_with".
This returns the set formed from the union of "this" set with the set specified in "union_with". (unfortunately, the name "set_union" must be used to distinguish from the C keyword "union".)
Definition at line 277 of file set.h.
References structures::set< contents >::add().
Referenced by structures::set< octopus_request_id >::operator+().
| void structures::set< contents >::unionize | ( | const set< contents > & | union_with | ) | [inline] |
Makes "this" set a union of "this" and "union_with".
Definition at line 286 of file set.h.
References structures::set< contents >::add().
Referenced by structures::set< octopus_request_id >::operator+=().
1.6.3