Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.utility

Class EM_POOL



Features

Invariants

indexing

description

Objects that can store other objects to prevent them from being collected by the garbage collector.
This is useful to avoid heavy garbagecollector cycles and save time during object creation due to the ability
of a recycle mechanism.

date

$Date: 2005/10/23 10:36:32 $

revision

$Revision: 1.2 $

class

EM_POOL [G -> ANY create default_create end]

feature -- Initialisation

make (a_count: INTEGER)

-- Init

require
a_count_positive: count >=0
ensure
count_correct: a_count = count

feature -- Access

count: INTEGER

-- Number of items in the pool

is_empty: BOOLEAN

-- Is the pool empty?

item: G

-- An instance of an object
-- If the pool is not empty from the pool, otherwise it a new instance will be created.

put (an_item: G)

-- put an item into the pool

invariant

pool_not_void: pool/=Void

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

end