deferred class INTERNALS

All features

WARNING: This interface is tentative and may change to a large extent from SmartEiffel 2.2 to SmartEiffel 2.3.

INTERNALS serves as a gateway between the typed ideal world of Eiffel objects and the untyped physical world of raw memory, files on disks, streams on networks...

All instances of INTERNALS must be of type TYPED_INTERNALS. Each INTERNALS object describes the physical structure of exactly one type. For instance, TYPED_INTERNALS[STRING] describes the physical structure of class STRING.

Optionally, an object of an INTERNAL's associated type can be attached to that INTERNAL. The INTERNAL can then be used to inspect and change the values of the attributes of the attached object. For instance, a STRING could be attached to a TYPED_INTERNALS[STRING]. The TYPED_INTERNALS[STRING] could then be used to get or set this STRING's attributes.

This class is meant as a very basic building block. Please read the following advice to use INTERNALS wisely:

1. Don't use INTERNALS

2. If rule 1. is unapplicable, use INTERNALS to build a higher-level abstraction, and use that

   abstraction in your -- application. You really don't want INTERNALS scattered around your --
   application code.

Direct parents

non-conformant parents

ANY

Known children

conformant children

TYPED_INTERNALS

Summary

exported features

Getting information about the described object's type

Getting information about the type's attributes

Accessing the object

Accessing the object's attributes

Details

deferred type_generator: STRING

Name of the base class of the type described by Current. For instance, if Current is a TYPED_INTERNALS[ARRAY[INTEGER]], type_generator is "ARRAY".

deferred type_generating_type: STRING

Name of the type described by Current. For instance, if Current is a TYPED_INTERNALS[ARRAY[INTEGER]], type_generating_type is "ARRAY[INTEGER]".

deferred type_is_expanded: BOOLEAN

Is the type described by Current expanded?

type_is_native_array: BOOLEAN

Is the type described by Current a NATIVE_ARRAY?

ensure

  • Result = type_generator.is_equal(once "NATIVE_ARRAY")

deferred type_attribute_is_expanded (i: INTEGER): BOOLEAN

Is the type of the ith attribute expanded?

require

  • i.in_range(1, type_attribute_count)

deferred type_can_be_assigned_to_attribute (other: INTERNALS, i: INTEGER): BOOLEAN

Can the object attached to other be assigned to the ith attribute?

require

  • i.in_range(1, type_attribute_count)

ensure

  • other = Void implies Result = not type_attribute_is_expanded(i)

deferred type_attribute_count: INTEGER

Number of attributes of the type described by Current

deferred type_attribute_name (i: INTEGER): STRING

Name of the ith attribute of the type described by Current.

require

  • i.in_range(1, type_attribute_count)

ensure

  • Result /= Void

deferred type_attribute_generator (i: INTEGER): STRING

Name of the base class of the ith attribute of the type described by Current.

require

  • i.in_range(1, type_attribute_count)

ensure

  • Result /= Void

deferred type_attribute_generating_type (i: INTEGER): STRING

Name of the type of the ith attribute of the type described by Current.

require

  • i.in_range(1, type_attribute_count)

ensure

  • Result /= Void

deferred object_as_pointer: POINTER

Pointer to the object currently attached to Current.

require

  • type_is_expanded implies type_generator.is_equal(once "NATIVE_ARRAY")

ensure

  • Result.is_not_null

deferred object_attribute (i: INTEGER): INTERNALS

Read the ith attribute of the type described by Current (also see type_attribute). If this attribute is attached to an object, then Result is also attached to that object

require

  • i.in_range(1, type_attribute_count)

ensure

  • type_attribute_is_expanded(i) implies Result /= Void

deferred set_object_attribute (element: INTERNALS, i: INTEGER)

Write the ith attribute of the type described by Current

require

  • i.in_range(1, type_attribute_count)
  • type_can_be_assigned_to_attribute(element, i)
  • object_can_be_modified

ensure

  • element = Void implies object_attribute(i) = Void
  • element /= Void implies object_attribute(i).is_equal(element)

object_can_be_retrieved: BOOLEAN

Can the object be retrieved by the rest of the system through object?

object_can_be_modified: BOOLEAN

Can the object be modified through set_object_attribute, i.e. is it safely isolated from the rest of the system?

ensure

  • Result = not object_can_be_retrieved

set_object_can_be_retrieved

Forbid further modification of the object through set_object_attribute, so that it can safely be released into the system

ensure

  • object_can_be_retrieved