Using the code generator to create the interface implementations - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

The code generator mentioned here is available through customer support. Please file a SmartPlant Foundation service request for access to the code generator and the code samples mentioned in this guide.

At an early stage it was determined that behavior needed to be related to InterfaceDefs. What better way of doing this than using the schema itself to relate this information. Two options were available - a semantic engine or an Interface/Method approach. The decision to use the Interface/Method approach was taken, and this led to the creation of a new ClassDef called the MethodDef.

In programming terms, by relating InterfaceDefs to behavior you actually imply that you are relating a function or subroutine to an Interface; in our case the function is equivalent to the MethodDef. To ensure correct operation of the code at all times, the schema must be synchronized with the code.

Keeping the schema and code synchronized manually could become a real chore and would be prone to human error. This is why a CodeGenerator is used. The schema has enough information about the behavior to generate this information. The class structure it generates is architected in such a way that existing implementation will not be lost once the two are synchronized.