Files
eiffel-org/documentation/18.07/eiffelstudio/eiffelstudio-reference/diagram-tool/diagram-tool-code-generation.wiki
eiffel-org 12a94b8720 added 18.07
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2049 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
2018-07-11 09:05:50 +00:00

99 lines
2.9 KiB
Plaintext

[[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: <br/>
<code>
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
</code>
* 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 ( <code>undefine</code>/ <code>select</code>/etc.) clauses to solve possible conflicts. <br/>
<code>
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
</code>
* When removing an inheritance link, the entire parent clause is removed, i.e. including any <code>redefine</code>/<code>undefine</code>/etc. until the matching <code>end</code>.
* When creating a client link, a function or attribute is generated by the feature wizard. When creating a function, this code is generated: <br/>
<code>
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
</code>
* 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: <br/>
<code>
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
</code>
* 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.