note
	description: "[
		Objects that may be stored and retrieved along with all their dependents.
		This class may be used as ancestor by classes needing its facilities.
	]"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2018-04-28 20:49:45 +0000 (Sat, 28 Apr 2018) $"
	revision: "$Revision: 101698 $"

class interface
	STORABLE

create 
	default_create
			-- Process instances of classes with no creation clause.
			-- (Default: do nothing.)
			-- (from ANY)

feature -- Access

	Check_instruction: INTEGER_32 = 7
			-- Exception code for violated check
			-- (from EXCEP_CONST)

	Class_invariant: INTEGER_32 = 6
			-- Exception code for violated class invariant
			-- (from EXCEP_CONST)

	Com_exception: INTEGER_32 = 28
			-- Exception code for a COM error.
			-- (from EXCEP_CONST)

	Create_on_deferred: INTEGER_32 = 17
			-- Create on deferred
			-- (from EXCEP_CONST)

	Developer_exception: INTEGER_32 = 24
			-- Exception code for developer exception
			-- (from EXCEP_CONST)

	Dollar_applied_to_melted_feature: INTEGER_32 = 26
			-- $ applied to melted feature
			-- (from EXCEP_CONST)

	Eiffel_runtime_fatal_error: INTEGER_32 = 25
			-- Eiffel run-time fatal error
			-- (from EXCEP_CONST)

	Eiffel_runtime_panic: INTEGER_32 = 13
			-- Eiffel run-time panic
			-- (from EXCEP_CONST)

	Exception_in_signal_handler: INTEGER_32 = 20
			-- Exception in signal handler
			-- (from EXCEP_CONST)

	Exception_manager: EXCEPTION_MANAGER
			-- Exception manager
			-- (from EXCEPTION_MANAGER_FACTORY)
		ensure -- from EXCEPTION_MANAGER_FACTORY
			instance_free: class
			exception_manager_not_void: Result /= Void

	External_exception: INTEGER_32 = 18
			-- Exception code for operating system error
			-- which does not set the errno variable
			-- (Unix-specific)
			-- (from EXCEP_CONST)

	Floating_point_exception: INTEGER_32 = 5
			-- Exception code for floating point exception
			-- (from EXCEP_CONST)

	generating_type: TYPE [detachable STORABLE]
			-- Type of current object
			-- (type of which it is a direct instance)
			-- (from ANY)
		ensure -- from ANY
			generating_type_not_void: Result /= Void

	generator: STRING_8
			-- Name of current object's generating class
			-- (base class of the type of which it is a direct instance)
			-- (from ANY)
		ensure -- from ANY
			generator_not_void: Result /= Void
			generator_not_empty: not Result.is_empty

	Incorrect_inspect_value: INTEGER_32 = 9
			-- Exception code for inspect value which is not one
			-- of the inspect constants, if there is no Else_part
			-- (from EXCEP_CONST)

	Io_exception: INTEGER_32 = 21
			-- Exception code for I/O error
			-- (from EXCEP_CONST)

	Loop_invariant: INTEGER_32 = 11
			-- Exception code for violated loop invariant
			-- (from EXCEP_CONST)

	Loop_variant: INTEGER_32 = 10
			-- Exception code for non-decreased loop variant
			-- (from EXCEP_CONST)

	No_more_memory: INTEGER_32 = 2
			-- Exception code for failed memory allocation
			-- (from EXCEP_CONST)

	Number_of_codes: INTEGER_32 = 31
			-- How many codes are there to represent exceptions?
			-- (from EXCEP_CONST)

	Old_exception: INTEGER_32 = 30
			-- Old exception code.
			-- (from EXCEP_CONST)

	Operating_system_exception: INTEGER_32 = 22
			-- Exception code for operating system error
			-- which sets the errno variable
			-- (Unix-specific)
			-- (from EXCEP_CONST)

	Out_of_memory: INTEGER_32 = 15
			-- Out of memory (cannot be ignored)
			-- (from EXCEP_CONST)

	Postcondition: INTEGER_32 = 4
			-- Exception code for violated postcondition
			-- (from EXCEP_CONST)

	Precondition: INTEGER_32 = 3
			-- Exception code for violated precondition
			-- (from EXCEP_CONST)

	Rescue_exception: INTEGER_32 = 14
			-- Exception code for exception in rescue clause
			-- (from EXCEP_CONST)

	Resumption_failed: INTEGER_32 = 16
			-- Resumption failed (retry did not succeed)
			-- (from EXCEP_CONST)

	retrieve_by_name (file_name: READABLE_STRING_GENERAL): detachable ANY
			-- Retrieve object structure, from external
			-- representation previously stored in a file
			-- called file_name.
			-- To access resulting object under correct type,
			-- use assignment attempt.
			-- Will raise an exception (code Retrieve_exception)
			-- if file content is not a stored Eiffel structure.
			-- Will return Void if the file does not exist or
			-- is not readable.
		require
			file_name_exists: file_name /= Void
			file_name_meaningful: not file_name.is_empty
		ensure
			instance_free: class

	Retrieve_exception: INTEGER_32 = 23
			-- Exception code for retrieval error
			-- may be raised by retrieved in IO_MEDIUM.
			-- (from EXCEP_CONST)

	retrieved (medium: IO_MEDIUM): detachable ANY
			-- Retrieved object structure, from external
			-- representation previously stored in medium.
			-- To access resulting object under correct type,
			-- use assignment attempt.
			-- Will raise an exception (code Retrieve_exception)
			-- if medium content is not a stored Eiffel structure.
		require
			medium_not_void: medium /= Void
			medium_exists: medium.exists
			medium_is_open_read: medium.is_open_read
			medium_supports_storable: medium.support_storable
		ensure
			instance_free: class

	Routine_failure: INTEGER_32 = 8
			-- Exception code for failed routine
			-- (from EXCEP_CONST)

	Runtime_check_exception: INTEGER_32 = 29
			-- Exception code for runtime check being violated.
			-- (from EXCEP_CONST)

	Runtime_io_exception: INTEGER_32 = 27
			-- Exception code for I/O error raised by runtime functions
			-- such as store/retrieve, file access...
			-- (from EXCEP_CONST)

	Serialization_exception: INTEGER_32 = 31
			-- Serialization exception code.
			-- (from EXCEP_CONST)

	Signal_exception: INTEGER_32 = 12
			-- Exception code for operating system signal
			-- (from EXCEP_CONST)

	valid_code (c: INTEGER_32): BOOLEAN
			-- Is c a valid code to represent some kind of exceptions?
			-- (from EXCEP_CONST)

	Void_assigned_to_expanded: INTEGER_32 = 19
			-- Exception code for assignment of void value
			-- to expanded entity
			-- (from EXCEP_CONST)

	Void_call_target: INTEGER_32 = 1
			-- Exception code for feature applied to void reference
			-- (from EXCEP_CONST)
	
feature -- Comparison

	frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b either both void
			-- or attached to isomorphic object structures?
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			shallow_implies_deep: standard_equal (a, b) implies Result
			both_or_none_void: (a = Void) implies (Result = (b = Void))
			same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b))
			symmetric: Result implies deep_equal (b, a)

	frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b either both void or attached
			-- to objects considered equal?
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b))

	frozen is_deep_equal alias "≡≡≡" (other: STORABLE): BOOLEAN
			-- Are Current and other attached to isomorphic object structures?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			shallow_implies_deep: standard_is_equal (other) implies Result
			same_type: Result implies same_type (other)
			symmetric: Result implies other.is_deep_equal (Current)

	is_equal (other: STORABLE): 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 ~ Current
			consistent: standard_is_equal (other) implies Result

	frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN
			-- Are a and b 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
			instance_free: class
			definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b))

	frozen standard_is_equal alias "" (other: STORABLE): 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

	assertion_violation: BOOLEAN
			-- Is last exception originally due to a violated
			-- assertion or non-decreasing variant?
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	class_name: detachable STRING_8
			-- Name of the class that includes the recipient
			-- of original form of last exception
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	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

	developer_exception_name: detachable STRING_8
			-- Name of last developer-raised exception
			-- (from EXCEPTIONS)
		require -- from EXCEPTIONS
			applicable: is_developer_exception
		ensure -- from EXCEPTIONS
			instance_free: class

	exception: INTEGER_32
			-- Code of last exception that occurred
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	exception_trace: detachable STRING_8
			-- String representation of the exception trace
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	is_developer_exception: BOOLEAN
			-- Is the last exception originally due to
			-- a developer exception?
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	is_developer_exception_of_name (name: detachable STRING_8): BOOLEAN
			-- Is the last exception originally due to a developer
			-- exception of name name?
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	is_signal: BOOLEAN
			-- Is last exception originally due to an external
			-- event (operating system signal)?
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	is_system_exception: BOOLEAN
			-- Is last exception originally due to an
			-- external event (operating system error)?
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	meaning (except: INTEGER_32): detachable STRING_8
			-- A message in English describing what except is
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	original_class_name: detachable STRING_8
			-- Name of the class that includes the recipient
			-- of original form of last exception
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	original_exception: INTEGER_32
			-- Original code of last exception that triggered
			-- current exception
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	original_recipient_name: detachable STRING_8
			-- Name of the routine whose execution was
			-- interrupted by original form of last exception
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	original_tag_name: detachable STRING_8
			-- Assertion tag for original form of last
			-- assertion violation.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	recipient_name: detachable STRING_8
			-- Name of the routine whose execution was
			-- interrupted by last exception
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	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))

	tag_name: detachable STRING_8
			-- Tag of last violated assertion clause
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class
	
feature -- Status setting

	catch (code: INTEGER_32)
			-- Make sure that any exception of code code will be
			-- caught. This is the default.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	die (code: INTEGER_32)
			-- Terminate execution with exit status code,
			-- without triggering an exception.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
				False
			instance_free: class

	ignore (code: INTEGER_32)
			-- Make sure that any exception of code code will be
			-- ignored. This is not the default.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	message_on_failure
			-- Print an exception history table
			-- in case of failure.
			-- This is the default.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	no_message_on_failure
			-- Do not print an exception history table
			-- in case of failure.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	raise (name: detachable READABLE_STRING_GENERAL)
			-- Raise a developer exception of name name.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class

	raise_retrieval_exception (name: detachable READABLE_STRING_GENERAL)
			-- Raise a retrieval exception of name name.
			-- (from EXCEPTIONS)
		ensure -- from EXCEPTIONS
			instance_free: class
	
feature -- Element change

	basic_store (medium: IO_MEDIUM)
			-- Produce on medium an external representation of the
			-- entire object structure reachable from current object.
			-- Retrievable within current system only.
		require
			medium_not_void: medium /= Void
			medium_exists: medium.exists
			medium_is_open_write: medium.is_open_write
			medium_supports_storable: medium.support_storable

	independent_store (medium: IO_MEDIUM)
			-- Produce on medium an external representation of the
			-- entire object structure reachable from current object.
			-- Retrievable from other systems for the same or other
			-- platform (machine architecture).
		require
			medium_not_void: medium /= Void
			medium_exists: medium.exists
			medium_is_open_write: medium.is_open_write
			medium_supports_storable: medium.support_storable

	store_by_name (file_name: READABLE_STRING_GENERAL)
			-- Produce on file called file_name an external
			-- representation of the entire object structure
			-- reachable from current object.
			-- Retrievable from other systems for same platform
			-- (machine architecture).
		require
			file_name_not_void: file_name /= Void
			file_name_meaningful: not file_name.is_empty
	
feature -- Duplication

	copy (other: STORABLE)
			-- 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: Current ~ other

	frozen deep_copy (other: STORABLE)
			-- 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: STORABLE
			-- New object structure recursively duplicated from Current.
			-- (from ANY)
		ensure -- from ANY
			deep_twin_not_void: Result /= Void
			deep_equal: deep_equal (Current, Result)

	frozen standard_copy (other: STORABLE)
			-- 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: STORABLE
			-- 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: STORABLE
			-- New object equal to Current
			-- twin calls copy; to change copying/twinning semantics, redefine copy.
			-- (from ANY)
		ensure -- from ANY
			twin_not_void: Result /= Void
			is_equal: Result ~ Current
	
feature -- Basic operations

	frozen default: detachable STORABLE
			-- 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)
		ensure -- from ANY
			instance_free: class

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

	frozen do_nothing
			-- Execute a null action.
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
	
feature -- Output

	Io: STD_FILES
			-- Handle to standard file setup
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			io_not_void: Result /= Void

	out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- (from ANY)
		ensure -- from ANY
			out_not_void: Result /= Void

	print (o: detachable ANY)
			-- Write terse external representation of o
			-- on standard output.
			-- (from ANY)
		ensure -- from ANY
			instance_free: class

	frozen tagged_out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- (from ANY)
		ensure -- from ANY
			tagged_out_not_void: Result /= Void
	
feature -- Platform

	Operating_environment: OPERATING_ENVIRONMENT
			-- Objects available from the operating system
			-- (from ANY)
		ensure -- from ANY
			instance_free: class
			operating_environment_not_void: Result /= Void
	
feature -- Setting

	set_discard_pointers (v: BOOLEAN)
			-- If v it will discard POINTER values and replace them by
			-- the default_pointer pointer. Otherwise it keeps the original value.
	
invariant
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

note
	copyright: "Copyright (c) 1984-2018, 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 STORABLE

Generated by ISE EiffelStudio