indexing description: "[ Manager for unique object IDs. ]" date: "$Date$" revision: "$Revision$" class EM_NET_OBJECT_ID_MANAGER create make feature {NONE}-- Initialisation make is -- Initialize a new object id manager. do next_id := 10 end feature -- Access set_unique_id_for_object (an_object: EM_NET_OBJECT) is -- Set a unique ID for `an_object'. do an_object.set_id (item) end feature -- Commands put (an_id: INTEGER) is -- Mark `an_id' as free for further use. do -- TODO: Implement this to enable ID recycling. This could -- be useful if you have a lot of objects with a short lifespan. end feature {NONE} -- Implementation item: INTEGER is -- An unused integer that can be used as an object ID during a network session do next_id := next_id + 1 if next_id = next_id.max_value then next_id := 0 end Result := next_id end next_id: INTEGER -- Next ID that will be assigned to an object invariant invariant_clause: True -- Your invariant here end