indexing
	description: "Asynchronous socket polling, timer-based."
	status: "See notice at end of class"
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	SOCKET_POLLER

feature -- Activation

	is_auto_discard: BOOLEAN
			-- Subscription is removed at call-back.

	is_poll_all: BOOLEAN
			-- Are all subscribed socket polled at each timer call-
			-- back or just one?

	is_poller_active: BOOLEAN
			-- Is poller called back?

	set_active (a_poll_delay: INTEGER)
			-- Activate poller timer with a_poll_delay
			-- time quantum (in milliseconds).
		require
			a_poll_delay_positive_and_not_null: a_poll_delay > 0
			poller_inactive: not is_poller_active

	set_auto_discard
			-- Poller will call back only once.

	set_inactive
			-- Disactivate poller timer.
		require
			poller_active: is_poller_active

	set_no_discard
			-- Subsciption to polling remains after call-back.

	set_poll_all
			-- All subscribed sockets will be polled at each poll
			-- delay.

	set_poll_one
			-- Only one subscribed listening socket and one service
			-- socket will be polled at each poll delay (if present).
	
feature -- Creation

	make
			-- Create internal structure of poller.

	make_active (a_poll_delay: INTEGER)
			-- Create active poller with a_poll_delay time
			-- quantum (in milliseconds).
	
feature -- Subscription

	add_accept_call_back (a_stream_socket: STREAM_SOCKET; a_command: POLL_COMMAND; an_argument: ANY)
			-- Set command	a_command to be called when
			-- a_stream_socket is connected.
		require
			stream_socket_open_read: a_stream_socket.is_open_read
			command_not_void: a_command /= void

	add_readable_call_back (a_socket: SOCKET; a_command: POLL_COMMAND; an_argument: ANY)
			-- Set command	a_command to be called when
			-- a_socket is readable.
		require
			socket_open_read: a_socket.is_open_read
			command_not_void: a_command /= void

	remove_accept_call_back (a_stream_socket: STREAM_SOCKET)
			-- Remove socket a_stream_socket from call-back list.

	remove_readable_call_back (a_socket: SOCKET)
			-- Remove socket a_socket from call-back list.

	wipe_out_all_call_backs
			-- Remove all socket call_backs from poller.
	
invariant

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

end -- class SOCKET_POLLER