indexing
	description: "Facility to track references of an object."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	WEL_REFERENCE_TRACKABLE

feature -- Removal

	delete
			-- Destroy the inner structure of Current.
			--
			-- Call this function when Current is no more needed
		require
			reference_not_tracked: not reference_tracked
		ensure
			destroyed: not shared implies not exists
	
feature -- Status Report

	exists: BOOLEAN
			-- Is Current valid?

	reference_tracked: BOOLEAN
			-- Are the number references of Current tracked?

	references_count: INTEGER
			-- Number of object referring this object.

	shared: BOOLEAN
			-- Is item shared by another object?
			-- If False (by default), item will
			-- be destroyed by destroy_item.
			-- If True, item will not be destroyed.
	
feature -- Status Setting

	decrement_reference
			-- Decrement the number of references to this object.
			--
			-- When the number of references reach zero,
			-- delete is called if the object is not protected.
		require
			exists: exists
			tracking_references_started: reference_tracked

	enable_reference_tracking
			-- Set references_tracked to True.
			--
		require
			exists: exists
			tracking_reference_not_started: not reference_tracked

	increment_reference
			-- Increment the number of references to this object.
		require
			exists: exists
			tracking_references_started: reference_tracked

	object_id: INTEGER
			-- Runtime Id of Current.
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

end -- class WEL_REFERENCE_TRACKABLE