+
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
Inherit list: SETTINGS
Insert list: ACE, AGENT_POOL, ASSIGNMENT_HANDLER, ASSIGNMENT_TEST_POOL, CECIL_POOL, CGI, CODE_ACCUMULATOR, CODE_COMPARATOR, C_EXPRESSION_COMPILATION_MIXIN, C_GARBAGE_COLLECTOR_ABSTRACT_COMPILER, C_HEADER_PASS, C_INTROSPECTION_DISPLAY, C_INTROSPECTION_FUNCTION, C_LIVE_TYPE_COMPILER, C_LIVE_TYPE_MIXIN, C_MAPPER, C_NATIVE_C_DEFINITION, C_NATIVE_FUNCTION_MAPPER, C_NATIVE_NEED_WRAPPER, EDC_FIELD_OPTION_MANDATORY, EDC_FIELD_OPTION_PRIMARY_KEY, EDC_QUERY_OPTION_DEFAULT, EDC_QUERY_OPTION_FOR_UPDATE, EIFFEL_PARSER, ERROR_HANDLER, FEATURE_ACCUMULATOR, GNU_GET_TEXT, HIDDEN_EXPRESSION_DETECTOR, INTROSPECTION_HANDLER, LOG_INTERNAL_CONF, MINI_BUFFER, NCURSES, ONCE_ROUTINE_POOL, PARSER_BUFFER, PERL, PRECOMPUTABLE_ROUTINE_DETECTOR, PRETTY_PRINTER, READ_LINE_COMPLETION, READ_LINE_HISTORY, READ_LINE_JOB, SERC_DEFAULTS, SMART_EIFFEL, STANDARD_STREAMS, STATUS, STRING_ALIASER, SYSTEM_TOOLS, THREAD_POOL, UNIVERSE, 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.