EiffelBase Support Cluster

The support cluster offers some commonly needed functionality that do not belong to the kernel.

Conversions, mathematical properties and ASCII characters

A few utility classes complement the kernel facilities. PRIMES , RANDOM and FIBONACCI are part of the data structure taxonomy; the others are meant to be used as ancestors by classes needing their features.

Two classes provide basic mathematical functions such as logarithms and trigonometric functions: SINGLE_MATH for single precision and DOUBLE_MATH for the double-precision variants. MATH_CONST contains mathematical constants: p , the square root of two, Euler's constant e .

PRIMES , RANDOM and FIBONACCI are data structure classes - heirs of COUNTABLE_SEQUENCE . In all of these classes function i_th takes an integer argument i and will return the i-th element of the sequence under consideration - prime numbers, pseudo-random numbers or Fibonacci numbers. These sequences are active structures, on which forth will advance the current position and item will return the value at the current position. A few other features are specific to each case: for example higher_prime will yield the smallest prime greater than or equal to a certain value, and set_seed will define the seed to be used for starting the pseudo-random sequence.

Internal object structures

Class INTERNAL provides low-level access to internal object structures. It, too, is meant to be used as ancestor by classes needing its features.
Here are some of the most useful calls and what they yield, obj being an entity attached to an object O and i an integer:

  • class_name (obj) : the name of the generator class for O.
  • dynamic_type (obj) : the integer code for the type of O, where each type in a system is identified by a unique code.
  • field_count (obj) : the number of fields in O.
  • physical_size (obj) : the space occupied by O, in bytes.
  • field_xx (i, obj) where xx is name or offset: name or offset of the i-th field of O.
  • field (i, obj) : the value of the i-th field of , if a reference; declared of type ANY in the class.
  • yy_field (i, obj) where yy is boolean, character, integer, real or double: the value of the i-th field of O, if of the corresponding type; each declared of the appropriate type in the class.
  • is_special (obj) : a boolean query which indicates whether O is a special object (the sequence of values representing the elements of an array or the characters of a string).

Warning: Only very special cases justify the use of the class INTERNAL. Unless you are writing the lowest level of an interface between an Eiffel application and external tools (such as a database management system), and this requires passing to those tools information about the internals of Eiffel objects, you almost certainly should not use INTERNAL .