What it does - 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 integrates with existing server code to provide a very rich and simple framework of classes, interfaces, and properties.

A simple dual level code structure is used so that implementation code is never lost on regeneration. The regeneration process is seen as a constant ongoing task, not just to get server code up and running quickly. The generated level does all the leg work and provides all the code required for basic operation. The next level up (default) provides very minimal code to begin with, generally only creating stub functions that require populating.

This base class contains more properties and functions than you would initially expect; this is because the interfaces support multiple inheritance. To imitate multiple inheritance in a single inheritance language, you need to implement all the required properties and functions. It also makes coding easier when dealing with an instantiation of this particular interface because it negates the need to type back to inherited objects to call the functions.

It should be made clear that a ClassDef or InterfaceDef does not need to be generated to be able to access the information that may be stored upon it in the database. However, if functionality and behavior is required on an InterfaceDef, then a place holder for this routine must be generated. Interfaces and properties of an object can always be accessed using a dynamic method. In fact, all the Code Generator does is to build a hard-coded set of shortcuts to access the data dynamically. Creating actual coded classes for InterfaceDefs makes code much quicker to write and easier to understand.

The Code Generator goes several steps further than just creating code for accessing interfaces and properties. It also provides the following features:

  • Ability to expand EdgeDefs using generated relationship traversal functions. When properties are returned, the code generator starts and does several things:

    • The Schema is accessed through the SchemaComponent SDK, and once the Code Generator is running then it is ready. It is possible to regenerate just a single file or the entire collection required for a complete synchronization.

    • Their scoped type, for example, String, Integer, DateTime.

    • Code raises exceptions from inaccessible Properties or Interfaces that have been defined as required in the Schema.

    • Generates stub functions ready for MethodDef implementation.

    • Generates complete MetaSchema XML files in Container format.

    • Generates a set of Specialized Values for each InterfaceDef based upon the implies tree.

Be careful when defining Edges in the Schema Editor. If you set the Filter Edge flag, then the code generator will not be able to see the edge and will not generate any code for it.