name: Set<class TObject> : public DoubleLinkedList;

synopsis:

g++ [flags ...] file ...

#include <Set.h>

Set(ALLOCATION alloc_d = DEF_ALLOCATION);
boolean insert(TObject* item);
boolean remove();
boolean contains(TObject* item);
const TObject* getPrev() const;
quick start:

// declare a character set and add two characters into it
//
Set<Char> set;
Char item0(L'a');
Char item1(L'b');
set.insert(&item0);
set.insert(&item1);

// insert item0 again
//
set.insert(&item0);

// the length should still be 2, since two items are identical
//
if (set.length() != 2) {
  // error
}

description:

The Set class buolds a collection of unique objects. This class will only hold a single instance of each unique-valued object, so a list class is more appropriate for most cases. There is no new class data (except a memory manager) than the list class. The only difference is the way things are inserted into the set. The insert method will always insert the item in order and return false if it already exists in the set.

The user may choose whether or not the Set is used in USER-allocated or SYSTEM-allocated mode. In the SYSTEM-allocated mode, the Set class is responsible for managing the memory for the objects it contains. This implies that a copy is made each time an object is inserted to the list. In USER-allocation mode the user is responsible for allocation and deletion of the objects that are stored in the Set. in this mode, pointers to the external objects are stored, i.e. a copy is not made. the mode chosen is dependent on the user's need to trade-off speed versus complexity of object management.

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

friend classes:

examples:

notes: