note
	description: "[
		To easily manage allocation and release of allocated C memory, and
		to perform insertion of basic elements. Byte order is by default
		platform specific.
		Although memory allocation routines do not accept a zero sized pointer
		MANAGED_POINTER does by allocating in fact a 1 byte sized pointer for
		this particular case.
	]"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2020-05-19 14:29:33 +0000 (Tue, 19 May 2020) $"
	revision: "$Revision: 104259 $"

class interface
	MANAGED_POINTER

create 
	make (n: INTEGER_32)
			-- Allocate item with n bytes.
		require
			n_non_negative: n >= 0
		ensure
			item_set: item /= default_pointer
			count_set: count = n
			is_shared_set: not is_shared

	make_from_array (data: ARRAY [NATURAL_8])
			-- Allocate item with data.count bytes and copy
			-- content of data into item.
		require
			data_not_void: data /= Void
		ensure
			item_set: item /= default_pointer
			count_set: count = data.count
			is_shared_set: not is_shared

	make_from_pointer (a_ptr: POINTER; n: INTEGER_32)
			-- Copy a_count bytes from a_ptr into current.
		require
			a_ptr_not_null: a_ptr /= default_pointer
			n_non_negative: n >= 0
		ensure
			item_set: item /= default_pointer
			count_set: count = n
			is_shared_set: not is_shared

	share_from_pointer (a_ptr: POINTER; n: INTEGER_32)
			-- Use directly a_ptr with count n to hold current data.
		require
			a_ptr_valid: a_ptr = default_pointer implies n = 0
			n_non_negative: n >= 0
		ensure
			item_set: item = a_ptr
			count_set: count = n
			is_shared_set: is_shared

	own_from_pointer (a_ptr: POINTER; n: INTEGER_32)
			-- Use directly a_ptr with count n to hold current data and free
			-- its associated C memory when Current is collected.
			-- It assumes that a_ptr was allocated using the C-malloc routine and thus
			-- will be freed by calling the C-free routine.
		require
			a_ptr_valid: a_ptr /= default_pointer
			n_non_negative: n >= 0
		ensure
			item_set: item = a_ptr
			count_set: count = n
			is_shared_set: not is_shared

feature -- Access

	count: INTEGER_32
			-- Number of elements that Current can hold.

	generating_type: TYPE [detachable MANAGED_POINTER]
			-- 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

	is_shared: BOOLEAN
			-- Is item shared with another memory area?

	item: POINTER
		note
			option: transient
	
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: MANAGED_POINTER): 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: like Current): BOOLEAN
			-- Is other attached to an object considered equal to current object?
		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: MANAGED_POINTER): 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

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

	resize (n: INTEGER_32)
			-- Reallocate item to hold n bytes.
		require
			n_non_negative: n >= 0
			not_shared: not is_shared
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to other, so as to yield equal objects. If is_shared
			-- and current is not large enough to hold other create
			-- a new pointer area and is_shared is set to False.
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: Current ~ other
		ensure then
			sharing_status_not_preserved: (other /= Current) implies (old is_shared implies not is_shared)
			count_preserved: count = other.count

	frozen deep_copy (other: MANAGED_POINTER)
			-- 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: MANAGED_POINTER
			-- 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: MANAGED_POINTER)
			-- 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: MANAGED_POINTER
			-- 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: MANAGED_POINTER
			-- 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 MANAGED_POINTER
			-- 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 -- Access bits size

	boolean_bits: INTEGER_32
			-- Number of bits in a value of type BOOLEAN
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	Character_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type CHARACTER_32
			-- (from PLATFORM)

	Character_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type CHARACTER_8
			-- (from PLATFORM)

	Integer_16_bits: INTEGER_32 = 16
			-- Number of bits in a value of type INTEGER_16
			-- (from PLATFORM)

	Integer_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type INTEGER_32
			-- (from PLATFORM)

	Integer_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type INTEGER_64
			-- (from PLATFORM)

	Integer_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type INTEGER_8
			-- (from PLATFORM)

	Natural_16_bits: INTEGER_32 = 16
			-- Number of bits in a value of type NATURAL_16
			-- (from PLATFORM)

	Natural_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type NATURAL_32
			-- (from PLATFORM)

	Natural_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type NATURAL_64
			-- (from PLATFORM)

	Natural_8_bits: INTEGER_32 = 8
			-- Number of bits in a value of type NATURAL_8
			-- (from PLATFORM)

	pointer_bits: INTEGER_32
			-- Number of bits in a value of type POINTER
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	Real_32_bits: INTEGER_32 = 32
			-- Number of bits in a value of type REAL_32
			-- (from PLATFORM)

	Real_64_bits: INTEGER_32 = 64
			-- Number of bits in a value of type REAL_64
			-- (from PLATFORM)
	
feature -- Access bytes size

	boolean_bytes: INTEGER_32
			-- Number of bytes in a value of type BOOLEAN
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	Character_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type CHARACTER_32
			-- (from PLATFORM)

	Character_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type CHARACTER_8
			-- (from PLATFORM)

	Integer_16_bytes: INTEGER_32 = 2
			-- Number of bytes in a value of type INTEGER_16
			-- (from PLATFORM)

	Integer_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type INTEGER_32
			-- (from PLATFORM)

	Integer_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type INTEGER_64
			-- (from PLATFORM)

	Integer_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type INTEGER_8
			-- (from PLATFORM)

	Natural_16_bytes: INTEGER_32 = 2
			-- Number of bytes in a value of type NATURAL_16
			-- (from PLATFORM)

	Natural_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type NATURAL_32
			-- (from PLATFORM)

	Natural_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type NATURAL_64
			-- (from PLATFORM)

	Natural_8_bytes: INTEGER_32 = 1
			-- Number of bytes in a value of type NATURAL_8
			-- (from PLATFORM)

	pointer_bytes: INTEGER_32
			-- Number of bytes in a value of type POINTER
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	Real_32_bytes: INTEGER_32 = 4
			-- Number of bytes in a value of type REAL_32
			-- (from PLATFORM)

	Real_64_bytes: INTEGER_32 = 8
			-- Number of bytes in a value of type REAL_64
			-- (from PLATFORM)
	
feature -- Access: Big-endian format

	read_integer_16_be (pos: INTEGER_32): INTEGER_16
			-- Read INTEGER_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count

	read_integer_32_be (pos: INTEGER_32): INTEGER_32
			-- Read INTEGER at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count

	read_integer_64_be (pos: INTEGER_32): INTEGER_64
			-- Read INTEGER_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count

	read_integer_8_be (pos: INTEGER_32): INTEGER_8
			-- Read INTEGER_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count

	read_natural_16_be (pos: INTEGER_32): NATURAL_16
			-- Read NATURAL_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count

	read_natural_32_be (pos: INTEGER_32): NATURAL_32
			-- Read NATURAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count

	read_natural_64_be (pos: INTEGER_32): NATURAL_64
			-- Read NATURAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count

	read_natural_8_be (pos: INTEGER_32): NATURAL_8
			-- Read NATURAL_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count

	read_real_32_be (pos: INTEGER_32): REAL_32
			-- Read REAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count

	read_real_64_be (pos: INTEGER_32): REAL_64
			-- Read REAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count
	
feature -- Access: Little-endian format

	read_integer_16_le (pos: INTEGER_32): INTEGER_16
			-- Read INTEGER_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count

	read_integer_32_le (pos: INTEGER_32): INTEGER_32
			-- Read INTEGER at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count

	read_integer_64_le (pos: INTEGER_32): INTEGER_64
			-- Read INTEGER_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count

	read_integer_8_le (pos: INTEGER_32): INTEGER_8
			-- Read INTEGER_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count

	read_natural_16_le (pos: INTEGER_32): NATURAL_16
			-- Read NATURAL_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count

	read_natural_32_le (pos: INTEGER_32): NATURAL_32
			-- Read NATURAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count

	read_natural_64_le (pos: INTEGER_32): NATURAL_64
			-- Read NATURAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count

	read_natural_8_le (pos: INTEGER_32): NATURAL_8
			-- Read NATURAL_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count

	read_real_32_le (pos: INTEGER_32): REAL_32
			-- Read REAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count

	read_real_64_le (pos: INTEGER_32): REAL_64
			-- Read REAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count
	
feature -- Access: Platform specific

	read_array (pos, a_count: INTEGER_32): ARRAY [NATURAL_8]
			-- Read count bytes at position pos.
		require
			pos_nonnegative: pos >= 0
			count_positive: a_count > 0
			valid_position: (pos + a_count) <= count
		ensure
			read_array_not_void: Result /= Void
			read_array_valid_count: Result.count = a_count

	read_boolean (pos: INTEGER_32): BOOLEAN
			-- Read BOOLEAN at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + boolean_bytes) <= count

	read_character (pos: INTEGER_32): CHARACTER_8
			-- Read CHARACTER at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Character_8_bytes) <= count

	read_integer_16 (pos: INTEGER_32): INTEGER_16
			-- Read INTEGER_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count

	read_integer_32 (pos: INTEGER_32): INTEGER_32
			-- Read INTEGER at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count

	read_integer_64 (pos: INTEGER_32): INTEGER_64
			-- Read INTEGER_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count

	read_integer_8 (pos: INTEGER_32): INTEGER_8
			-- Read INTEGER_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count

	read_into_special_character_8 (a_spec: SPECIAL [CHARACTER_8]; source_index, destination_index, n: INTEGER_32)
			-- Read n bytes of Current from position source_index and store them in a_spec at destination_index.
		require
			a_spec_not_void: a_spec /= Void
			source_index_non_negative: source_index >= 0
			destination_index_non_negative: destination_index >= 0
			destination_index_in_bound: destination_index <= a_spec.count
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= count
			n_is_small_enough_for_destination: destination_index + n <= a_spec.count

	read_into_special_natural_8 (a_spec: SPECIAL [NATURAL_8]; source_index, destination_index, n: INTEGER_32)
			-- Read n bytes of Current from position source_index and store them in a_spec at destination_index.
		require
			a_spec_not_void: a_spec /= Void
			source_index_non_negative: source_index >= 0
			destination_index_non_negative: destination_index >= 0
			destination_index_in_bound: destination_index <= a_spec.count
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= count
			n_is_small_enough_for_destination: destination_index + n <= a_spec.count

	read_natural_16 (pos: INTEGER_32): NATURAL_16
			-- Read NATURAL_16 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count

	read_natural_32 (pos: INTEGER_32): NATURAL_32
			-- Read NATURAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count

	read_natural_64 (pos: INTEGER_32): NATURAL_64
			-- Read NATURAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count

	read_natural_8 (pos: INTEGER_32): NATURAL_8
			-- Read NATURAL_8 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count

	read_pointer (pos: INTEGER_32): POINTER
			-- Read POINTER at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + pointer_bytes) <= count

	read_real_32 (pos: INTEGER_32): REAL_32
			-- Read REAL_32 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count

	read_real_64 (pos: INTEGER_32): REAL_64
			-- Read REAL_64 at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count

	read_special_character_8 (source_index, n: INTEGER_32): SPECIAL [CHARACTER_8]
			-- Read n bytes of Current from position source_index.
		require
			source_index_non_negative: source_index >= 0
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= count

	read_special_natural_8 (source_index, n: INTEGER_32): SPECIAL [NATURAL_8]
			-- Read n bytes of Current from position source_index.
		require
			source_index_non_negative: source_index >= 0
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= count
	
feature -- Concatenation

	append (other: like Current)
			-- Append other at the end of Current.
		require
			not_shared: not is_shared
			other_not_void: other /= Void
	
feature -- Disposal

	dispose
			-- Release memory pointed by item.
		require -- from  DISPOSABLE
			True
		ensure then
			shared_reset: not is_shared
	
feature -- Element change: Big-endian format

	put_integer_16_be (i: INTEGER_16; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count
		ensure
			inserted: i = read_integer_16_be (pos)

	put_integer_32_be (i: INTEGER_32; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count
		ensure
			inserted: i = read_integer_32_be (pos)

	put_integer_64_be (i: INTEGER_64; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count
		ensure
			inserted: i = read_integer_64_be (pos)

	put_integer_8_be (i: INTEGER_8; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count
		ensure
			inserted: i = read_integer_8_be (pos)

	put_natural_16_be (i: NATURAL_16; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count
		ensure
			inserted: i = read_natural_16_be (pos)

	put_natural_32_be (i: NATURAL_32; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count
		ensure
			inserted: i = read_natural_32_be (pos)

	put_natural_64_be (i: NATURAL_64; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count
		ensure
			inserted: i = read_natural_64_be (pos)

	put_natural_8_be (i: NATURAL_8; pos: INTEGER_32)
			-- Insert i at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count
		ensure
			inserted: i = read_natural_8_be (pos)

	put_real_32_be (v: REAL_32; pos: INTEGER_32)
			-- Insert v at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count
		ensure
			inserted: v = read_real_32_be (pos)

	put_real_64_be (v: REAL_64; pos: INTEGER_32)
			-- Insert v at position pos in big-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count
		ensure
			inserted: v = read_real_64_be (pos)
	
feature -- Element change: Little-endian format

	put_integer_16_le (i: INTEGER_16; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count
		ensure
			inserted: i = read_integer_16_le (pos)

	put_integer_32_le (i: INTEGER_32; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count
		ensure
			inserted: i = read_integer_32_le (pos)

	put_integer_64_le (i: INTEGER_64; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count
		ensure
			inserted: i = read_integer_64_le (pos)

	put_integer_8_le (i: INTEGER_8; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count
		ensure
			inserted: i = read_integer_8_le (pos)

	put_natural_16_le (i: NATURAL_16; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count
		ensure
			inserted: i = read_natural_16_le (pos)

	put_natural_32_le (i: NATURAL_32; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count
		ensure
			inserted: i = read_natural_32_le (pos)

	put_natural_64_le (i: NATURAL_64; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count
		ensure
			inserted: i = read_natural_64_le (pos)

	put_natural_8_le (i: NATURAL_8; pos: INTEGER_32)
			-- Insert i at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count
		ensure
			inserted: i = read_natural_8_le (pos)

	put_real_32_le (v: REAL_32; pos: INTEGER_32)
			-- Insert v at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count
		ensure
			inserted: v = read_real_32_le (pos)

	put_real_64_le (v: REAL_64; pos: INTEGER_32)
			-- Insert v at position pos in little-endian format.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count
		ensure
			inserted: v = read_real_64_le (pos)
	
feature -- Element change: Platform specific

	put_array (data: ARRAY [NATURAL_8]; pos: INTEGER_32)
			-- Copy content of data into item at position pos.
		require
			data_not_void: data /= Void
			pos_nonnegative: pos >= 0
			valid_position: (pos + data.count) <= count
		ensure
			inserted: read_array (pos, data.count) ~ data

	put_boolean (b: BOOLEAN; pos: INTEGER_32)
			-- Insert b at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + boolean_bytes) <= count
		ensure
			inserted: b = read_boolean (pos)

	put_character (c: CHARACTER_8; pos: INTEGER_32)
			-- Insert c at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Character_8_bytes) <= count
		ensure
			inserted: c = read_character (pos)

	put_integer_16 (i: INTEGER_16; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_16_bytes) <= count
		ensure
			inserted: i = read_integer_16 (pos)

	put_integer_32 (i: INTEGER_32; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_32_bytes) <= count
		ensure
			inserted: i = read_integer_32 (pos)

	put_integer_64 (i: INTEGER_64; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_64_bytes) <= count
		ensure
			inserted: i = read_integer_64 (pos)

	put_integer_8 (i: INTEGER_8; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Integer_8_bytes) <= count
		ensure
			inserted: i = read_integer_8 (pos)

	put_natural_16 (i: NATURAL_16; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_16_bytes) <= count
		ensure
			inserted: i = read_natural_16 (pos)

	put_natural_32 (i: NATURAL_32; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_32_bytes) <= count
		ensure
			inserted: i = read_natural_32 (pos)

	put_natural_64 (i: NATURAL_64; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_64_bytes) <= count
		ensure
			inserted: i = read_natural_64 (pos)

	put_natural_8 (i: NATURAL_8; pos: INTEGER_32)
			-- Insert i at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Natural_8_bytes) <= count
		ensure
			inserted: i = read_natural_8 (pos)

	put_pointer (p: POINTER; pos: INTEGER_32)
			-- Insert p at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + pointer_bytes) <= count
		ensure
			inserted: p = read_pointer (pos)

	put_real_32 (r: REAL_32; pos: INTEGER_32)
			-- Insert r at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_32_bytes) <= count
		ensure
			inserted: r = read_real_32 (pos)

	put_real_64 (d: REAL_64; pos: INTEGER_32)
			-- Insert d at position pos.
		require
			pos_nonnegative: pos >= 0
			valid_position: (pos + Real_64_bytes) <= count
		ensure
			inserted: d = read_real_64 (pos)

	put_special_character_8 (a_spec: SPECIAL [CHARACTER_8]; source_index, destination_index, n: INTEGER_32)
			-- Write n bytes of a_spec from position source_index to Current at position destination_index.
		require
			a_spec_not_void: a_spec /= Void
			source_index_non_negative: source_index >= 0
			destination_index_non_negative: destination_index >= 0
			destination_index_in_bound: destination_index <= count
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= a_spec.count
			n_is_small_enough_for_destination: destination_index + n <= count
		ensure
			inserted: a_spec.same_items (read_special_character_8 (destination_index, n), 0, source_index, n)

	put_special_natural_8 (a_spec: SPECIAL [NATURAL_8]; source_index, destination_index, n: INTEGER_32)
			-- Write n bytes of a_spec from position source_index to Current at position destination_index.
		require
			a_spec_not_void: a_spec /= Void
			source_index_non_negative: source_index >= 0
			destination_index_non_negative: destination_index >= 0
			destination_index_in_bound: destination_index <= count
			n_non_negative: n >= 0
			n_is_small_enough_for_source: source_index + n <= a_spec.count
			n_is_small_enough_for_destination: destination_index + n <= count
		ensure
			inserted: a_spec.same_items (read_special_natural_8 (destination_index, n), 0, source_index, n)
	
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

	is_64_bits: BOOLEAN
			-- Is the current process runing in 64-bit mode
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_dotnet: BOOLEAN
			-- Are we targetting .NET?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	Is_little_endian: BOOLEAN
			-- Is current platform a little endian one?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_mac: BOOLEAN
			-- Are we running on Mac OS?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_scoop_capable: BOOLEAN
			-- Is current platform capable of SCOOP?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_thread_capable: BOOLEAN
			-- Is current platform capable of multi-threading?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_unix: BOOLEAN
			-- Are we running on a Unix like platform?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_vms: BOOLEAN
			-- Are we running on VMS?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_vxworks: BOOLEAN
			-- Are we running on VxWorks?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

	is_windows: BOOLEAN
			-- Are we running on Windows platform?
			-- (from PLATFORM)
		ensure -- from PLATFORM
			instance_free: class

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

	set_from_pointer (a_ptr: POINTER; n: INTEGER_32)
			-- Use directly a_ptr with count n to hold current data.
		require
			is_shared: is_shared
			a_ptr_not_null: a_ptr = default_pointer implies n = 0
			n_non_negative: n >= 0
		ensure
			item_set: item = a_ptr
			count_set: count = n
			is_shared_unchanged: is_shared
	
invariant
	item_not_null: item = default_pointer implies (count = 0 and is_shared)
	valid_count: count >= 0

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

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

Generated by ISE EiffelStudio