Up Top       Prev FIXED_ARRAY3      Next GEN_RAND



class interface GENERAL
   --
   -- Platform-independent universal properties.
   -- This class is an ancestor to all developer-written classes.
   --

feature(s) from GENERAL
   -- Access:

   generating_type: STRING
      -- Name of current object's generating type (type of
      -- which it is a direct instance).


   generator: STRING
      -- Name of current object's generating class (base class
      -- of the type of which it is a direct instance).


   stripped (other: GENERAL): like other
      -- Newly created object with fields copied from current object,
      -- but limited to attributes of type of other.

      require
         conformance: conforms_to(other)
      ensure
         stripped_to_other: Result.same_dynamic_type(other)

feature(s) from GENERAL
   -- Status report:

   conforms_to (other: GENERAL): BOOLEAN
      -- Is dynamic type of Current a descendant of dynamic type of
      -- other ?
      --
      -- Note: because of automatic conversion from expanded to reference
      -- type when passing argument other, do not expect a correct
      -- behavior with  expanded types.

      require
         not is_expanded_type;
         other_not_void: other /= Void

   same_dynamic_type (other: like Current): BOOLEAN
      -- Is the dynamic type of Current identical to the dynamic type 
      -- of other?


feature(s) from GENERAL
   -- Comparison:

   equal (some: ANY; other: like some): BOOLEAN
      -- Are some and other both Void or attached to objects 
      -- considered equal ?

      ensure
         symmetric: Result implies equal(other,some)

   is_equal (other: like Current): BOOLEAN
      -- Is other attached to an object considered equal to
      -- current object ?

      require
         other /= Void
      ensure
         generating_type = other.generating_type implies Result = other.is_equal(Current)

   standard_equal (some: ANY; other: like some): BOOLEAN
      -- Are some and other both Void or attached to
      -- field-by-field objects of the same type ?
      -- Always use the default object comparison criterion.

      ensure
         definition: Result = (some = Void and other = Void) or else some /= Void and other /= Void and then some.standard_is_equal(other)

   standard_is_equal (other: like Current): BOOLEAN
      -- Are Current and other field-by-field identical?

      require
         other /= Void
      ensure
         same_dynamic_type(other) implies Result = other.standard_is_equal(Current)

feature(s) from GENERAL
   -- Deep Comparison:

   deep_equal (some: ANY; other: like some): BOOLEAN
      -- Are some and other either both Void or attached to
      -- recursively isomorphic object structures ?

      ensure
         shallow_implies_deep: standard_equal(some,other) implies Result

   is_deep_equal (other: like Current): BOOLEAN
      -- Is Current recursively isomorph with other ?

      require
         other_not_void: other /= Void

feature(s) from GENERAL
   -- Duplication:

   clone (other: ANY): like other
      -- When argument other is Void, return Void otherwise 
      -- return other.twin.

      ensure
         equal: equal(Result,other)

   twin: like Current
      -- Return a new object with the dynamic type of Current.
      -- Before being returned, the new object is initialized using
      -- feature copy (Current is passed as the argument).
      -- Thus, when feature copy of GENERAL is not redefined,
      -- twin has exactly the same behaviour as standard_twin.

      ensure
         equal: Result.is_equal(Current)

   copy (other: like Current)
      -- Update current object using fields of object attached
      -- to other, so as to yield equal objects.
      -- Note: you can't copy object from a different dynamic type.

      require
         same_dynamic_type(other)
      ensure
         is_equal(other)

   standard_clone (other: ANY): like other
      -- Void if other is Void; otherwise new object
      -- field-by-field identical to other.
      -- Always use the default copying semantics.

      ensure
         equal: standard_equal(Result,other)

   standard_twin: like Current
      -- Return a new object with the dynamic type of Current.
      -- Before being returned, the new object is initialized using
      -- feature standard_copy (Current is passed as the argument).


   standard_copy (other: like Current)
      -- Copy every field of other onto corresponding field of
      -- current object.

      require
         other_not_void: other /= Void
      ensure
         standard_is_equal(other)

feature(s) from GENERAL
   -- Deep Duplication:

   deep_clone (other: ANY): like other
      -- When argument other is Void, return Void
      -- otherwise return other.deep_twin.

      ensure
         deep_equal(other,Result)

   deep_twin: like Current
      -- Return a new object with the dynamic type of Current.
      -- The new object structure is recursively duplicated from the one
      -- attached to Current.


feature(s) from GENERAL
   -- Basic operations:

   default: like Current
      -- Default value of entities declared with the Current type.
      -- Hence, the Result is Void for all reference types and, as another 
      -- example, the Result is 0 for an INTEGER expression.


   is_default: BOOLEAN
      -- Is the Current object in the default state?
      -- For example, when this feature is applied on an INTEGER, the 
      -- Result is True only when the INTEGER is 0.  If not redefined, the 
      -- Result is always False for a reference expression. Actually, this 
      -- is_default predicate may be useful for user-defined expanded 
      -- objects stored in collection (see all_default of class 
      -- COLLECTION).


   default_pointer: POINTER
      -- Default value of type POINTER (avoid the need to write p.default 
      -- for some p of type POINTER).

      ensure
         Result = Result.default

   default_rescue
      -- Handle exception if no Rescue clause. (Default: do nothing.)


   do_nothing
      -- Execute a null action.


feature(s) from GENERAL
   -- Input and Output:

   io: STD_INPUT_OUTPUT
      -- Handle to standard file setup.
      -- To use the standard input/output file.
      -- Has type STD_FILES in ELKS 95.

      ensure
         Result /= Void

   std_input: STD_INPUT
      -- To use the standard input file.


   std_output: STD_OUTPUT
      -- To use the standard output file.


   std_error: STD_ERROR
      -- To use the standard error file.


feature(s) from GENERAL
   -- Object Printing:

   print (some: GENERAL)
      -- Write terse external representation of some on
      -- standard_output.
      -- To customize printing, one may redefine
      -- fill_tagged_out_memory or out_in_tagged_out_memory (see
      -- for example how it works in class COLLECTION).
      -- Not frozen in ELKS 95.


   print_on (file: OUTPUT_STREAM)
      -- Default printing of current object on a file.
      -- One may redefine fill_tagged_out_memory or
      -- out_in_tagged_out_memory to adapt the behavior of
      -- print_on.
      --


   tagged_out: STRING
      -- New string containing printable representation of current
      -- object, each field preceded by its attribute name, a
      -- colon and a space.


   out: STRING
      -- Create a new string containing terse printable
      -- representation of current object.


   out_in_tagged_out_memory
      -- Append terse printable represention of current object
      -- in tagged_out_memory.

      ensure
         not_cleared: tagged_out_memory.count >= old tagged_out_memory.count;
         append_only: (old tagged_out_memory.twin).is_equal(tagged_out_memory.substring(1,old tagged_out_memory.count))

   tagged_out_memory: STRING

   fill_tagged_out_memory
      -- Append a viewable information in tagged_out_memory in
      -- order to affect the behavior of out, tagged_out, etc.


feature(s) from GENERAL
   -- Basic named file handling:

   file_tools: FILE_TOOLS

   file_exists (path: STRING): BOOLEAN
      -- True if path is an existing readable file.

      require
         not path.is_empty

   remove_file (path: STRING)
      require
         path /= Void

   rename_file (old_path, new_path: STRING)
      require
         old_path /= Void;
         new_path /= Void

feature(s) from GENERAL
   -- Access to command-line arguments:

   argument_count: INTEGER
      -- Number of arguments given to command that started
      -- system execution (command name does not count).

      ensure
         Result >= 0

   argument (i: INTEGER): STRING
      -- i th argument of command that started system execution
      -- Gives the command name if i is 0.

      require
         i >= 0;
         i <= argument_count
      ensure
         Result /= Void

   command_arguments: FIXED_ARRAY[STRING]
      -- Give acces to arguments command line including the
      -- command name at index 0.

      ensure
         not Result.is_empty

feature(s) from GENERAL
   -- SCOOP:

   available: BOOLEAN
      -- Wait the result (By Necessity [TM])
      -- Always return True
      -- (Meaningless in a non-SCOOP world)


feature(s) from GENERAL
   -- System calls and crashs:

   crash
      -- Print Run Time Stack and then exit with exit_failure_code.


   trace_switch (flag: BOOLEAN)
      -- May be used in combination with option "-sedb" of command
      -- compile_to_c (see compile_to_c documentation for details).


   sedb_breakpoint
      -- May be used in combination with option "-sedb" of command
      -- compile_to_c to set a breakpoint for sedb, the SmartEiffel debugger.


   die_with_code (code: INTEGER)
      -- Terminate execution with exit status code code.
      -- Do not print any message.
      -- Note: you can use predefined exit_success_code or
      -- exit_failure_code as well as another code you need.


   exit_success_code: INTEGER

   exit_failure_code: INTEGER

feature(s) from GENERAL
   -- Should not exist:

   not_yet_implemented

feature(s) from GENERAL
   -- For ELS Compatibility:

   id_object (id: INTEGER): ANY
      -- Object for which object_id has returned id
      -- Void if none.

      require
         id /= 0

   object_id: INTEGER
      -- Value identifying current reference object.

      require
         not is_expanded_type

feature(s) from GENERAL
   -- The Guru section:

   to_pointer: POINTER
      -- This routine can be used only if the value of Current is really
      -- a memory address. (This is the case for all reference types and
      -- for the NATIVE_ARRAY type only.) Actually, this routine do
      -- nothing: the value of Current which is an address is returned
      -- unchanged. The compiler will emit a warning if you try to use
      -- to_pointer on some invalid type.


   is_expanded_type: BOOLEAN
      -- Target is not evaluated (Statically computed).
      -- Result is True if target static type is an expanded type.
      -- Useful for formal generic type.


   is_basic_expanded_type: BOOLEAN
      -- Target is not evaluated (Statically computed).
      -- Result is True if target static type is one of the
      -- following types: BOOLEAN, CHARACTER, INTEGER, REAL,
      -- DOUBLE or POINTER.

      ensure
         Result implies is_expanded_type

   object_size: INTEGER
      -- Gives the size of the current object at first level
      -- only (pointed-to sub-object are not concerned).
      -- The result is given in number of CHARACTER.


feature(s) from GENERAL
   -- Implementation of GENERAL (do not use directly):

   se_assigned_from (other: GENERAL): BOOLEAN
      -- To implement conforms_to (must only be called inside
      -- conforms_to because of VJRV rule).

      require
         not is_expanded_type



end of GENERAL




All classes inherit from ANY, ANY inherits from PLATFORM and PLATFORM inherits from GENERAL.



Generated by short -html_deb on 31 March 2005.