note
	description: "[
		Abstraction for weak references, i.e. references to object that can still be reclaimed by the GC.
		If the actual generic parameter is expanded, put cannot be used as it does not make sense from the user
		point of view.
	]"
	status: "See notice at end of class."
	library: "Free implementation of ELKS library"
	legal: "See notice at end of class."
	date: "$Date: 2013-05-20 23:15:17 +0000 (Mon, 20 May 2013) $"
	revision: "$Revision: 92557 $"

class interface
	WEAK_REFERENCE [G]

create 
	default_create,
	put

feature -- Initialization

	put (v: G)
			-- New weak reference to v.
		require
			v_not_void: v /= Void
			not_expanded: not ({G}).is_expanded
		ensure
			item_set: item = v
	
feature -- Removal

	clear
			-- Remove existing weak reference.
		ensure then
			removed: not exists
	
feature -- Access

	item: detachable G
			-- Current reference if still alive. Void otherwise
		require
			not_expanded: not ({G}).is_expanded
	
feature -- Status report

	exists: BOOLEAN
			-- Is current reference still alive?
		ensure
			not_present: not Result implies item = Void
	
note
	copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class WEAK_REFERENCE

Generated by ISE EiffelStudio