    indexing
    	description: "Implementation of transfer manager builder"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-06-13 10:37:36 -0700 (Tue, 13 Jun 2006) $"
    	revision: "$Revision: 59704 $"

    class interface
    	TRANSFER_MANAGER_BUILDER_IMPL

    create
    	make
    			-- Create transfer manager builder.

    feature -- Access

    	generating_type: STRING_8
    			-- Name of current object's generating type
    			-- (type of which it is a direct instance)
    			-- (from ANY)

    	generator: STRING_8
    			-- Name of current object's generating class
    			-- (base class of the type of which it is a direct instance)
    			-- (from ANY)

    	manager: TRANSFER_MANAGER
    			-- The built manager
    		require
    			built: manager_built

    	transaction (n: INTEGER_32): TRANSACTION
    			-- `n'-th transaction
    		require
    			not_empty: not is_empty
    			index_in_range: 1 <= n and n <= count
    		ensure
    			result_exists: Result /= Void

    feature -- Measurement

    	count: INTEGER_32
    			-- Number of transactions in builder

    feature -- Comparison

    	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void
    			-- or attached to isomorphic object structures?
    			-- (from ANY)
    		ensure -- from ANY
    			shallow_implies_deep: standard_equal (some, other) implies Result
    			both_or_none_void: (some = Void) implies (Result = (other = Void))
    			same_type: (Result and (some /= Void)) implies some.same_type (other)
    			symmetric: Result implies deep_equal (other, some)

    	frozen equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached
    			-- to objects considered equal?
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

    	is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object considered
    			-- equal to current object?
    			-- (from ANY)
    		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

    	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached to
    			-- field-by-field identical objects of the same type?
    			-- Always uses default object comparison criterion.
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))

    	frozen standard_is_equal (other: like Current): BOOLEAN
    			-- Is `other' attached to an object of the same type
    			-- as current object, and field-by-field identical to it?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			same_type: Result implies same_type (other)
    			symmetric: Result implies other.standard_is_equal (Current)

    feature -- Status report

    	conforms_to (other: ANY): BOOLEAN
    			-- Does type of current object conform to type
    			-- of `other' (as per Eiffel: The Language, chapter 13)?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void

    	error: BOOLEAN
    			-- Has an error occurred?

    	error_reason: STRING_8
    			-- Reason of most recent error
    		require
    			error_occurred: error
    		ensure
    			non_empty_string: Result /= Void and then not Result.is_empty

    	host_ok (h: STRING_8): BOOLEAN
    			-- Is `h' a valid host?
    			-- (from HOST_VALIDITY_CHECKER)

    	is_address_correct (addr: STRING_8; mode: INTEGER_32): BOOLEAN
    			-- Is address `addr' correct considering `mode'?
    			-- (`mode' is Readable or Writable)
    		require
    			non_empty_address: addr /= Void and then not addr.is_empty
    			mode_valid: is_mode_valid (mode)

    	is_empty: BOOLEAN
    			-- No transaction stored in builder?

    	is_mode_valid (mode: INTEGER_32): BOOLEAN
    			-- Is `mode' valid?

    	last_added_source_correct: BOOLEAN
    			-- Is source address of the most recent transaction addition
    			-- correct?

    	last_added_target_correct: BOOLEAN
    			-- Is target address of the most recent transaction addition
    			-- correct?

    	manager_built: BOOLEAN
    			-- Has manager been built?

    	same_type (other: ANY): BOOLEAN
    			-- Is type of current object identical to type of `other'?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			definition: Result = (conforms_to (other) and other.conforms_to (Current))

    	transfer_finished: BOOLEAN
    			-- Has a transfer occurred?

    	transfer_succeeded: BOOLEAN
    			-- Has the last transfer succeeded?

    feature -- Status setting

    	reset_proxies
    			-- Reset source and target proxy.
    		ensure
    			no_source_proxy_set: source_proxy = Void
    			no_target_proxy_set: target_proxy = Void

    	reset_source_proxy
    			-- Reset source proxy.
    		ensure
    			no_source_proxy_set: source_proxy = Void

    	reset_target_proxy
    			-- Reset target proxy.
    		ensure
    			no_target_proxy_set: target_proxy = Void

    	set_proxies (host: STRING_8; port: INTEGER_32)
    			-- Set source and target proxy host to `host' and
    			-- port to `port'.
    		require
    			host_not_empty: host /= Void and then not host.is_empty
    			port_non_negative: port >= 0
    		ensure
    			source_proxy_exists: source_proxy /= Void
    			host_set: source_proxy.host = host
    			port_set: source_proxy.port = port
    			proxies_equal: source_proxy = target_proxy

    	set_source_proxy (host: STRING_8; port: INTEGER_32)
    			-- Set source proxy host to `host' and port to `port'.
    		require
    			host_not_empty: host /= Void and then not host.is_empty
    			port_non_negative: port >= 0
    		ensure
    			source_proxy_exists: source_proxy /= Void
    			host_set: source_proxy.host = host
    			port_set: source_proxy.port = port

    	set_target_proxy (host: STRING_8; port: INTEGER_32)
    			-- Set target proxy host to `host' and port to `port'.
    		require
    			host_not_empty: host /= Void and then not host.is_empty
    			port_non_negative: port >= 0
    		ensure
    			target_proxy_exists: target_proxy /= Void
    			host_set: target_proxy.host = host
    			port_set: target_proxy.port = port

    	set_timeout (s: INTEGER_32)
    			-- Set timeout to `s' seconds.
    			-- (This feature must be called *before* adding transactions in
    			-- order to affect the added transactions.)
    		require
    			non_negative: s >= 0
    		ensure
    			timeout_set: timeout.item = s

    feature -- Element change

    	add_transaction (s, t: STRING_8)
    			-- Add transaction from source `s' to target `t'.
    		require
    			source_exists: s /= Void
    			target_exists: t /= Void
    		ensure
    			one_more_transaction_if_correct: (last_added_source_correct and last_added_target_correct) implies count = old count + 1

    feature -- Removal

    	remove_transaction (n: INTEGER_32)
    			-- Remove `n'-th transaction.
    		require
    			not_empty: not is_empty
    			index_in_range: 1 <= n and n <= count
    		ensure
    			one_less_item: count = count - 1
    			index_unchanged: (old transactions.index < old count) implies (transactions.index = old transactions.index)
    			index_adapted: (old transactions.index = old count) implies (transactions.index = old transactions.index - 1)

    	wipe_out
    			-- Clear manager.
    		ensure
    			empty: is_empty
    			no_optimized_transactions: optimized_transactions = Void
    			no_manager: not manager_built

    feature -- Duplication

    	copy (other: like Current)
    			-- Update current object using fields of object attached
    			-- to `other', so as to yield equal objects.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_equal: is_equal (other)

    	frozen deep_copy (other: like Current)
    			-- Effect equivalent to that of:
    			--		copy (`other' . deep_twin)
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, other)

    	frozen deep_twin: like Current
    			-- New object structure recursively duplicated from Current.
    			-- (from ANY)
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, Result)

    	frozen standard_copy (other: like Current)
    			-- Copy every field of `other' onto corresponding field
    			-- of current object.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_standard_equal: standard_is_equal (other)

    	frozen standard_twin: like Current
    			-- New object field-by-field identical to `other'.
    			-- Always uses default copying semantics.
    			-- (from ANY)
    		ensure -- from ANY
    			standard_twin_not_void: Result /= Void
    			equal: standard_equal (Result, Current)

    	frozen twin: like Current
    			-- New object equal to `Current'
    			-- twin calls copy; to change copying/twining semantics, redefine copy.
    			-- (from ANY)
    		ensure -- from ANY
    			twin_not_void: Result /= Void
    			is_equal: Result.is_equal (Current)

    feature -- Basic operations

    	build_manager
    			-- Build manager.
    		require
    			not_empty: not is_empty
    		ensure
    			manager_ready: manager_built

    	frozen default: like Current
    			-- Default value of object's type
    			-- (from ANY)

    	frozen default_pointer: POINTER
    			-- Default value of type `POINTER'
    			-- (Avoid the need to write `p'.default for
    			-- some `p' of type `POINTER'.)
    			-- (from ANY)

    	default_rescue
    			-- Process exception for routines with no Rescue clause.
    			-- (Default: do nothing.)
    			-- (from ANY)

    	frozen do_nothing
    			-- Execute a null action.
    			-- (from ANY)

    	transfer
    			-- Start transfer.
    		require
    			manager_built: manager_built
    		ensure
    			transfer_finished: transfer_finished

    feature -- Output

    	io: STD_FILES
    			-- Handle to standard file setup
    			-- (from ANY)

    	out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of tagged_out.
    			-- (from ANY)

    	print (some: ANY)
    			-- Write terse external representation of `some'
    			-- on standard output.
    			-- (from ANY)

    	frozen tagged_out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of out.
    			-- (from ANY)

    feature -- Platform

    	operating_environment: OPERATING_ENVIRONMENT
    			-- Objects available from the operating system
    			-- (from ANY)

    invariant
    	readable_set_exists: readable_set /= Void
    	writable_set_exists: writable_set /= Void
    	resource_hash: resource_hash /= Void
    	success_constraint: transfer_succeeded implies transfer_finished
    	count_equality: (optimized_count > 0) implies (count = optimized_count)

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

    indexing
    	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
    	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    	source: "[
    		Eiffel Software
    		356 Storke Road, 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 TRANSFER_MANAGER_BUILDER_IMPL