EiffelBase class
(HTML page generated by ISE Eiffel 4.2)
Eiffel Class
indexing
description: "Objects identified, uniquely during any session, by an integer";
status: "See notice at end of class";
date: "$Date: 2007-03-30 11:10:11 -0800 (Fri, 30 Mar 2007) $";
revision: "$Revision: 95354 $"
class IDENTIFIED
inherit
MEMORY
export
{NONE} all
redefine
dispose, is_equal, copy
end;
ANY
redefine
is_equal, copy
end
feature -- Access
frozen object_id: INTEGER is
-- Unique for current object in any given session
do
if internal_id = 0 then
internal_id := eif_object_id (Current)
end;
Result := internal_id
ensure
valid_id: id_object (Result) = Current
end;
frozen id_object (an_id: INTEGER): IDENTIFIED is
-- Object associated with an_id (void if no such object)
do
Result := eif_id_object (an_id)
ensure
consistent: Result = void or else Result.object_id = an_id
end;
feature -- Status report
frozen id_freed: BOOLEAN is
-- Has Current been removed from the table?
do
Result := id_object (internal_id) = void
end;
feature -- Removal
frozen free_id is
-- Free the entry associated with object_id if any
do
if internal_id /= 0 then
eif_object_id_free (internal_id)
end
ensure
object_freed: id_freed
end;
feature -- Comparison
is_equal (other: like Current): BOOLEAN is
-- Is other attached to an object considered
-- equal to current object?
local
int_id: INTEGER
do
int_id := internal_id;
internal_id := other.internal_id;
Result := standard_is_equal (other);
internal_id := int_id
end;
feature -- Duplication
copy (other: like Current) is
-- Update current object using fields of object attached
-- to other, so as to yield equal objects.
local
int_id: INTEGER
do
int_id := internal_id;
standard_copy (other);
internal_id := int_id
end;
feature {NONE} -- Removal
dispose is
-- Free the entry associated with object_id if any
do
free_id
ensure
object_freed: id_freed
end;
feature {IDENTIFIED} -- Implementation
internal_id: INTEGER;
-- Internal representation of object_id
feature {NONE} -- Externals
eif_id_object (an_id: INTEGER): IDENTIFIED is
-- Object associated with an_id
external
"C | %"eif_object_id.h%""
end;
eif_object_id (an_object: IDENTIFIED): INTEGER is
-- New identifier for an_object
external
"C | %"eif_object_id.h%""
end;
eif_object_id_free (an_id: INTEGER) is
-- Free the entry an_id
external
"C | %"eif_object_id.h%""
end;
end -- class IDENTIFIED
|