+
Point of view
All features
deferred class SINGLETON
Summary
Implementation of the "Singleton" design pattern. The singleton pattern is a property of a type (yes TYPE, not class) to have at most one single object created at runtime for the corresponding type.
Usage: insert SINGLETON, that's all.
For examples, look at the tools cluster of Liberty Eiffel.
WARNING: double-check if the object is really a singleton in the conceptual sense.
         The singleton pattern is often used in wrong place. See for example:
         http://www.theagiledeveloper.com/articles/2005/03/03/singleton-overuse-disclaimer
         http://blogs.msdn.com/scottdensmore/archive/2004/05/25/140827.aspx
         http://www.softwarereality.com/design/singleton.jsp
         or search "Singletonitis" or "singleton overuse".
Direct parents
Insert list: ANY
Known children
Insert list: CGI, EDC_FIELD_OPTION_MANDATORY, EDC_FIELD_OPTION_PRIMARY_KEY, EDC_QUERY_OPTION_DEFAULT, EDC_QUERY_OPTION_FOR_UPDATE, GNU_GET_TEXT, LOG_INTERNAL_CONF, NCURSES, PERL, STANDARD_STREAMS, WAITPID_INPUT, WAITPID_JOB, WEB_TEMPLATE_PARSER, XML_DTD_PARSER
Class invariant
Overview
Features
{ANY}
  • is_equal (other: SINGLETON): BOOLEAN
    Is other attached to an object considered equal to current object?
{}
is_equal (other: SINGLETON): BOOLEAN
effective function
{ANY}
Is other attached to an object considered equal to current object?
require
  • other /= Void
ensure
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
is_real_singleton: BOOLEAN
effective function
{}
ensure
  • assertion_check_only: Result
singleton_memory_pool: HASHED_DICTIONARY[POINTER, STRING]
once function
{}
This pool is unique in the whole system.
A memory is kept for each singleton type (type, not class) in the system.
current_is_not_an_expanded_type: BOOLEAN
effective function
{}
Check that the dynamic type of the SINGLETON is not an expanded type.