Strategy for maintaining reversible properties (ACS)
ACS supports the changing of the selected properties (reversible properties) in either the model or the generated code files. Examples of these reversible properties are as follows:
Operation Body text — in Modeler this text is specified on the Body tab of an Operation's Property Pages (all Code Generator DLLs).
Event Action Block Guard Condition text — in Modeler this text is specified on the Options tab of an Event Action Block's Property Pages (C and C++ only).
Event Action Block Action text — in Modeler this text is specified on the Options tab of an Event Action Block's Property Pages (C and C++ only).
Ada Declaration text — in Modeler this text is specified on the Ada Declaration tab of an Operation's Property Pages, having applied the «Ada Declaration» stereotype to the Operation (Ada only).
C# Add Accessor Body text — In Modeler this text is the tagged value of the C# Add Accessor Body tag definition (C# only).
C# Get Accessor Body text — In Modeler this text is the tagged value of the C# Get Accessor Body tag definition (C# only).
C# Remove Accessor Body text — In Modeler this text is the tagged value of the C# Remove Accessor Body tag definition (C# only).
C# Set Accessor Body text – In Modeler this text is the tagged value of the C# Set Accessor Body tag definition (C# only).
VB Declare text — In Modeler this text is the tagged value of the VB Declare tag definition, which can be applied to a Class, Data Type or Interface through the «VB Class» stereotype (VB only).
VB GetAccessorBody text — In Modeler this text is the tagged value of the VB GetAccessorBody tag definition, which can be applied to an Attribute or Role through the «VB Property» stereotype (VB only).
VB Imports text — In Modeler this text is the tagged value of the VB Imports tag definition, which can be applied to a Class, Data Type, Interface or Package through the «VB Unit» stereotype (VB only).
VB SetAccessorBody text — In Modeler this text is the tagged value of the VB SetAccessorBody tag definition, which can be applied to an Attribute or Role through the «VB Property» stereotype (VB only).
When ACS generates reversible properties, the text in the model is generated between two markers in the code file. For example:
//## Operation [babfba4b-6c05-466b-be77-034d99bbd453]
//## Operation End
Through these markers, ACS can compare marked text against its associated item property value in the model. For reversible properties, the markers in the code files are as follows:
For Operation Body text, the markers are // ## Operation [<id>] and // ## Operation End.
For Event Action Block Guard Condition text, the markers are // ## Guard [<id>] and // ## Guard End.
For Event Action Block Action text, the markers are // ## Action [<id>] and // ## Action End.
For Ada Declaration text, the markers are // ## Decl [<id>] and // ## Decl End.
For C# Add Accessor Body text, the markers are // ## AccessorAdd [<id>] and // ## AccessorAdd End.
For C# Get Accessor Body text, the markers are // ## AccessorGet [<id>] and // ## AccessorGet End.
For C# Remove Accessor Body text, the markers are // ## AccessorRemove [<id>] and // ## AccessorRemove End.
For C# Set Accessor Body text, the markers are // ## AccessorSet [<id>] and // ## AccessorSet End.
For VB Declare text, the markers are ## Declare [<id>] and ## Declare End.
For VB GetAccessorBody text, the markers are ## VBGetAccessorBody [<id>] and ## VBGetAccessorBody End.
For VB Imports text, the markers are ## Imports [<id>] and ## Imports End.
For VB SetAccessorBody text, the markers are ## VBSetAccessorBody [<id>] and ## VBSetAccessorBody End.
* 
Only text within markers can be reverse engineered by ACS.
You must decide on a strategy for maintaining reversible properties, either through the properties in Modeler or through the marked text in code files.
When deciding on a strategy, it is important that you understand how ACS generates reversible properties and reverse engineers marked text while it is running. In addition, you should understand how ACS on startup generates reversible properties and reverse engineers marked text that has been changed while ACS has not running.
If you are using a Modeler CM branch (sandbox), you must be aware of the implications of working with reversible properties that are read-only. Likewise, if you are using CM tool integration to check in and check out model packages or code files, you must be aware of the implications of working with model Packages and code files that are read-only.
Changes made while ACS is running
It is best to make changes to reversible properties while ACS is running, because ACS can detect the change and then keep the text in the model and your code files synchronized.
While ACS is running (assuming ACS is working with the complete model and you can write to all model items and code files):
Changes you make to reversible properties are generated to your code files, assuming generate is enabled.
Changes made to marked text in your code files are reverse engineered to the model, assuming reverse is enabled.
Changes made while ACS is not running
On starting ACS with a model, ACS can detect differences between the reversible properties in the model and the associated marked text in your code files. ACS has two options for automatically synchronizing reversible properties on startup.
Reverse on Startup
On startup, this option makes ACS reverse engineer reversible marked text that is not in sync.
Generate on Startup
On startup, this option makes ACS generate code files for reversible properties that are not in sync. If marked text is out of sync because they cannot be reverse engineered, ACS does not overwrite that marked text in the code file.
If both of the preceding options are enabled, ACS reverse engineers marked text, and then ACS forces a generation. If both the preceding options are disabled, then reversible properties and their associated marked text are not automatically synchronized on startup.
Set the startup options on the ACS/TDK Setting dialog, which you can open through the Edit ACS Settings tab button.
* 
If the Generate on Startup check box is selected and you disable generation through the Enable or Disable Code Generation button, ACS clears the Generate on Startup check box. Likewise, if the Reverse on Startup check box is selected and you disable reverse engineering through the Enable Disable Reverse Engineering button, ACS clears the Reverse on Startup check box.
How you use the preceding options depends on your strategy for maintaining reversible properties. The options are covered later in this topic.
Why it is important to keep reversible properties synchronized
If a reversible property in the model is different from its associated marked text in the code file, there is a risk of a change being lost.
Example of how an operation body change in the model can be lost (Generate on Startup disabled):
MyClass1 has two operations named Op1 and Op2. While ACS is not running, you change Op1 in the model. On startup, ACS does not generate the change because Generate on Startup is disabled. You change Op2 in your code file, ACS detects a change in the code file and updates all the Class operations from the code file, your change to Op1 is lost.
Example of how an operation body change in the code can be lost (Reverse on Startup disabled):
MyClass11 has two operations named Op11 and Op12. While ACS is not running, you change Op11 in your code file. On startup, ACS does not reverse the change because Reverse on Startup is disabled. Another user changes Op12 in the model, ACS regenerates the code file, your change to Op11 is lost.
By adopting a suitable strategy for maintaining reversible properties, you can remove or minimize the risk of losing changes that you make.
Working with a specific package
If you are working with only a specific package in a multi-user model, you may want to set up that package as the root object for ACS:
If you select the model, ACS generates and reverse engineers code files for the complete model.
If you select a Package, ACS generates and reverse engineers code files only for the child items of that Package and its sub-Packages.
You must select a root object in Modeler before creating a Generation Settings Scheme, and thereafter that Generation Settings Scheme is available only for that root object.
Changing reversible properties in the model or in the code files
You should decide whether you want to change reversible properties in the model or in your code files. After making your decision, you can then set up the ACS options accordingly. We recommend that you make all changes to reversible properties in either the model or the code files.
In a single-user model, you can choose to maintain reversible properties in the model or your code files:
If you want to maintain reversible properties in the model, you disable reverse engineering, enable generation, and enable generate on startup.
If you want to maintain reversible properties in your code files, you enable reverse engineering, and enable reverse on startup. You must also enable generation and enable generate on startup so that model changes are generated.
Changing reversible properties in the model is the safest option, but it is more convenient to maintain reversible properties in your code environment. Working with Modeler access permissions, Modeler CM, CM tool integration, and code files under CM control introduces complications.
* 
If ACS cannot reverse engineer marked text, ACS will not overwrite that marked text in the code file on generation.
If a code file is read-only, ACS will not reverse engineer marked text from that code file.
For more information about maintaining reversible properties in the model and in code files, see the Related Topics.
Was this helpful?