indexing
description: "Data resources"
status: "See note at end of class"
date: "$Date$"
revision: "$Revision$"
deferred class interface
DATA_RESOURCE
feature
address: URL
hash_code: INTEGER
ensure HASHABLE
good_hash_value: Result >= 0
last_packet: STRING
location: STRING
require
address_exists: address /= void
mode: INTEGER
port: INTEGER
service: STRING
feature
bytes_transferred: INTEGER
count: INTEGER
last_packet_size: INTEGER
read_buffer_size: INTEGER
feature
is_equal (other: like Current): BOOLEAN
other
require ANY
other_not_void: other /= void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
feature
address_exists: BOOLEAN
error: BOOLEAN
error_code: INTEGER
error_text (code: INTEGER): STRING
DATA_RESOURCE_ERROR_CONSTANTS
require DATA_RESOURCE_ERROR_CONSTANTS
positive_code: code > 0
has_packet: BOOLEAN
last_packet
is_count_valid: BOOLEAN
count
is_hashable: BOOLEAN
ensure HASHABLE
ok_if_not_default: Result implies (Current /= default)
is_mode_set: BOOLEAN
is_open: BOOLEAN
is_packet_pending: BOOLEAN
is_proxy_supported: BOOLEAN
is_readable: BOOLEAN
ensure
mode_unchanged: mode = old mode
is_writable: BOOLEAN
ensure
mode_unchanged: mode = old mode
read_mode: BOOLEAN
supports_multiple_transactions: BOOLEAN
timeout: INTEGER
transfer_initiated: BOOLEAN
valid_mode (n: INTEGER): BOOLEAN
n
write_mode: BOOLEAN
feature
close
require
open: is_open
ensure
closed: not is_open
mode_unchanged: mode = old mode
no_packet_available: not (has_packet and is_packet_pending)
initiate_transfer
require
no_error_occurred: not error
mode_set: is_mode_set
open: is_open
not_initiated: not transfer_initiated
ensure
failure_means_error: not transfer_initiated implies error
open
require
no_error_occurred: not error
mode_set: is_mode_set
ensure
no_packet_available: not (has_packet and is_packet_pending)
initiated_flag_reset: not transfer_initiated
failure_means_error: not is_open implies error
reset_error
ensure
error_reset: not error
reset_proxy
ensure
proxy_reset: not address.is_proxy_used
reuse_connection (other: DATA_RESOURCE)
other
require
other_exists: other /= void
same_type: same_type (other)
supports_multiple_transactions: supports_multiple_transactions and other.supports_multiple_transactions
other_opened: other.is_open
set_password (pw: STRING)
pw
require
password_accepted: address.is_password_accepted
non_empty_password: pw /= void and then not pw.is_empty
set_port (port_no: INTEGER)
port_no
require
closed: not is_open
non_negative_port_number: port_no >= 0
ensure
port_set: port = port_no
set_proxy (host: STRING; port_no: INTEGER)
hostport_no
require
proxy_supported: is_proxy_supported
closed: not is_open
non_empty_host: host /= void and then not host.is_empty
host_ok: address.proxy_host_ok (host)
non_negative_port: port_no >= 0
ensure
proxy_set: address.is_proxy_used
set_proxy_information (pi: PROXY_INFORMATION)
pi
require
proxy_supported: is_proxy_supported
ensure
proxy_set: address.is_proxy_used
set_read_buffer_size (n: INTEGER)
require
size_positive: n > 0
ensure
buffer_size_set: read_buffer_size = n
set_read_mode
ensure
read_mode_set: read_mode
set_timeout (n: INTEGER)
n
require
non_negative: n >= 0
ensure
timeout_set: timeout = n
set_username (un: STRING)
un
require
username_accepted: address.has_username
non_empty_username: un /= void and then not un.is_empty
set_write_mode
ensure
write_mode_set: write_mode
feature
dispose
feature
read
require
no_error_occurred: not error
open: is_open
transfer_initated: transfer_initiated
readable: is_readable
positive_read_buffer_size: read_buffer_size > 0
packet_pending: is_packet_pending
ensure
packet_received: is_packet_pending implies last_packet_size > 0
counter_correct: not error implies bytes_transferred = old bytes_transferred + last_packet_size
feature
put (other: DATA_RESOURCE)
other
require
no_error_occurred: not (error and other.error)
other_resource_exists: other /= void
resources_open: is_open and other.is_open
writable: is_writable
transfer_initated: transfer_initiated
invariant
address_assigned: address /= void
timeout_non_negative: timeout >= 0
packet_constraint: not (has_packet xor last_packet /= void)
pending_constraint: is_packet_pending implies (is_open and is_readable and transfer_initiated)
error_definition: error = (error_code /= 0)
valid_count_constraint: count > 0 implies is_count_valid
mode_constraint: is_mode_set = read_mode xor write_mode
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
end -- DATA_RESOURCE