[[Property:title|Diagram tool: Code generation]]
[[Property:weight|5]]
[[Property:uuid|f0ed7470-cc28-a0e3-df16-36a47d34f852]]
All actions taken in the diagram tool that modify a part of the system are immediately reflected in the Eiffel system. Following is a summary of these actions.
* When you create a new class, this is the generated empty class:
note
description: "Objects that ..."
author: ""
date: "$Date: 2008-09-02 13:54:45 +0200 (Tue, 02 Sep 2008) $"
revision: "$Revision: 74646 $"
class
CLASS_NAME
end -- class CLASS_NAME
* When you delete a class, the class file is removed from the disk.
* When you add a parent to a class, the parent is inserted in the existing inheritance clause, ''without'' any additional ( undefine
/ select
/etc.) clauses to solve possible conflicts.
note
description: "Objects that ..."
author: ""
date: "$Date: 2008-09-02 13:54:45 +0200 (Tue, 02 Sep 2008) $"
revision: "$Revision: 74646 $"
class
CLASS_NAME
inherit
NEW_PARENT
end -- class CLASS_NAME
* When removing an inheritance link, the entire parent clause is removed, i.e. including any redefine
/undefine
/etc. until the matching end
.
* When creating a client link, a function or attribute is generated by the feature wizard. When creating a function, this code is generated:
note
description: "Objects that ..."
author: ""
date: "$Date: 2008-09-02 13:54:45 +0200 (Tue, 02 Sep 2008) $"
revision: "$Revision: 74646 $"
class
CLASS_NAME
feature -- Access
f: TYPE
-- Client from CLASS_NAME to TYPE.
do
end
end -- class CLASS_NAME
* If you choose to create an attribute for the client link, and optionally specify to generate a set-procedure and an invariant, the following code will be pasted into the class text:
note
description: "Objects that ..."
author: ""
date: "$Date: 2008-09-02 13:54:45 +0200 (Tue, 02 Sep 2008) $"
revision: "$Revision: 74646 $"
class
CLASS_NAME
feature -- Access
f: TYPE
-- Client from CLASS_NAME to TYPE.
feature -- Element change
set_f (a_f: TYPE)
-- Client from CLASS_NAME to TYPE.
require
a_f_not_void: af /= Void
do
f := a_f
ensure
f_assigned: f = a_f
end
invariant
f_not_void: f /= Void
end -- class CLASS_NAME
* When removing a client link, only the matching function or attribute is removed. Any additionally generated set-feature or invariant is not removed.
* When removing a cluster, the associated directory is not erased, but the reference to the cluster is removed from the configuration file. At this time, it is not possible to create a cluster using the diagram tool, only to remove one.