#include <OrderedSet.h>
Public Methods | |
| OrderedSet () | |
| Empty constructor that sets up an empty set. | |
| virtual | ~OrderedSet () |
| Destructor. | |
| virtual int | add (const T &val, const int unique=FALSE) |
| Adds an element to the set. | |
| virtual void | add (const OrderedSet< T > &, const int unique=FALSE) |
| Adds all of the elements from another set. | |
| virtual void | remove (T &val) |
| Removes the first element, and returns the data value in data. | |
| int | empty () const |
Returns TRUE if the set is empty and FALSE otherwise. | |
| operator int () const | |
Returns TRUE if the set is empty and FALSE otherwise. | |
| size_type | len () const |
| Returns the number of items in the set. | |
| T & | first (OrderedSetIndex &index, int &status) |
Return the first element of the set, updating index. | |
| T & | next (OrderedSetIndex &index, int &status) |
Return the next element of the set, updating index. | |
| int | index (const T &val) |
Returns the (zero-based) index of val (and -1 if not a member). | |
| int | is_member (const T &val) |
| Returns TRUE if val is a member of the set. | |
| int | is_disjoint (const OrderedSet< T > &set) |
| Returns TRUE if set is disjoint from the current set. | |
| const T & | operator[] (const int i) const |
| Accesss the i-th element of the array and returns a const. | |
| void | write (ostream &os) const |
| Write out the set to an output stream. | |
| void | read (istream &is) |
| Read the set from an input stream. | |
| void | write (PackBuffer &os) const |
| Write out the set to a pack buffer. | |
| void | read (UnPackBuffer &is) |
| Read the set from an unpack buffer. | |
Protected Attributes | |
| size_type | Len |
| The number of items in the set. | |
| BasicArray< T > | Data |
| The array used for storing the set. | |
TODO: use a hash table to make the 'index' operation efficient.