indexing
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"
copyright: "Copyright (c) 1986-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see forum.txt)"
date: "$Date: 2008-05-23 17:24:07 -0700 (Fri, 23 May 2008) $"
revision: "$Revision: 170 $"
class interface
MANAGED_POINTER
create
make (n: INTEGER_32)
item`n'
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])
item`data.count'
`data'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)
`a_count'`a_ptr'
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)
`a_ptr'`n'
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
feature
count: INTEGER_32
generating_type: STRING_8
ANY
ensure ANY
generating_type_not_void: Result /= Void
generating_type_not_empty: not Result.is_empty
generator: STRING_8
ANY
ensure ANY
generator_not_void: Result /= Void
generator_not_empty: not Result.is_empty
is_shared: BOOLEAN
item
item: POINTER
feature
frozen deep_equal (some: ?ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure 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 (other /= Void and then some.same_type (other))
symmetric: Result implies deep_equal (other, some)
frozen equal (some: ?ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))
frozen is_deep_equal (other: MANAGED_POINTER): BOOLEAN
`Current'`other'
ANY
require ANY
other_not_void: other /= Void
ensure 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
`other'
require ANY
other_not_void: other /= Void
ensure 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
`some'`other'
ANY
ensure 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: MANAGED_POINTER): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
feature
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
same_type (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
definition: Result = (conforms_to (other) and other.conforms_to (Current))
feature
resize (n: INTEGER_32)
item`n'
require
n_non_negative: n >= 0
not_shared: not is_shared
feature
copy (other: like Current)
`other'is_shared
`other'
is_shared`False'
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
ensure then
sharing_status_not_preserved: (old is_shared and not is_shared) implies (other.count > old count)
frozen deep_copy (other: MANAGED_POINTER)
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: MANAGED_POINTER
ANY
ensure ANY
deep_twin_not_void: Result /= Void
deep_equal: deep_equal (Current, Result)
frozen standard_copy (other: MANAGED_POINTER)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_standard_equal: standard_is_equal (other)
frozen standard_twin: MANAGED_POINTER
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: MANAGED_POINTER
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: ?MANAGED_POINTER
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
boolean_bits: INTEGER_32
`BOOLEAN'
PLATFORM
character_32_bits: INTEGER_32 is 32
`CHARACTER_32'
PLATFORM
character_8_bits: INTEGER_32 is 8
`CHARACTER_8'
PLATFORM
integer_16_bits: INTEGER_32 is 16
`INTEGER_16'
PLATFORM
integer_32_bits: INTEGER_32 is 32
`INTEGER_32'
PLATFORM
integer_64_bits: INTEGER_32 is 64
`INTEGER_64'
PLATFORM
integer_8_bits: INTEGER_32 is 8
`INTEGER_8'
PLATFORM
natural_16_bits: INTEGER_32 is 16
`NATURAL_16'
PLATFORM
natural_32_bits: INTEGER_32 is 32
`NATURAL_32'
PLATFORM
natural_64_bits: INTEGER_32 is 64
`NATURAL_64'
PLATFORM
natural_8_bits: INTEGER_32 is 8
`NATURAL_8'
PLATFORM
pointer_bits: INTEGER_32
`POINTER'
PLATFORM
real_32_bits: INTEGER_32 is 32
`REAL_32'
PLATFORM
real_64_bits: INTEGER_32 is 64
`REAL_64'
PLATFORM
feature
boolean_bytes: INTEGER_32
`BOOLEAN'
PLATFORM
character_32_bytes: INTEGER_32 is 4
`CHARACTER_32'
PLATFORM
character_8_bytes: INTEGER_32 is 1
`CHARACTER_8'
PLATFORM
integer_16_bytes: INTEGER_32 is 2
`INTEGER_16'
PLATFORM
integer_32_bytes: INTEGER_32 is 4
`INTEGER_32'
PLATFORM
integer_64_bytes: INTEGER_32 is 8
`INTEGER_64'
PLATFORM
integer_8_bytes: INTEGER_32 is 1
`INTEGER_8'
PLATFORM
natural_16_bytes: INTEGER_32 is 2
`NATURAL_16'
PLATFORM
natural_32_bytes: INTEGER_32 is 4
`NATURAL_32'
PLATFORM
natural_64_bytes: INTEGER_32 is 8
`NATURAL_64'
PLATFORM
natural_8_bytes: INTEGER_32 is 1
`NATURAL_8'
PLATFORM
pointer_bytes: INTEGER_32
`POINTER'
PLATFORM
real_32_bytes: INTEGER_32 is 4
`REAL_32'
PLATFORM
real_64_bytes: INTEGER_32 is 8
`REAL_64'
PLATFORM
feature
read_integer_16_be (pos: INTEGER_32): INTEGER_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_16_bytes) <= count
read_integer_32_be (pos: INTEGER_32): INTEGER_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_32_bytes) <= count
read_integer_64_be (pos: INTEGER_32): INTEGER_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_64_bytes) <= count
read_integer_8_be (pos: INTEGER_32): INTEGER_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_8_bytes) <= count
read_natural_16_be (pos: INTEGER_32): NATURAL_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_16_bytes) <= count
read_natural_32_be (pos: INTEGER_32): NATURAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_32_bytes) <= count
read_natural_64_be (pos: INTEGER_32): NATURAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_64_bytes) <= count
read_natural_8_be (pos: INTEGER_32): NATURAL_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_8_bytes) <= count
read_real_32_be (pos: INTEGER_32): REAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_32_bytes) <= count
read_real_64_be (pos: INTEGER_32): REAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_64_bytes) <= count
feature
read_integer_16_le (pos: INTEGER_32): INTEGER_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_16_bytes) <= count
read_integer_32_le (pos: INTEGER_32): INTEGER_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_32_bytes) <= count
read_integer_64_le (pos: INTEGER_32): INTEGER_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_64_bytes) <= count
read_integer_8_le (pos: INTEGER_32): INTEGER_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_8_bytes) <= count
read_natural_16_le (pos: INTEGER_32): NATURAL_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_16_bytes) <= count
read_natural_32_le (pos: INTEGER_32): NATURAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_32_bytes) <= count
read_natural_64_le (pos: INTEGER_32): NATURAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_64_bytes) <= count
read_natural_8_le (pos: INTEGER_32): NATURAL_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_8_bytes) <= count
read_real_32_le (pos: INTEGER_32): REAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_32_bytes) <= count
read_real_64_le (pos: INTEGER_32): REAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_64_bytes) <= count
feature
read_array (pos, a_count: INTEGER_32): ARRAY [NATURAL_8]
count`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
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + boolean_bytes) <= count
read_character (pos: INTEGER_32): CHARACTER_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + character_8_bytes) <= count
read_integer_16 (pos: INTEGER_32): INTEGER_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_16_bytes) <= count
read_integer_32 (pos: INTEGER_32): INTEGER_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_32_bytes) <= count
read_integer_64 (pos: INTEGER_32): INTEGER_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_64_bytes) <= count
read_integer_8 (pos: INTEGER_32): INTEGER_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + integer_8_bytes) <= count
read_natural_16 (pos: INTEGER_32): NATURAL_16
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_16_bytes) <= count
read_natural_32 (pos: INTEGER_32): NATURAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_32_bytes) <= count
read_natural_64 (pos: INTEGER_32): NATURAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_64_bytes) <= count
read_natural_8 (pos: INTEGER_32): NATURAL_8
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + natural_8_bytes) <= count
read_pointer (pos: INTEGER_32): POINTER
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + pointer_bytes) <= count
read_real_32 (pos: INTEGER_32): REAL_32
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_32_bytes) <= count
read_real_64 (pos: INTEGER_32): REAL_64
`pos'
require
pos_nonnegative: pos >= 0
valid_position: (pos + real_64_bytes) <= count
feature
append (other: like Current)
`other'
require
not_shared: not is_shared
other_not_void: other /= Void
feature
put_integer_16_be (i: INTEGER_16; pos: INTEGER_32)
`i'`pos'
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)
`i'`pos'
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)
`i'`pos'
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)
`i'`pos'
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)
`i'`pos'
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)
`i'`pos'
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)
`i'`pos'
require
pos_nonnegative: pos >=