indexing
	description: "Access to internal object properties. This class may be used as ancestor by classes needing its facilities."

class interface
	INTERNAL

feature -- Access

	Bit_type: INTEGER is 8

	boolean_field (i: INTEGER; object: ANY): BOOLEAN
			-- Boolean value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			boolean_field: field_type (i, object) = boolean_type

	Boolean_type: INTEGER is 3

	character_field (i: INTEGER; object: ANY): CHARACTER
			-- Character value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			character_field: field_type (i, object) = character_type

	Character_type: INTEGER is 2

	class_name (object: ANY): STRING
			-- Name of the class associated with object
		require
			object_not_void: object /= void

	double_field (i: INTEGER; object: ANY): DOUBLE
			-- Double precision value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			double_field: field_type (i, object) = double_type

	Double_type: INTEGER is 6

	dynamic_type (object: ANY): INTEGER
			-- Dynamic type of object
		require
			object_not_void: object /= void

	expanded_field_type (i: INTEGER; object: ANY): STRING
			-- Class name associated with the i-th
			-- expanded field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			is_expanded: field_type (i, object) = expanded_type
		ensure
			result_exists: Result /= void

	Expanded_type: INTEGER is 7

	field (i: INTEGER; object: ANY): ANY
			-- Object attached to the i-th field of object
			-- (directly or through a reference)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			not_special: not is_special (object)

	field_name (i: INTEGER; object: ANY): STRING
			-- Name of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			not_special: not is_special (object)
		ensure
			result_exists: Result /= void

	field_offset (i: INTEGER; object: ANY): INTEGER
			-- Offset of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			not_special: not is_special (object)

	field_type (i: INTEGER; object: ANY): INTEGER
			-- Type of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object)

	integer_field (i: INTEGER; object: ANY): INTEGER
			-- Integer value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			integer_field: field_type (i, object) = integer_type

	Integer_type: INTEGER is 4

	is_special (object: ANY): BOOLEAN
			-- Is object a special object?
		require
			object_not_void: object /= void

	pointer_field (i: INTEGER; object: ANY): POINTER
			-- Pointer value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			pointer_field: field_type (i, object) = pointer_type

	Pointer_type: INTEGER is 0

	real_field (i: INTEGER; object: ANY): REAL
			-- Real value of i-th field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			real_field: field_type (i, object) = real_type

	Real_type: INTEGER is 5

	Reference_type: INTEGER is 1
	
feature -- Measurement

	bit_size (i: INTEGER; object: ANY): INTEGER
			-- Size (in bit) of the i-th bit field of object
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			is_bit: field_type (i, object) = bit_type
		ensure
			positive_result: Result > 0

	field_count (object: ANY): INTEGER
			-- Number of logical fields in object
		require
			object_not_void: object /= void

	physical_size (object: ANY): INTEGER
			-- Space occupied by object in bytes
		require
			object_not_void: object /= void
	
feature -- Element change

	set_boolean_field (i: INTEGER; object: ANY; value: BOOLEAN)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			boolean_field: field_type (i, object) = boolean_type

	set_character_field (i: INTEGER; object: ANY; value: CHARACTER)
			-- Set character value of i-th field of object to value
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			character_field: field_type (i, object) = character_type

	set_double_field (i: INTEGER; object: ANY; value: DOUBLE)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			double_field: field_type (i, object) = double_type

	set_integer_field (i: INTEGER; object: ANY; value: INTEGER)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			integer_field: field_type (i, object) = integer_type

	set_pointer_field (i: INTEGER; object: ANY; value: POINTER)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			pointer_field: field_type (i, object) = pointer_type

	set_real_field (i: INTEGER; object: ANY; value: REAL)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			real_field: field_type (i, object) = real_type

	set_reference_field (i: INTEGER; object: ANY; value: ANY)
		require
			object_not_void: object /= void;
			index_large_enough: i >= 1;
			index_small_enough: i <= field_count (object);
			reference_field: field_type (i, object) = reference_type
	
feature -- Conformance

	is_instance_of (object: ANY; type_id: INTEGER): BOOLEAN
			-- Is object an instance of type type_id?
		require
			object_not_void: object /= void

	type_conforms_to (type1, type2: INTEGER): BOOLEAN
			-- Does type1 conform to type2?
	
feature -- Creation

	new_instance_of (type_id: INTEGER): ANY
			-- New instance of type type_id.
			-- Note: returned object is not initialized and may
			-- hence violate its invariant.
	
feature -- Version

	compiler_version: INTEGER
	
invariant

		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);

end -- class INTERNAL