indexing
	description: "A mask for use with a medium poller."
	status: "See notice at end of class"
	date: "$Date$"
	revision: "$Revision$"

class interface
	POLL_MASK

create 

	make
			-- Create mask.

feature -- Initialization

	make
			-- Create mask.
	
feature -- Access

	mask: SPECIAL [CHARACTER]
			-- Special data zone
			-- (from TO_SPECIAL)
	
feature -- Measurement

	count: INTEGER
			-- Size of mask in bytes
	
feature -- Comparison

	is_equal (other: like Current): BOOLEAN
			-- Is current mask equal to other ?
		require -- from ANY
			other_not_void: other /= void
		ensure -- from ANY
			symmetric: Result implies other.is_equal (Current)
			consistent: standard_is_equal (other) implies Result
	
feature -- Status report

	is_bit_set (b: INTEGER): BOOLEAN
			-- Is the bit identified by b set ?

	is_medium_ready (s: IO_MEDIUM): BOOLEAN
			-- Is the bit identified by the medium s handle set ?
		require
			valid_medium: s /= void and then not s.is_closed
	
feature -- Status setting

	clear
			-- Blank out all bits in mask.

	clear_bit (b: INTEGER)
			-- Clear bit at position b in mask.
		ensure
			has_cleared: not is_bit_set (b)

	clear_medium (s: IO_MEDIUM)
			-- Clear bit at medium s handle position, in mask.
		require
			valid_medium: s /= void and then not s.is_closed
		ensure
			has_cleared: not is_bit_set (s.handle)

	set_bit (b: INTEGER)
			-- Set bit at position b in mask.
		ensure
			has_set: is_bit_set (b)

	set_medium (s: IO_MEDIUM)
			-- Set bit at medium s handle position, in mask.
		require
			valid_medium: s /= void and then not s.is_closed
		ensure
			has_set: is_bit_set (s.handle)
	
feature -- Duplication

	copy (other: like Current)
			-- Reinitialize by copying the characters of other.
			-- (This is also used by clone.)
		require -- from ANY
			other_not_void: other /= void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: is_equal (other)
		ensure then
			size_valid: count = other.count or else count = mask_size
	
invariant

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

end -- class POLL_MASK